mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2025-04-20 17:47:06 +00:00
Don't create an entirely new ServerPing object.
This commit is contained in:
parent
1ee67a0587
commit
7ee37ae4cb
@ -159,25 +159,13 @@ public class RedisBungeeListener implements Listener {
|
|||||||
plugin.getProxy().getScheduler().runAsync(plugin, new Runnable() {
|
plugin.getProxy().getScheduler().runAsync(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ServerPing old = event.getResponse();
|
event.getResponse().getPlayers().setOnline(plugin.getCount());
|
||||||
ServerPing reply = new ServerPing();
|
|
||||||
reply.setPlayers(new ServerPing.Players(old.getPlayers().getMax(), plugin.getCount(), old.getPlayers().getSample()));
|
|
||||||
reply.setDescription(old.getDescription());
|
|
||||||
reply.setFavicon(old.getFaviconObject());
|
|
||||||
reply.setVersion(old.getVersion());
|
|
||||||
event.setResponse(reply);
|
|
||||||
event.completeIntent(plugin);
|
event.completeIntent(plugin);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Async ping event will not work as an async-hostile plugin was found, so perform the ping modification synchronously.
|
// Async ping event will not work as an async-hostile plugin was found, so perform the ping modification synchronously.
|
||||||
ServerPing old = event.getResponse();
|
event.getResponse().getPlayers().setOnline(plugin.getCount());
|
||||||
ServerPing reply = new ServerPing();
|
|
||||||
reply.setPlayers(new ServerPing.Players(old.getPlayers().getMax(), plugin.getCount(), old.getPlayers().getSample()));
|
|
||||||
reply.setDescription(old.getDescription());
|
|
||||||
reply.setFavicon(old.getFaviconObject());
|
|
||||||
reply.setVersion(old.getVersion());
|
|
||||||
event.setResponse(reply);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user