From d70f7a8ec0a17adb0e18db17c16041ad824f4ee3 Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 23 Nov 2017 15:59:52 -0500 Subject: [PATCH] Use IncognitoStatusChangeEvent for vanish fixes in BLD --- .../game/arcade/game/games/build/Build.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index 014805aa7..e536a6907 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -11,7 +11,7 @@ import java.util.UUID; import mineplex.core.account.permissions.Permission; import mineplex.core.account.permissions.PermissionGroup; -import org.bukkit.Bukkit; +import mineplex.core.incognito.events.IncognitoStatusChangeEvent; import org.bukkit.ChatColor; import org.bukkit.Effect; import org.bukkit.GameMode; @@ -537,7 +537,7 @@ public class Build extends Game //Get Next View Data for (BuildData data : _data.values()) { - if (!data.Judged && !Manager.isVanished(data.Player)) + if (!data.Judged) { _viewData = data; break; @@ -615,10 +615,6 @@ public class Build extends Game for (Player player : _data.keySet()) { - if (Manager.isVanished(player)) { - continue; - } - double points = _data.get(player).getPoints(); if (bestPlayer == null || points > bestPoints) @@ -1669,6 +1665,23 @@ public class Build extends Game return GetTeamList().get(0).GetSpawn(); } + @EventHandler + public void onVanishEnable(IncognitoStatusChangeEvent event) { + // If user is leaving vanish, ignore it + if (!event.getNewState()) + { + return; + } + + // If they're not in the data map, don't bother + if (!_data.containsKey(event.getPlayer())) + { + return; + } + + _data.remove(event.getPlayer()); + } + @Override public List getWinners() {