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

Handle shutdown more gracefully.

This commit is contained in:
Tux 2013-10-18 17:14:58 -04:00
parent 49c8b83e52
commit 8da933a585

View File

@ -196,6 +196,17 @@ public class RedisBungee extends Plugin implements Listener {
@Override @Override
public void onDisable() { public void onDisable() {
uct.kill(); uct.kill();
if (pool != null) {
Jedis tmpRsc = pool.getResource();
try {
tmpRsc.set("server:" + serverId + ":playerCount", "0"); // reset
for (String i : tmpRsc.smembers("server:" + serverId + ":usersOnline")) {
tmpRsc.srem("server:" + serverId + ":usersOnline", i);
}
} finally {
pool.returnResource(tmpRsc);
}
}
pool.destroy(); pool.destroy();
} }