From 7d11147836cfeaae7d4c41c8ac7a7170aa7c31bc Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 20 Aug 2016 21:40:47 +1000 Subject: [PATCH] Add Lazzy "Offline -> Offline Lowercase" conversion --- .../plot/util/UUIDHandlerImplementation.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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 215eaf37c..e2f6a047e 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java @@ -134,6 +134,26 @@ public abstract class UUIDHandlerImplementation { } } }); + } else if (Settings.UUID.FORCE_LOWERCASE && !this.unknown.isEmpty() && !name.value.equals(name.value.toLowerCase())) { + TaskManager.runTaskAsync(new Runnable() { + @Override + public void run() { + UUID offlineUpper = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8)); + if (UUIDHandlerImplementation.this.unknown.contains(offlineUpper) && offlineUpper != null && !offlineUpper.equals(uuid)) { + UUIDHandlerImplementation.this.unknown.remove(offlineUpper); + Set plots = PS.get().getPlotsAbs(offlineUpper); + if (!plots.isEmpty()) { + for (Plot plot : plots) { + plot.owner = uuid; + } + DBFunc.replaceUUID(offlineUpper, uuid); + PS.debug("&cDetected invalid UUID stored for: " + name.value); + PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?"); + PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database."); + } + } + } + }); } try { UUID offline = this.uuidMap.put(name, uuid);