Skip to content

Commit

Permalink
v0.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Feb 8, 2025
1 parent dfdee41 commit 28d22c0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 32 deletions.
15 changes: 1 addition & 14 deletions loginproxy/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def kick(self, reason: str | dict[str, Any] = 'You have been kicked', *,
if isinstance(reason, str):
nbt.String('LoginProxy: ' + reason).to_bytes(buf)
else:
json2nbt(reason).to_bytes(buf)
nbt.chat_object_to_nbt(reason).to_bytes(buf)
debug('Disconnected:', buf.data)
self.send_client(buf.data)
else:
Expand Down Expand Up @@ -328,19 +328,6 @@ def new_packet(self, packet_name: str) -> 'PacketBuilder':
status = ConnStatus.from_packet_name(packet_name)
return PacketBuilder(self, idset.is_c2s[packet_name], status, packet_id)

def json2nbt(chat: dict):
from packet_parser import nbt
comp = nbt.Compound([])
for k, v in chat.items():
if isinstance(v, bool):
comp[k] = nbt.Byte(1 if v else 0)
elif isinstance(v, str):
comp[k] = nbt.String(v)
elif isinstance(v, dict):
comp[k] = json2nbt(v)
else:
raise TypeError(f'Unexpected type {type(v)}')

class PacketBuilder(PacketBuffer):
__slots__ = ('_conn', '_status', '_is_c2s')

Expand Down
36 changes: 18 additions & 18 deletions mcdreforged.plugin.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"id": "loginproxy",
"version": "0.8.6",
"name": "LoginProxy",
"description": {
"en_us": "A Minecraft login proxy plugin",
"zh_cn": "Minecraft 服务器登录代理兼白名单插件"
},
"author": "zyxkad",
"link": "https://github.com/kmcsr/login_proxy_mcdr",
"dependencies": {
"mcdreforged": "^2.3.0",
"python": "^3.12",
"kpi": "~1.5.1"
},
"resources": [
"LICENSE",
"lang"
]
"id": "loginproxy",
"version": "0.8.7",
"name": "LoginProxy",
"description": {
"en_us": "A Minecraft login proxy plugin",
"zh_cn": "Minecraft 服务器登录代理兼白名单插件"
},
"author": "zyxkad",
"link": "https://github.com/kmcsr/login_proxy_mcdr",
"dependencies": {
"mcdreforged": "^2.3.0",
"python": "^3.12",
"kpi": "~1.5.1"
},
"resources": [
"LICENSE",
"lang"
]
}

0 comments on commit 28d22c0

Please sign in to comment.