Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加延迟自定义文字 #99

Closed
XueSonga opened this issue Jun 1, 2023 · 39 comments
Closed

添加延迟自定义文字 #99

XueSonga opened this issue Jun 1, 2023 · 39 comments
Labels
enhancement New feature or request

Comments

@XueSonga
Copy link

XueSonga commented Jun 1, 2023

新功能建议

添加延迟自定义文字

  • 当我在使用其他付费加速ip时,看的其延迟被改成下图这样
  • 当我把鼠标放在玩家栏的位置时,会出现文字
所有我想知道这是怎么实现的,或者能在ZBProxy否实现. (应该能实现,别人已经做出来了)
@BiliZheXue
Copy link

@CryptEvc 可以实现 但是就轻量转发这个定位而言 没有必要

@BiliZheXue
Copy link

@CryptEvc 可以自行修改motd.go以实现所给图中效果

@XueSonga
Copy link
Author

XueSonga commented Jun 1, 2023

有没有结构的说明啊,硬改实现不了

@OPNetworkLOL
Copy link

会导致效率缺失,如果你没有修改的水平,修改可能导致无法使用

@BiliZheXue
Copy link

@CryptEvc 修改motd.go即可 该文件是负责motd等东西的
看不懂可以问gpt(

@layou233 layou233 added the enhancement New feature or request label Jun 1, 2023
@XueSonga
Copy link
Author

XueSonga commented Jun 1, 2023

@CryptEvc 修改motd.go即可 该文件是负责motd等东西的 看不懂可以问gpt(

好,谢谢你们啦

@XueSonga
Copy link
Author

XueSonga commented Jun 2, 2023

好了这个issues要关了,我找到了一篇具体的教程,希望对后面的人有帮助https://www.spigotmc.org/threads/tutorial-making-the-serverlist-motd-have-hover-text-and-making-the-player-count-whatever-you-want.156114/

@XueSonga XueSonga closed this as completed Jun 2, 2023
@layou233
Copy link
Owner

layou233 commented Jun 2, 2023

我打算在接下来的版本实现这个功能,所以先保持开启吧。

@layou233 layou233 reopened this Jun 2, 2023
@OPNetworkLOL

This comment was marked as off-topic.

@OOPSgary

This comment was marked as off-topic.

@OPNetworkLOL

This comment was marked as off-topic.

@OOPSgary
Copy link
Contributor

OOPSgary commented Jun 3, 2023

所说的损失只是因Name String长度增加导致的包大了几到几十个字节 不会产生较高的影响的

@XiChenBaBa
Copy link

会导致效率缺失,如果你没有修改的水平,修改可能导致无法使用

效率缺失? 对此持有怀疑态度改两三行的事情 源代码:https://github.com/layou233/ZBProxy/blob/master/service/minecraft/motd.go#LL40C3-L40C3

将此处修改成 Name: "你想要的内容", Protocol: 1,

保存 编译 即可

他说的不是player-sample-count吗

@OOPSgary
Copy link
Contributor

OOPSgary commented Jun 3, 2023

请Lau尽快添加Sample和VersionDescribe支持

@XiChenBaBa
Copy link

你得在motdObject里面自己写

@LiteQwQ
Copy link

LiteQwQ commented Jun 4, 2023

在motd.go里面删除被注释的Sample部分,具体可看wiki.vg

@layou233
Copy link
Owner

layou233 commented Jun 4, 2023

先在 5a61cb0 中简单支持了,后面再优化。

大概是下面这样,在 OnlineCount 下面加了一个名为 Sample 的键值对类型, key 是一个 UUID 字符串, value 是一个 IGN (用作自定义文字)。

"OnlineCount": {
    "Max": 114514,
    "Online": -1,
    "EnableMaxLimit": false,
    "Sample": {
        "uuid": "name",
        "uuid2": "name2"
    }
},

@XueSonga
Copy link
Author

XueSonga commented Jun 4, 2023

先在 5a61cb0 中简单支持了,后面再优化。

大概是下面这样,在 OnlineCount 下面加了一个名为 Sample 的键值对类型, key 是一个 UUID 字符串, value 是一个 IGN (用作自定义文字)。

"OnlineCount": {
    "Max": 114514,
    "Online": -1,
    "EnableMaxLimit": false,
    "Sample": {
        "uuid": "name",
        "uuid2": "name2"
    }
},

太棒了

@XueSonga
Copy link
Author

XueSonga commented Jun 4, 2023

先在 5a61cb0 中简单支持了,后面再优化。

大概是下面这样,在 OnlineCount 下面加了一个名为 Sample 的键值对类型, key 是一个 UUID 字符串, value 是一个 IGN (用作自定义文字)。

"OnlineCount": {
    "Max": 114514,
    "Online": -1,
    "EnableMaxLimit": false,
    "Sample": {
        "uuid": "name",
        "uuid2": "name2"
    }
},

具体怎么使用呢?O.o

@OOPSgary
Copy link
Contributor

OOPSgary commented Jun 4, 2023

先别用 等更新

@XueSonga
Copy link
Author

XueSonga commented Jun 4, 2023

先别用 等更新

好的好的awa

@layou233
Copy link
Owner

layou233 commented Jun 4, 2023

@CryptEvc

具体怎么使用呢?O.o

从 action 下载最新的 build ,然后把 OnlineCount 改成楼上我发的那样, UUID 应该是任意的 UUID v4 字符串(可以网上生成), name 是自定义的文本。 OnlineCount 中的其它项可以自由更改不受影响。

测试中,有问题请先提出。最近比较忙,慢慢跟进。

@XueSonga
Copy link
Author

XueSonga commented Jun 4, 2023

@CryptEvc

具体怎么使用呢?O.o

从 action 下载最新的 build ,然后把 OnlineCount 改成楼上我发的那样, UUID 应该是任意的 UUID v4 字符串(可以网上生成), name 是自定义的文本。 OnlineCount 中的其它项可以自由更改不受影响。

测试中,有问题请先提出。最近比较忙,慢慢跟进。

有两个问题

  • 第一个是服务运行中更新配置时的问题
  1. 直接看
    [配置文件]
    "085c8f31-8479-b1fd-a91c-f776c35ce022": "§c§lAAAAAAAA",
    "9f3696f2-f8f6-b3af-998c-d50aeb0e0fd7": "§c§lBBBBBBBB"
  2. 替换uuid,保持内容不变,直接保存
    "2b46ea4d-9e3c-51cf-ae16-f50785a5093d": "§c§lAAAAAAAA",
    "26277594-c849-43f5-9d02-08de7ed4893b": "§c§lBBBBBBBB"
  3. 只能通过重启服务来刷新
  • 第二个 在有些时候文本顺序不一定是由配置文件决定的
    [配置文件]
    "2423d549-2cd2-e21b-860e-afc8692ebcc8": "§c§lAAAAAAAAAA",
    "2793a413-ff0f-340b-a5b2-7d2e62024b55": "§c§lBBBBBB",
    "a031d919-7f8e-c25d-b65e-789599904bb9": "§c§lCCCCCCCC",
    "ef10126f-c48b-8ea7-bd61-9f88f7ec5d94": "§c§lDDD",

    这种情况通常在服务运行中更新配置文件时会引起(更新文件后刷新服务器列表)

@layou233
Copy link
Owner

layou233 commented Jun 5, 2023

@CryptEvc 更新了,再测再报(

@XueSonga
Copy link
Author

XueSonga commented Jun 5, 2023

@CryptEvc 更新了,再测再报(

最新的f65677d编译后测试
1.修改sample后保存
2.刷新服务器列表
3.客户端显示的sample内容没变

@XueSonga
Copy link
Author

XueSonga commented Jun 5, 2023

希望sample能实时更新内容(

@layou233
Copy link
Owner

layou233 commented Jun 6, 2023

@CryptEvc 再更了,重构了配置重载,现在应该可以重载整个配置了(包括 Services)。

@layou233
Copy link
Owner

layou233 commented Jun 6, 2023

另外支持了一种新的格式,下面的配置与楼上等效:

"OnlineCount": {
    "Max": 114514,
    "Online": -1,
    "EnableMaxLimit": false,
    "Sample": [
        "name",
        "name2"
    ]
},

和楼上的相比,用字符串数组替代了键值对,省去了手动输入 UUID。此时 IGN 对应的 UUID 是每次加载配置时统一随机生成的。不过新的配置也有待测试。

楼上的配置依然可用,可以用于需要手动指定 UUID 的场景。

@XueSonga
Copy link
Author

XueSonga commented Jun 6, 2023

这下完美了(我可以通过编写服务器插件,让插件来更改配置文件的内容,就可以实时显示自己服务器的在线玩家了),可能部分人有显示加速线路在线玩家的需求(但这个没必要且不重要)。那么最初提到的玩家人数被改成文字是怎么实现的呢,总感觉不可能🤔

@BiliZheXue
Copy link

@CryptEvc 这个应该也可以通过修改onlinecounter解决
我见过类似的服务器插件

@OOPSgary
Copy link
Contributor

OOPSgary commented Jun 6, 2023

@BiliZheXue 最好的方法是试一试

@layou233
Copy link
Owner

layou233 commented Jun 6, 2023

应该不是玩家人数改的。我看图猜测是通过返回一个不同的版本号,此时信号📶图标就会打叉,然后在信号左侧显示一个提示的版本号(可以试着在1.8.9里添加一个非1.8.9的服务器)。然后通过修改提示的版本名这一项来做到的。

没抓过他们的包,我感觉脑洞挺大的。

@OOPSgary
Copy link
Contributor

OOPSgary commented Jun 6, 2023

@layou233 额 那就是version describe
正常来说解json类型是固定的

@XueSonga
Copy link
Author

XueSonga commented Jun 6, 2023

应该不是玩家人数改的。我看图猜测是通过返回一个不同的版本号,此时信号📶图标就会打叉,然后在信号左侧显示一个提示的版本号(可以试着在1.8.9里添加一个非1.8.9的服务器)。然后通过修改提示的版本名这一项来做到的。

没抓过他们的包,我感觉脑洞挺大的。

厉害,这是怎么想到的?这句话点醒我了

@layou233
Copy link
Owner

layou233 commented Jun 6, 2023

能显示在那一行的文字只有这一个。然后中间填一大堆空格来卡位置..

目前 ZBProxy 是原路返回一个与客户端相同的版本号,所以客户端会认为与服务端版本一致,不会显示这个文字。这个功能我再想想吧,感觉这些做法不够优雅,也不一定适配所有的字体和客户端。

@OOPSgary
Copy link
Contributor

OOPSgary commented Jun 6, 2023

@CryptEvc 别加了 要加自己加 太臃肿了

@XueSonga
Copy link
Author

XueSonga commented Jun 6, 2023

@CryptEvc 别加了 要加自己加 太臃肿了

emm🤔确实,但可以加开关, 再说了都什么年代了,节约的这点点性能和带宽流量真的有必要吗?你不觉得这很酷吗?

@layou233
Copy link
Owner

layou233 commented Jun 6, 2023

@CryptEvc 需要再更新一下,修复了一个重载导致死循环的 bug

@XueSonga
Copy link
Author

XueSonga commented Jun 6, 2023

搞了个临时的版本可以看看 hypixel.codpixel.fun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants