Use IncognitoStatusChangeEvent for vanish fixes in BLD

This commit is contained in:
Spencer 2017-11-23 15:59:52 -05:00 committed by Alexander Meech
parent 449c6511e2
commit d70f7a8ec0

View File

@ -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<Player> getWinners()
{