mirror of
https://github.com/RayzsYT/ProAntiTab.git
synced 2026-12-03 05:49:42 -05:00
Initialize Server Variable
This commit is contained in:
1 parent
7abb7fdd3e
commit
ee7aafe3d3
1 file changed
+7
-2
@@ -9,12 +9,17 @@ import de.rayzs.pat.utils.Storage;
|
||||
|
||||
public class VelocityPingListener {
|
||||
|
||||
private static ProxyServer server;
|
||||
|
||||
public VelocityPingListener(ProxyServer server) {
|
||||
VelocityPingListener.server = server;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onProxyPing(ProxyPingEvent event) {
|
||||
if(!Storage.USE_CUSTOM_PROTOCOL_PING) return;
|
||||
|
||||
ProxyServer proxyServer = VelocityLoader.getServer();
|
||||
int online = proxyServer.getPlayerCount(), max = proxyServer.getConfiguration().getShowMaxPlayers();
|
||||
int online = server.getPlayerCount(), max = server.getConfiguration().getShowMaxPlayers();
|
||||
ServerPing oldServerPing = event.getPing(), newServerPing;
|
||||
ServerPing.Version newVersion = new ServerPing.Version(!Storage.USE_ALWAYS_SHOW_CUSTOM_PROTOCOL_PING ? oldServerPing.getVersion().getProtocol() : -1, Storage.CUSTOM_PROTOCOL_PING.replace("%online%", String.valueOf(online)).replace("%max%", String.valueOf(max)));
|
||||
newServerPing = oldServerPing.asBuilder().version(newVersion).build();
|
||||
|
||||
Reference in new issue
Block a user