From 5ddefcea22bcb8f43f5c4374f74877062d221143 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 4 Jan 2018 19:24:00 +1100 Subject: [PATCH] when PlayerQuitEvent is never called --- .../intellectualcrafters/plot/util/UUIDHandler.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 5fe863620..82d076f62 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java @@ -115,14 +115,23 @@ public class UUIDHandler { if (implementation == null) { return null; } - return implementation.getPlayer(uuid); + return check(implementation.getPlayer(uuid)); } public static PlotPlayer getPlayer(String name) { if (implementation == null) { return null; } - return implementation.getPlayer(name); + return check(implementation.getPlayer(name)); + } + + private static PlotPlayer check(PlotPlayer plr) { + if (plr != null && !plr.isOnline()) { + UUIDHandler.getPlayers().remove(plr.getName()); + PS.get().IMP.unregister(plr); + plr = null; + } + return plr; } public static UUID getUUIDFromString(String nameOrUUIDString) {