Hide players from staff if the staff are also at the spawn point

This commit is contained in:
Dan Mulloy 2017-07-17 15:55:59 -04:00 committed by cnr
parent 2c997935c9
commit fb28a953e6

View File

@ -34,14 +34,12 @@ public class HubVisibilityManager extends MiniPlugin
public HubVisibilityManager(HubManager manager) public HubVisibilityManager(HubManager manager)
{ {
super("Visibility Manager", manager.getPlugin()); super("Visibility Manager", manager.getPlugin());
Manager = manager; Manager = manager;
} }
public void addHiddenPlayer(Player player) public void addHiddenPlayer(Player player)
{ {
_hiddenPlayers.add(player); _hiddenPlayers.add(player);
} }
public void removeHiddenPlayer(Player player) public void removeHiddenPlayer(Player player)
@ -64,9 +62,10 @@ public class HubVisibilityManager extends MiniPlugin
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
Rank rank = Manager.GetClients().Get(player).GetRank(); Rank rank = Manager.GetClients().Get(player).GetRank();
boolean hideMe = UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 || boolean hideMe = UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0
(Manager.getPreferences().get(player).isActive(Preference.INVISIBILITY) && (rank.has(Rank.MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH)) || || (Manager.getPreferences().get(player).isActive(Preference.INVISIBILITY) &&
_hiddenPlayers.contains(player); (rank.has(Rank.MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH))
|| _hiddenPlayers.contains(player);
for (Player other : UtilServer.getPlayers()) for (Player other : UtilServer.getPlayers())
{ {
@ -75,13 +74,12 @@ public class HubVisibilityManager extends MiniPlugin
continue; continue;
if (Manager.GetClients().Get(other).GetRank().has(Rank.MODERATOR)) if (Manager.GetClients().Get(other).GetRank().has(Rank.MODERATOR))
localHideMe = false; localHideMe = UtilMath.offset2d(other.getLocation(), Manager.GetSpawn()) == 0;
if (localHideMe || !Manager.getPreferences().get(other).isActive(Preference.SHOW_PLAYERS)) if (localHideMe || !Manager.getPreferences().get(other).isActive(Preference.SHOW_PLAYERS))
{ {
VisibilityManager.Instance.setVisibility(player, false, other); VisibilityManager.Instance.setVisibility(player, false, other);
} } else
else
{ {
VisibilityManager.Instance.setVisibility(player, true, other); VisibilityManager.Instance.setVisibility(player, true, other);
} }
@ -128,10 +126,9 @@ public class HubVisibilityManager extends MiniPlugin
for (Player player : _particle.keySet()) for (Player player : _particle.keySet())
{ {
UtilParticle.PlayParticle(ParticleType.values()[_particle.get(player)],
UtilParticle.PlayParticle(ParticleType.values()[_particle.get(player)], player.getLocation().add(1, 1, 0), 0f, 0f, 0f, 0, 1, player.getLocation().add(1, 1, 0), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers()); ViewDist.NORMAL, UtilServer.getPlayers());
} }
} }
} }