diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java index 07973e585..e9733c952 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -168,20 +168,23 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } else { NbtFactory.NbtCompound bukkit = (NbtFactory.NbtCompound) compound.get("bukkit"); String name = (String) bukkit.get("lastKnownName"); - long last = (long) bukkit.get("lastPlayed"); - if (Settings.UUID.OFFLINE) { - if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase().equals(name)) { - uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name); - } else { - long most = (long) compound.get("UUIDMost"); - long least = (long) compound.get("UUIDLeast"); - uuid = new UUID(most, least); + StringWrapper wrap = new StringWrapper(name); + if (!toAdd.containsKey(wrap)) { + long last = (long) bukkit.get("lastPlayed"); + if (Settings.UUID.OFFLINE) { + if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase().equals(name)) { + uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name); + } else { + long most = (long) compound.get("UUIDMost"); + long least = (long) compound.get("UUIDLeast"); + uuid = new UUID(most, least); + } } + if (ExpireManager.IMP != null) { + ExpireManager.IMP.storeDate(uuid, last); + } + toAdd.put(wrap, uuid); } - if (ExpireManager.IMP != null) { - ExpireManager.IMP.storeDate(uuid, last); - } - toAdd.put(new StringWrapper(name), uuid); } } catch (Exception ignored) { PS.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat"); @@ -199,10 +202,12 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { if (last != 0) { String name = op.getName(); StringWrapper wrap = new StringWrapper(name); - UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(op); - toAdd.put(wrap, uuid); - if (ExpireManager.IMP != null) { - ExpireManager.IMP.storeDate(uuid, last); + if (!toAdd.containsKey(wrap)) { + UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(op); + toAdd.put(wrap, uuid); + if (ExpireManager.IMP != null) { + ExpireManager.IMP.storeDate(uuid, last); + } } } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index 00c70d52d..575959576 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -370,13 +370,16 @@ public class PS { @Override public void run() { UUIDHandler.add(new StringWrapper("*"), DBFunc.everyone); - for (Plot plot : getPlots()) { - if (plot.hasOwner() && plot.temp != -1) { - if (UUIDHandler.getName(plot.owner) == null) { - UUIDHandler.implementation.unknown.add(plot.owner); + foreachPlotRaw(new RunnableVal() { + @Override + public void run(Plot plot) { + if (plot.hasOwner() && plot.temp != -1) { + if (UUIDHandler.getName(plot.owner) == null) { + UUIDHandler.implementation.unknown.add(plot.owner); + } } } - } + }); startExpiryTasks(); startPlotMeConversion(); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java b/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java index 0a23aa828..89e7edde3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java @@ -59,15 +59,18 @@ public class UUIDHandler { } public static HashSet getAllUUIDS() { - HashSet uuids = new HashSet<>(); - for (Plot plot : PS.get().getPlots()) { - if (plot.hasOwner()) { - uuids.add(plot.owner); - uuids.addAll(plot.getTrusted()); - uuids.addAll(plot.getMembers()); - uuids.addAll(plot.getDenied()); + final HashSet uuids = new HashSet<>(); + PS.get().foreachPlotRaw(new RunnableVal() { + @Override + public void run(Plot plot) { + if (plot.hasOwner()) { + uuids.add(plot.owner); + uuids.addAll(plot.getTrusted()); + uuids.addAll(plot.getMembers()); + uuids.addAll(plot.getDenied()); + } } - } + }); return uuids; }