2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-22 20:28:00 +00:00

Fix count updates...

This commit is contained in:
Tux 2013-10-31 19:07:37 -04:00
parent 73af35aeee
commit 4359b251b9

View File

@ -59,7 +59,6 @@ public class RedisBungee extends Plugin implements Listener {
int c = 0;
try {
c = plugin.getProxy().getOnlineCount();
rsc.set("server:" + plugin.getServerId() + ":playerCount", String.valueOf(c));
for (String i : plugin.getServers()) {
if (i.equals(plugin.getServerId())) continue;
if (rsc.exists("server:" + i + ":playerCount"))
@ -167,6 +166,17 @@ public class RedisBungee extends Plugin implements Listener {
} finally {
pool.returnResource(tmpRsc);
}
getProxy().getScheduler().schedule(this, new Runnable() {
@Override
public void run() {
Jedis rsc = pool.getResource();
try {
rsc.set("server:" + plugin.getServerId() + ":playerCount", String.valueOf(getProxy().getOnlineCount()));
} finally {
pool.returnResource(rsc);
}
}
}, 1, 3, TimeUnit.SECONDS);
getProxy().getPluginManager().registerCommand(this, new Command("glist", "bungeecord.command.glist", "redisbungee") {
@Override
public void execute(CommandSender sender, String[] args) {