-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
75 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.venv | ||
.vscode | ||
config | ||
dist | ||
build* | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,47 @@ | ||
**中文** | [English](README_en.md) | ||
# daycount-NBT | ||
|
||
[![](https://pic.stackoverflow.wiki/uploadImages/117/24/20/154/2021/08/24/23/08/8cd61849-6a34-4e2d-ad3a-c6056adef05e.svg)](https://github.com/Fallen-Breath/MCDReforged) | ||
|
||
MCDR插件,获取和输出服务器开服时间。 | ||
|
||
## 安装前置 | ||
如果你只使用日期模式,则无需此前置。 | ||
```bash | ||
pip install nbtlib | ||
``` | ||
|
||
如果你只使用日期模式,则无需前置。 | ||
|
||
- nbtlib | ||
|
||
## 使用说明 | ||
|
||
### 指令 | ||
|
||
`!!day`:查看服务器开服天数。 | ||
|
||
### API | ||
如果你不是开发者,则无需了解这部分内容。 | ||
简单的例子: | ||
```python | ||
import daycount | ||
def on_load(server, old): | ||
server.logger.info(daycount.getday()) | ||
server.logger.info(daycount.get_day_text()) | ||
``` | ||
`getday()`:返回一个整数,代表服务器开服天数。 | ||
|
||
如果你不是开发者,则无需了解这部分内容。 | ||
|
||
`getday()`:返回一个整数,代表服务器开服天数。 | ||
|
||
`get_day_text()`:返回根据配置 !!day 命令应输出的内容。 | ||
|
||
## 配置插件 | ||
|
||
### NBT 模式 | ||
在一般情况下,使用 NBT 模式无需进行任何配置,到手即用。如果您服务器的 `level.dat` 并非位于 `server/world/level.dat`,则需要手动配置。 | ||
用任意编辑器打开 .py 文件,修改 `nbt_file` 即可。 | ||
```python | ||
nbt_file = 'server/world/level.dat' # NBT文件位置 | ||
``` | ||
**注意**:NBT 模式的原理是获取服务器世界运行时间,所以输出的 **并非** 开服时间,而是 **地图的在线总时长**。 | ||
如果服务器回档,时间也会被还原到存档时的数值。 | ||
实际上,这比开服时间更能表达服务器的有效游玩时间( | ||
|
||
在一般情况下,使用 NBT 模式无需进行任何配置,到手即用。如果您服务器的 `level.dat` 并非位于 `server/world/level.dat`,则需要手动配置。 | ||
|
||
用任意编辑器打开配置文件,修改 `nbt_file` 即可。 | ||
|
||
**注意**:NBT 模式的原理是获取服务器世界运行时间,所以输出的 **并非** 开服时间,而是 **地图的在线总时长**。 如果服务器回档,时间也会被还原到存档时的数值。实际上,这比开服时间更能表达服务器的有效游玩时间( | ||
|
||
当然,使用日期模式可以避免这个问题。 | ||
|
||
### 日期模式 | ||
修改硬编码关闭 NBT 模式并设置日期,即可使用日期模式。 | ||
|
||
修改配置文件,关闭 NBT 模式并设置日期,即可使用日期模式。 | ||
|
||
日期格式应为 `%Y-%m-%d`。 | ||
|
||
### 自定义文字 | ||
自定义 `!!day` 命令输出的字符串。用 `$day` 代表开服天数。 | ||
|
||
## 已知问题 | ||
目前所有已知问题已修复。欢迎找茬~ | ||
|
||
~~## 吐槽 | ||
点名批评友商 [DaycountR](https://github.com/Van-Nya/DayCountR)。 | ||
作为一个“R”,将原本 [daycount](https://github.com/TISUnion/daycount) 的指令、代码逻辑完全打乱。 | ||
莫名其妙将简单的功能写了六七十行,而我这个功能相差不大的插件才三十几行。 | ||
DaycountR 还使用了配置文件(只是实现日期加减,配置文件又何必要?就算强迫症,为何代码有六七十行之多?) | ||
作为一个简单的开服时间插件,坚守本分才是王道。~~ | ||
自定义 `!!day` 命令输出的字符串。用 `$day` 代表开服天数。 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
获取和输出服务器开服时间。 | ||
|
||
特色功能: | ||
- NBT 模式 | ||
|
||
:warning: **务必在使用前阅读仓库中的 README!** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Get and export server opening times. | ||
|
||
Feature: | ||
- NBT Mode | ||
|
||
:warning: **Read README in repository before use!** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"id": "daycount_nbt", | ||
"version": "2.0.0", | ||
"name": "joinMOTD++", | ||
"description": { | ||
"en_us": "Get and export server opening times.", | ||
"zh_cn": "获取和输出服务器开服时间。" | ||
}, | ||
"dependencies": { | ||
"mcdreforged": ">=2.0.1" | ||
}, | ||
"author": "Alex3236", | ||
"link": "https://github.com/eagle3236/joinMOTD_Plus" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nbtlib |