mirror of
https://github.com/RayzsYT/ProAntiTab.git
synced 2026-12-03 05:49:42 -05:00
Add Extend-Online-Count
This commit is contained in:
1 parent
8565e24b33
commit
3ff9cf5fac
4 files changed
+15
-8
No files matched your search
@@ -12,8 +12,10 @@ public class PaperServerListPing implements Listener {
|
||||
if(!Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.ENABLED) return;
|
||||
if(Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.ALWAYS_SHOW) event.setProtocolVersion(0);
|
||||
|
||||
int online = Bukkit.getOnlinePlayers().size(), max = Bukkit.getMaxPlayers();
|
||||
String versionName = Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.PROTOCOL.replace("%online%", String.valueOf(online)).replace("%max%", String.valueOf(max));
|
||||
int online = Bukkit.getOnlinePlayers().size(),
|
||||
onlineExtend = online + Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.EXTEND_COUNT,
|
||||
max = Bukkit.getMaxPlayers();
|
||||
String versionName = Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.PROTOCOL.replace("%online_extended%", String.valueOf(onlineExtend)).replace("%online%", String.valueOf(online)).replace("%max%", String.valueOf(max));
|
||||
event.setHidePlayers(Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.HIDE_PLAYERS);
|
||||
event.setVersion(versionName);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,11 @@ public class BungeePingListener implements Listener {
|
||||
if(!Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.ENABLED) return;
|
||||
|
||||
ProxyServer proxyServer = BungeeLoader.getPlugin().getProxy();
|
||||
int online = proxyServer.getOnlineCount(), max = proxyServer.getConfigurationAdapter().getListeners().iterator().next().getMaxPlayers();
|
||||
int online = proxyServer.getOnlineCount(),
|
||||
onlineExtend = online + Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.EXTEND_COUNT,
|
||||
max = proxyServer.getConfigurationAdapter().getListeners().iterator().next().getMaxPlayers();
|
||||
ServerPing serverPing = event.getResponse();
|
||||
ServerPing.Protocol newProtocol = new ServerPing.Protocol(Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.PROTOCOL.replace("%online%", String.valueOf(online)).replace("%max%", String.valueOf(max)), !Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.ALWAYS_SHOW ? serverPing.getVersion().getProtocol() : 0);
|
||||
ServerPing.Protocol newProtocol = new ServerPing.Protocol(Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.PROTOCOL.replace("%online_extended%", String.valueOf(onlineExtend)).replace("%online%", String.valueOf(online)).replace("%max%", String.valueOf(max)), !Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.ALWAYS_SHOW ? serverPing.getVersion().getProtocol() : 0);
|
||||
serverPing.setVersion(newProtocol);
|
||||
|
||||
event.setResponse(serverPing);
|
||||
|
||||
@@ -18,9 +18,11 @@ public class VelocityPingListener {
|
||||
public void onProxyPing(ProxyPingEvent event) {
|
||||
if(!Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.ENABLED) return;
|
||||
|
||||
int online = server.getPlayerCount(), max = server.getConfiguration().getShowMaxPlayers();
|
||||
int online = server.getPlayerCount(),
|
||||
onlineExtend = online + Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.EXTEND_COUNT,
|
||||
max = server.getConfiguration().getShowMaxPlayers();
|
||||
ServerPing oldServerPing = event.getPing(), newServerPing;
|
||||
ServerPing.Version newVersion = new ServerPing.Version(!Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.ALWAYS_SHOW ? oldServerPing.getVersion().getProtocol() : -1, Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.PROTOCOL.replace("%online%", String.valueOf(online)).replace("%max%", String.valueOf(max)));
|
||||
ServerPing.Version newVersion = new ServerPing.Version(!Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.ALWAYS_SHOW ? oldServerPing.getVersion().getProtocol() : -1, Storage.ConfigSections.Settings.CUSTOM_PROTOCOL_PING.PROTOCOL.replace("%online_extended%", String.valueOf(onlineExtend)).replace("%online%", String.valueOf(online)).replace("%max%", String.valueOf(max)));
|
||||
newServerPing = oldServerPing.asBuilder().version(newVersion).build();
|
||||
|
||||
event.setPing(newServerPing);
|
||||
|
||||
Reference in new issue
Block a user