diff --git a/README.md b/README.md index dc91737..86e9d54 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,10 @@ MCSTAT_SHORTCUTS=' 由于第一次测得的延迟一般不准,所以做了这个配置, 开启后每次查询时,会丢掉第一次的结果再查询一次,且使用第二次查询到的结果 +### `MCSTAT_JAVA_PROTOCOL_VERSION` - Motd Java 服务器时向服务器发送的客户端协议版本 + +默认:`767` + ## 🎉 使用 发送 `motd` 指令 查看使用指南 @@ -226,6 +230,10 @@ Telegram:[@lgc2333](https://t.me/lgc2333) ## 📝 更新日志 +### 0.6.2 + +- 允许自定义向 Java 服务器发送的客户端协议版本,且提高默认协议版本以解决部分服务器 Motd 渐变显示异常的问题 + ### 0.6.1 - fix [#21](https://github.com/lgc-NB2Dev/nonebot-plugin-picmcstat/issues/21) diff --git a/nonebot_plugin_picmcstat/__init__.py b/nonebot_plugin_picmcstat/__init__.py index 3cb91e7..1f53213 100644 --- a/nonebot_plugin_picmcstat/__init__.py +++ b/nonebot_plugin_picmcstat/__init__.py @@ -5,7 +5,7 @@ from . import __main__ as __main__ # noqa: E402 from .config import ConfigClass # noqa: E402 -__version__ = "0.6.1" +__version__ = "0.6.2" __plugin_meta__ = PluginMetadata( name="PicMCStat", description="将一个 Minecraft 服务器的 MOTD 信息绘制为一张图片", diff --git a/nonebot_plugin_picmcstat/config.py b/nonebot_plugin_picmcstat/config.py index 7ce7756..eeec856 100644 --- a/nonebot_plugin_picmcstat/config.py +++ b/nonebot_plugin_picmcstat/config.py @@ -22,6 +22,7 @@ class ConfigClass(BaseModel): mcstat_shortcuts: List[ShortcutType] = Field(default_factory=list) mcstat_resolve_dns: bool = True mcstat_query_twice: bool = True + mcstat_java_protocol_version: int = 767 config = get_plugin_config(ConfigClass) diff --git a/nonebot_plugin_picmcstat/draw.py b/nonebot_plugin_picmcstat/draw.py index ce95ec7..457eba0 100644 --- a/nonebot_plugin_picmcstat/draw.py +++ b/nonebot_plugin_picmcstat/draw.py @@ -407,9 +407,10 @@ async def draw(ip: str, svr_type: ServerType) -> BytesIO: host, port = await resolve_ip(ip, is_java) svr = JavaServer(host, port) if is_java else BedrockServer(host, port) + kw = {"version": config.mcstat_java_protocol_version} if is_java else {} if config.mcstat_query_twice: - await svr.async_status() # 第一次延迟通常不准 - resp = await svr.async_status() + await svr.async_status(**kw) # 第一次延迟通常不准 + resp = await svr.async_status(**kw) return draw_resp(resp, ip) except Exception as e: diff --git a/pyproject.toml b/pyproject.toml index ac93a24..dc6af6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,10 +4,10 @@ dynamic = ["version"] description = "A NoneBot2 plugin generates a pic from a Minecraft server's MOTD" authors = [{ name = "student_2333", email = "lgc2333@126.com" }] dependencies = [ - "nonebot2>=2.3.1", - "nonebot-plugin-alconna>=0.48.0", + "nonebot2>=2.3.3", + "nonebot-plugin-alconna>=0.52.3", "mcstatus>=11.1.1", - "pil-utils>=0.1.10", + "pil-utils>=0.1.12", "punycode>=0.2.1", "dnspython>=2.6.1", ]