visibility fix
This commit is contained in:
parent
0a766cd7bb
commit
f54ed0ece2
@ -11,9 +11,17 @@ import org.bukkit.entity.Player;
|
||||
public class VisibilityData
|
||||
{
|
||||
private NautHashMap<Player, Boolean> _shouldHide = new NautHashMap<Player, Boolean>();
|
||||
private NautHashMap<Player, Boolean> _lastState = new NautHashMap<Player, Boolean>();
|
||||
|
||||
public void updatePlayer(Player player, Player target, boolean hide)
|
||||
{
|
||||
if (_lastState.containsKey(target) && _lastState.get(target) == hide)
|
||||
{
|
||||
//Already this state, do nothing
|
||||
//System.out.println("REPEAT " + player.getName() + " ~ " + target.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
if (attemptToProcess(player, target, hide))
|
||||
{
|
||||
//Clear old
|
||||
@ -35,13 +43,17 @@ public class VisibilityData
|
||||
//it would still send the packet, even if the client thought it was already the state.
|
||||
|
||||
if (hide)
|
||||
((CraftPlayer)player).hidePlayer(target);
|
||||
((CraftPlayer)player).hidePlayer(target, true, true);
|
||||
else
|
||||
((CraftPlayer)player).showPlayer(target);
|
||||
|
||||
_lastState.put(target, hide);
|
||||
|
||||
//System.out.println("TRUE " + player.getName() + " ~ " + target.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
//System.out.println("FALSE " + player.getName() + " ~ " + target.getName());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -55,12 +67,10 @@ public class VisibilityData
|
||||
Player target = targetIter.next();
|
||||
boolean hide = _shouldHide.get(target);
|
||||
|
||||
if (attemptToProcess(player, target, hide))
|
||||
if (!target.isOnline() || !target.isValid() || attemptToProcess(player, target, hide))
|
||||
{
|
||||
targetIter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user