From c23086259dbb800f8cfb6bd8a1c76762e33e3418 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 12 Nov 2019 20:48:33 +0000 Subject: [PATCH] Potentially fixes rename issues #2450 --- .../plot/util/UUIDHandlerImplementation.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java index b5e37ed93..57b70d263 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java @@ -161,19 +161,19 @@ public abstract class UUIDHandlerImplementation { }); } try { - UUID offline = this.uuidMap.put(name, uuid); - if (offline != null) { - if (!offline.equals(uuid)) { - Set plots = PlotSquared.get().getPlots(offline); + UUID existing = this.uuidMap.put(name, uuid); + if (existing != null) { + if (!existing.equals(uuid)) { + Set plots = PlotSquared.get().getPlots(existing); if (!plots.isEmpty()) { for (Plot plot : plots) { plot.owner = uuid; } - replace(offline, uuid, name.value); + replace(existing, uuid, name.value); } return true; } else { - StringWrapper oName = this.uuidMap.inverse().get(offline); + StringWrapper oName = this.uuidMap.inverse().get(existing); if (!oName.equals(name)) { this.uuidMap.remove(name); this.uuidMap.put(name, uuid); @@ -191,6 +191,13 @@ public abstract class UUIDHandlerImplementation { PlotPlayer player = getPlayer(uuid); if (player == null || player.getName().equalsIgnoreCase(name.value)) { rename(uuid, name); + return false; + } + StringWrapper newName = new StringWrapper(player.getName()); + UUID newUUID = player.getUUID(); + if (newUUID.equals(uuid) && !newName.equals(oldName)) { + inverse.remove(uuid); + this.uuidMap.put(newName, newUUID); } return false; }