From 20d7a0eea25686e701ff15da4b11d9a133f6a20c Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 6 Sep 2017 19:49:57 +1000 Subject: [PATCH] Don't overwrite online player names from uuid cache --- .../plot/util/UUIDHandlerImplementation.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java b/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java index 05d32b4f4..ed750bae8 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java @@ -76,11 +76,14 @@ public abstract class UUIDHandlerImplementation { if (uuid == null || name == null) { continue; } - if (this.uuidMap.inverse().containsKey(uuid)) { + StringWrapper oldName = this.uuidMap.inverse().get(uuid); + if (oldName != null) { if (this.uuidMap.containsKey(name)) { continue; } - rename(uuid, name); + if (getPlayer(uuid) == null) { + rename(uuid, name); + } continue; } this.uuidMap.put(name, uuid); @@ -167,7 +170,6 @@ public abstract class UUIDHandlerImplementation { } else { StringWrapper oName = this.uuidMap.inverse().get(offline); if (!oName.equals(name)) { - System.out.println("Remove " + name); this.uuidMap.remove (name); this.uuidMap.put(name, uuid); } @@ -176,11 +178,15 @@ public abstract class UUIDHandlerImplementation { } } catch (Exception ignored) { BiMap inverse = this.uuidMap.inverse(); - if (inverse.containsKey(uuid)) { + StringWrapper oldName = inverse.get(uuid); + if (oldName != null) { if (this.uuidMap.containsKey(name)) { return false; } - rename(uuid, name); + PlotPlayer player = getPlayer(uuid); + if (player == null || player.getName().equalsIgnoreCase(name.value)) { + rename(uuid, name); + } return false; } this.uuidMap.put(name, uuid);