From 51c769fd79ea3c7ae89d04a671051d3c34680d1f Mon Sep 17 00:00:00 2001 From: Tux Date: Sun, 15 Nov 2015 12:21:28 -0500 Subject: [PATCH] Slightly optimized cleanUpPlayer() --- .../imaginarycode/minecraft/redisbungee/RedisUtil.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisUtil.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisUtil.java index c867a24..b85b747 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisUtil.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisUtil.java @@ -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) { rsc.srem("proxy:" + RedisBungee.getApi().getServerId() + ":usersOnline", player); - rsc.hdel("player:" + player, "server"); - rsc.hdel("player:" + player, "ip"); - rsc.hdel("player:" + player, "proxy"); + rsc.hdel("player:" + player, "server", "ip", "proxy"); long timestamp = System.currentTimeMillis(); rsc.hset("player:" + player, "online", String.valueOf(timestamp)); 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) { rsc.srem("proxy:" + RedisBungee.getApi().getServerId() + ":usersOnline", player); - rsc.hdel("player:" + player, "server"); - rsc.hdel("player:" + player, "ip"); - rsc.hdel("player:" + player, "proxy"); + rsc.hdel("player:" + player, "server", "ip", "proxy"); long timestamp = System.currentTimeMillis(); rsc.hset("player:" + player, "online", String.valueOf(timestamp)); rsc.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>(