Skip to content

Commit

Permalink
- 重写了默认配置文件,开箱即用
Browse files Browse the repository at this point in the history
- 修复了创建配置文件时报错
- 改写了部分逻辑
- 版本号更改为v1.0.0
  • Loading branch information
HIM049 committed Feb 14, 2023
1 parent eeec374 commit 6383dd1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions hibernate_r/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def check_player_num(server: PluginServerInterface):
if len(lib_online_player.get_player_list()) == 0:

check_config_fire(server)
time.sleep(2)
with open("config/HibernateR.json", "r") as file:
config = json.load(file)
wait_min = config["wait_min"]
Expand All @@ -57,6 +58,7 @@ def check_player_num(server: PluginServerInterface):
def fake_server(server: PluginServerInterface):

check_config_fire(server)
time.sleep(2)
with open("config/HibernateR.json", "r") as file:
config = json.load(file)
fs_ip = config["ip"]
Expand Down Expand Up @@ -93,7 +95,7 @@ def fake_server(server: PluginServerInterface):
server.logger.info("开始监听端口")
try:
while True:
server.logger.info("等待连接")
# server.logger.info("等待连接")
client_socket, client_address = server_socket.accept()
try:
recv_data = client_socket.recv(1024)
Expand Down Expand Up @@ -181,15 +183,12 @@ def crative_config_fire():
config["port"] = 25565
config["protocol"] = 2
config["motd"] = {}
config["motd"]["1"] = 4Maintenance!"
config["motd"]["2"] = aCheck example.com for more information!"
config["version_text"] = 4Maintenance"
config["kick_message"] = [bSorry", "", aThis server is offline!"]
config["motd"]["1"] = e服务器正在休眠!"
config["motd"]["2"] = c进入服务器可将服务器从休眠中唤醒"
config["version_text"] = 4Sleeping"
config["kick_message"] = [e§l请求成功!", "", f服务器正在启动!请稍作等待后进入"]
config["server_icon"] = "server_icon.png"
config["samples"] = ["§bexample.com", "", "§4Maintenance"]
config["show_ip_if_hostname_available"] = True
config["player_max"] = 0
config["player_online"] = 0
config["samples"] = ["服务器正在休眠", "进入服务器以唤醒"]

with open("config/HibernateR.json","w") as file:
json.dump(config, file, sort_keys=True, indent=4, ensure_ascii=False)
Expand Down
Binary file removed hibernate_r/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed hibernate_r/__pycache__/byte_utils.cpython-311.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion mcdreforged.plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "hibernate_r",
"version": "0.1.0",
"version": "1.0.0",
"name": "HibernateR",
"description": "一个MCDReforged插件,可以根据服务器内玩家情况自动开启或关闭服务器",
"author": [
Expand Down

0 comments on commit 6383dd1

Please sign in to comment.