/f show|who command will no longer reveal players as online if they are hidden from the viewer by the Vanish API

This commit is contained in:
Brettflan 2012-04-26 08:08:10 -05:00
parent dd0789cda1
commit 66a7685bf7
2 changed files with 11 additions and 4 deletions

View File

@ -128,7 +128,7 @@ public class CmdShow extends FCommand
for (FPlayer follower : admins) for (FPlayer follower : admins)
{ {
listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", "; listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", ";
if (follower.isOnline()) if (follower.isOnlineAndVisibleTo(me))
{ {
onlineList += listpart; onlineList += listpart;
} }
@ -141,7 +141,7 @@ public class CmdShow extends FCommand
{ {
listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", "; listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", ";
if if
(follower.isOnline()) (follower.isOnlineAndVisibleTo(me))
{ {
onlineList += listpart; onlineList += listpart;
} else { } else {
@ -150,7 +150,7 @@ public class CmdShow extends FCommand
} }
for (FPlayer follower : normals) { for (FPlayer follower : normals) {
listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", "; listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", ";
if (follower.isOnline()) { if (follower.isOnlineAndVisibleTo(me)) {
onlineList += listpart; onlineList += listpart;
} else { } else {
offlineList += listpart; offlineList += listpart;

View File

@ -17,6 +17,13 @@ public class PlayerEntity extends Entity
return this.getPlayer() != null; return this.getPlayer() != null;
} }
// make sure target player should be able to detect that this player is online
public boolean isOnlineAndVisibleTo(Player player)
{
Player target = this.getPlayer();
return target != null && player.canSee(target);
}
public boolean isOffline() public boolean isOffline()
{ {
return ! isOnline(); return ! isOnline();