如题,如何让最大人数随着在线人数变化:最大人数=在线人数+1
好像最大人数限制设置为0就行了
mimimis 发表于 2017-8-12 18:52
好像最大人数限制设置为0就行了
设置成0那别人怎么进来
321933539 发表于 2017-8-14 22:21
设置成0那别人怎么进来
你为什么不试试看设置成0会怎么样呢,想当然?
mimimis 发表于 2017-8-14 22:26
你为什么不试试看设置成0会怎么样呢,想当然?
设置为0果然所有人都进不来了
***888888888
cws_sh 发表于 2017-8-15 20:23
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/server/ServerListPingEvent.html
看不懂 = =
本帖最后由 ddyy163 于 2017-8-21 09:23 编辑
虽然不知道你这样有啥意义,不过我还是解答一下吧。
lss的意思是让你写ServerListPingEvent的监听
在监听中修改Event中的MaxPlayers,代码:【e.setMaxPlayers(e.getNumPlayers()+1)】
就可以达到你的需求
附上一个中文API的网址,可以去这里找server的event来看
https://docs.windit.net/Chinese_BukkitAPI/
321933539 发表于 2017-8-17 15:02
看不懂 = =
虽然不知道你这样有啥意义,不过我还是解答一下吧。
lss的意思是让你写ServerListPingEvent的监听
在监听中修改Event中的MaxPlayers,代码:【e.setMaxPlayers(e.getNumPlayers()+1)】
就可以达到你的需求
附上一个中文API的网址,可以去这里找server的event来看
https://docs.windit.net/Chinese_BukkitAPI/
@EventHandler
public void onPing(ServerListPingEvent e){
e.setMaxPlayers(e.getNumPlayers()+1);
}
public void onPing(ServerListPingEvent e){
e.setMaxPlayers(e.getNumPlayers()+1);
}
MagicLocyDragon 发表于 2017-8-21 17:58
@EventHandler
public void onPing(ServerListPingEvent e){
e.setMaxPlayers(e.getNumPlayers()+1);
需要我自行写个插件吗