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

Lowercase name -> UUID association

This commit is contained in:
Tux 2014-04-26 22:28:17 -04:00
parent e316e84c2b
commit ace0979201
2 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ public class RedisBungeeConsumer implements Runnable {
jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "online", "0"); jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "online", "0");
jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "ip", event1.getPlayer().getAddress().getAddress().getHostAddress()); jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "ip", event1.getPlayer().getAddress().getAddress().getHostAddress());
jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "name", event1.getPlayer().getName()); jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "name", event1.getPlayer().getName());
jedis.hset("uuids", event1.getPlayer().getName(), event1.getPlayer().getUniqueId().toString()); jedis.hset("uuids", event1.getPlayer().getName().toLowerCase(), event1.getPlayer().getUniqueId().toString());
} else if (event instanceof PlayerLoggedOffConsumerEvent) { } else if (event instanceof PlayerLoggedOffConsumerEvent) {
PlayerLoggedOffConsumerEvent event1 = (PlayerLoggedOffConsumerEvent) event; PlayerLoggedOffConsumerEvent event1 = (PlayerLoggedOffConsumerEvent) event;
jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "online", String.valueOf(System.currentTimeMillis())); jedis.hset("player:" + event1.getPlayer().getUniqueId().toString(), "online", String.valueOf(System.currentTimeMillis()));

View File

@ -44,7 +44,7 @@ public class UUIDTranslator {
// Okay, it wasn't locally cached. Let's try Redis. // Okay, it wasn't locally cached. Let's try Redis.
Jedis jedis = plugin.getPool().getResource(); Jedis jedis = plugin.getPool().getResource();
try { try {
String stored = jedis.hget("uuids", player); String stored = jedis.hget("uuids", player.toLowerCase());
if (stored != null && UUID_PATTERN.matcher(stored).find()) { if (stored != null && UUID_PATTERN.matcher(stored).find()) {
// This is it! // This is it!
uuid = UUID.fromString(stored); uuid = UUID.fromString(stored);
@ -108,7 +108,7 @@ public class UUIDTranslator {
} }
private static void storeInfo(String name, UUID uuid, Jedis jedis) { private static void storeInfo(String name, UUID uuid, Jedis jedis) {
jedis.hset("uuids", name, uuid.toString()); jedis.hset("uuids", name.toLowerCase(), uuid.toString());
jedis.hset("player:" + uuid, "name", name); jedis.hset("player:" + uuid, "name", name);
} }
} }