From e3a7188b0d46b715f1110c67abce9ad951e974f2 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Thu, 26 Apr 2012 08:08:11 -0500 Subject: [PATCH] /f show|who command will no longer reveal players as online if they are hidden from the viewer by the Vanish API --- src/com/massivecraft/factions/cmd/CmdShow.java | 6 +++--- .../factions/zcore/persist/PlayerEntity.java | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdShow.java b/src/com/massivecraft/factions/cmd/CmdShow.java index 86ffd912..00a6ad78 100644 --- a/src/com/massivecraft/factions/cmd/CmdShow.java +++ b/src/com/massivecraft/factions/cmd/CmdShow.java @@ -113,7 +113,7 @@ public class CmdShow extends FCommand for (FPlayer follower : admins) { - if (follower.isOnline()) + if (follower.isOnlineAndVisibleTo(me)) { memberOnlineNames.add(follower.getNameAndTitle(fme)); } @@ -125,7 +125,7 @@ public class CmdShow extends FCommand for (FPlayer follower : mods) { - if (follower.isOnline()) + if (follower.isOnlineAndVisibleTo(me)) { memberOnlineNames.add(follower.getNameAndTitle(fme)); } @@ -137,7 +137,7 @@ public class CmdShow extends FCommand for (FPlayer follower : normals) { - if (follower.isOnline()) + if (follower.isOnlineAndVisibleTo(me)) { memberOnlineNames.add(follower.getNameAndTitle(fme)); } diff --git a/src/com/massivecraft/factions/zcore/persist/PlayerEntity.java b/src/com/massivecraft/factions/zcore/persist/PlayerEntity.java index f8ccced9..bbe9491f 100644 --- a/src/com/massivecraft/factions/zcore/persist/PlayerEntity.java +++ b/src/com/massivecraft/factions/zcore/persist/PlayerEntity.java @@ -16,7 +16,14 @@ public class PlayerEntity extends Entity { 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() { return ! isOnline();