From 83f1d3c90395554be1cdafc40937e2f0e3a5b008 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Sat, 9 Jan 2016 17:12:44 +0100 Subject: [PATCH] Improve PlayerState stability. --- .../engine/EngineMassiveCorePlayerState.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/com/massivecraft/massivecore/engine/EngineMassiveCorePlayerState.java b/src/com/massivecraft/massivecore/engine/EngineMassiveCorePlayerState.java index b9b45e51..f2207e4e 100644 --- a/src/com/massivecraft/massivecore/engine/EngineMassiveCorePlayerState.java +++ b/src/com/massivecraft/massivecore/engine/EngineMassiveCorePlayerState.java @@ -81,6 +81,16 @@ public class EngineMassiveCorePlayerState extends EngineAbstract this.idToState.put(id, PlayerState.LOGASYNC); } + @EventHandler(priority = EventPriority.MONITOR) + public void logasyncMonitor(AsyncPlayerPreLoginEvent event) + { + if (event.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) return; + + final UUID id = event.getUniqueId(); + + this.idToState.remove(id); + } + // -------------------------------------------- // // LOGSYNC // -------------------------------------------- // @@ -95,6 +105,18 @@ public class EngineMassiveCorePlayerState extends EngineAbstract this.idToState.put(id, PlayerState.LOGSYNC); } + @EventHandler(priority = EventPriority.MONITOR) + public void logsyncMonitor(PlayerLoginEvent event) + { + if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) return; + + final Player player = event.getPlayer(); + if (MUtil.isntPlayer(player)) return; + final UUID id = player.getUniqueId(); + + this.idToState.remove(id); + } + // -------------------------------------------- // // JOINING // -------------------------------------------- //