Add Lazzy "Offline -> Offline Lowercase" conversion

This commit is contained in:
Jesse Boyd 2016-08-20 21:40:47 +10:00
parent 74a6df1fa7
commit 7d11147836

View File

@ -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<Plot> 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 { try {
UUID offline = this.uuidMap.put(name, uuid); UUID offline = this.uuidMap.put(name, uuid);