2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-14 16:58:03 +00:00

Slightly optimized cleanUpPlayer()

This commit is contained in:
Tux 2015-11-15 12:21:28 -05:00
parent 6ed8a0df93
commit 51c769fd79

View File

@ -37,12 +37,9 @@ public class RedisUtil {
} }
} }
// Compatibility restraints prevent me from using using HDEL with multiple keys.
public static void cleanUpPlayer(String player, Jedis rsc) { public static void cleanUpPlayer(String player, Jedis rsc) {
rsc.srem("proxy:" + RedisBungee.getApi().getServerId() + ":usersOnline", player); rsc.srem("proxy:" + RedisBungee.getApi().getServerId() + ":usersOnline", player);
rsc.hdel("player:" + player, "server"); rsc.hdel("player:" + player, "server", "ip", "proxy");
rsc.hdel("player:" + player, "ip");
rsc.hdel("player:" + player, "proxy");
long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
rsc.hset("player:" + player, "online", String.valueOf(timestamp)); rsc.hset("player:" + player, "online", String.valueOf(timestamp));
rsc.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>( rsc.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>(
@ -52,9 +49,7 @@ public class RedisUtil {
public static void cleanUpPlayer(String player, Pipeline rsc) { public static void cleanUpPlayer(String player, Pipeline rsc) {
rsc.srem("proxy:" + RedisBungee.getApi().getServerId() + ":usersOnline", player); rsc.srem("proxy:" + RedisBungee.getApi().getServerId() + ":usersOnline", player);
rsc.hdel("player:" + player, "server"); rsc.hdel("player:" + player, "server", "ip", "proxy");
rsc.hdel("player:" + player, "ip");
rsc.hdel("player:" + player, "proxy");
long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
rsc.hset("player:" + player, "online", String.valueOf(timestamp)); rsc.hset("player:" + player, "online", String.valueOf(timestamp));
rsc.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>( rsc.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>(