mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-23 04:28:01 +00:00
Fix count updates...
This commit is contained in:
parent
73af35aeee
commit
4359b251b9
@ -59,7 +59,6 @@ public class RedisBungee extends Plugin implements Listener {
|
|||||||
int c = 0;
|
int c = 0;
|
||||||
try {
|
try {
|
||||||
c = plugin.getProxy().getOnlineCount();
|
c = plugin.getProxy().getOnlineCount();
|
||||||
rsc.set("server:" + plugin.getServerId() + ":playerCount", String.valueOf(c));
|
|
||||||
for (String i : plugin.getServers()) {
|
for (String i : plugin.getServers()) {
|
||||||
if (i.equals(plugin.getServerId())) continue;
|
if (i.equals(plugin.getServerId())) continue;
|
||||||
if (rsc.exists("server:" + i + ":playerCount"))
|
if (rsc.exists("server:" + i + ":playerCount"))
|
||||||
@ -167,6 +166,17 @@ public class RedisBungee extends Plugin implements Listener {
|
|||||||
} finally {
|
} finally {
|
||||||
pool.returnResource(tmpRsc);
|
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") {
|
getProxy().getPluginManager().registerCommand(this, new Command("glist", "bungeecord.command.glist", "redisbungee") {
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
Loading…
Reference in New Issue
Block a user