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