From 9c63adb5f7d70b9fbef62e42f2499f763bbd43b6 Mon Sep 17 00:00:00 2001 From: ItsHarry Date: Tue, 26 Jan 2016 02:51:46 +0100 Subject: [PATCH 1/2] Fix getUUIDFromName() returning null even when player is online. --- .../minecraft/redisbungee/RedisBungeeListener.java | 2 +- .../minecraft/redisbungee/util/UUIDTranslator.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java index b6a292c..015d939 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java @@ -81,7 +81,7 @@ public class RedisBungeeListener implements Listener { } Pipeline pipeline = jedis.pipelined(); - plugin.getUuidTranslator().persistInfo(event.getConnection().getName(), event.getConnection().getUniqueId(), pipeline); + plugin.getUuidTranslator().persistInfo(event.getConnection().getName().toLowerCase(), event.getConnection().getUniqueId(), pipeline); RedisUtil.createPlayer(event.getConnection(), pipeline, false); // We're not publishing, the API says we only publish at PostLoginEvent time. pipeline.sync(); diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java index da244dd..58b266f 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java @@ -101,7 +101,7 @@ public final class UUIDTranslator { } for (Map.Entry entry : uuidMap1.entrySet()) { if (entry.getKey().equalsIgnoreCase(player)) { - persistInfo(entry.getKey(), entry.getValue(), jedis); + persistInfo(entry.getKey().toLowerCase(), entry.getValue(), jedis); return entry.getValue(); } } @@ -161,7 +161,7 @@ public final class UUIDTranslator { } if (name != null) { - persistInfo(name, player, jedis); + persistInfo(name.toLowerCase(), player, jedis); return name; } From 9be4258d123bfef3ee32e3d55b0bcbe5443a9d77 Mon Sep 17 00:00:00 2001 From: ItsHarry Date: Tue, 26 Jan 2016 03:18:35 +0100 Subject: [PATCH 2/2] Fix getNameFromUUID returning names in lowercase --- .../minecraft/redisbungee/RedisBungeeListener.java | 2 +- .../minecraft/redisbungee/util/UUIDTranslator.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java index 015d939..b6a292c 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java @@ -81,7 +81,7 @@ public class RedisBungeeListener implements Listener { } Pipeline pipeline = jedis.pipelined(); - plugin.getUuidTranslator().persistInfo(event.getConnection().getName().toLowerCase(), event.getConnection().getUniqueId(), pipeline); + plugin.getUuidTranslator().persistInfo(event.getConnection().getName(), event.getConnection().getUniqueId(), pipeline); RedisUtil.createPlayer(event.getConnection(), pipeline, false); // We're not publishing, the API says we only publish at PostLoginEvent time. pipeline.sync(); diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java index 58b266f..984c4ef 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java @@ -101,7 +101,7 @@ public final class UUIDTranslator { } for (Map.Entry entry : uuidMap1.entrySet()) { if (entry.getKey().equalsIgnoreCase(player)) { - persistInfo(entry.getKey().toLowerCase(), entry.getValue(), jedis); + persistInfo(entry.getKey(), entry.getValue(), jedis); return entry.getValue(); } } @@ -161,7 +161,7 @@ public final class UUIDTranslator { } if (name != null) { - persistInfo(name.toLowerCase(), player, jedis); + persistInfo(name, player, jedis); return name; } @@ -175,13 +175,13 @@ public final class UUIDTranslator { public final void persistInfo(String name, UUID uuid, Jedis jedis) { addToMaps(name, uuid); String json = RedisBungee.getGson().toJson(uuidToNameMap.get(uuid)); - jedis.hmset("uuid-cache", ImmutableMap.of(name, json, uuid.toString(), json)); + jedis.hmset("uuid-cache", ImmutableMap.of(name.toLowerCase(), json, uuid.toString(), json)); } public final void persistInfo(String name, UUID uuid, Pipeline jedis) { addToMaps(name, uuid); String json = RedisBungee.getGson().toJson(uuidToNameMap.get(uuid)); - jedis.hmset("uuid-cache", ImmutableMap.of(name, json, uuid.toString(), json)); + jedis.hmset("uuid-cache", ImmutableMap.of(name.toLowerCase(), json, uuid.toString(), json)); } @RequiredArgsConstructor