diff --git a/src/main/java/net/kewwbec/social/command/friend/FriendCommand.java b/src/main/java/net/kewwbec/social/command/friend/FriendCommand.java index 6a5421e..937beb2 100644 --- a/src/main/java/net/kewwbec/social/command/friend/FriendCommand.java +++ b/src/main/java/net/kewwbec/social/command/friend/FriendCommand.java @@ -206,11 +206,14 @@ public final class FriendCommand extends AbstractCommandCollection { PlayerPresence presence = NetworkCore.getInstance().getPlayerPresence(); RankLookup ranks = NetworkCore.getInstance().getRankLookup(); + net.kewwbec.networkcore.api.VanishService vanish = NetworkCore.getInstance().getVanishService(); int online = 0; for (Friendship f : all) { UUID otherUuid = f.fromUuid().equals(sender.getUuid()) ? f.toUuid() : f.fromUuid(); - if (presence != null && presence.getLocation(otherUuid) != null) online++; + PlayerLocation loc = presence != null ? presence.getLocation(otherUuid) : null; + if (loc != null && vanish != null && vanish.isHiddenFrom(otherUuid, sender)) loc = null; + if (loc != null) online++; } ctx.sendMessage(Message.raw("=== Friends (" + online + "/" + all.size() + " online) ===").color(Color.YELLOW)); @@ -218,6 +221,7 @@ public final class FriendCommand extends AbstractCommandCollection { UUID otherUuid = f.fromUuid().equals(sender.getUuid()) ? f.toUuid() : f.fromUuid(); String otherName = f.fromUuid().equals(sender.getUuid()) ? f.toName() : f.fromName(); PlayerLocation loc = (presence == null) ? null : presence.getLocation(otherUuid); + if (loc != null && vanish != null && vanish.isHiddenFrom(otherUuid, sender)) loc = null; String status = (loc == null) ? "offline" : "online on " + loc.serverId(); RankInfo rank = (ranks == null) ? null : safeLookup(ranks, otherUuid); ctx.sendMessage(buildRow(rank, otherName, status, loc != null)); diff --git a/src/main/java/net/kewwbec/social/ui/FriendsListPage.java b/src/main/java/net/kewwbec/social/ui/FriendsListPage.java index 7f94858..e8f9cb8 100644 --- a/src/main/java/net/kewwbec/social/ui/FriendsListPage.java +++ b/src/main/java/net/kewwbec/social/ui/FriendsListPage.java @@ -102,11 +102,13 @@ public final class FriendsListPage { } PlayerPresence presence = NetworkCore.getInstance().getPlayerPresence(); RankLookup ranks = NetworkCore.getInstance().getRankLookup(); + net.kewwbec.networkcore.api.VanishService vanish = NetworkCore.getInstance().getVanishService(); int i = 0; for (Friendship f : friends) { UUID otherUuid = f.fromUuid().equals(playerRef.getUuid()) ? f.toUuid() : f.fromUuid(); String otherName = f.fromUuid().equals(playerRef.getUuid()) ? f.toName() : f.fromName(); PlayerLocation loc = (presence == null) ? null : presence.getLocation(otherUuid); + if (loc != null && vanish != null && vanish.isHiddenFrom(otherUuid, playerRef)) loc = null; String status = (loc == null) ? "offline" : "online on " + loc.serverId(); RankInfo rank = (ranks == null) ? null : safeLookup(ranks, otherUuid); sb.append(renderNameRow(rank, otherName, status)); diff --git a/src/main/java/net/kewwbec/social/ui/GuildRosterPage.java b/src/main/java/net/kewwbec/social/ui/GuildRosterPage.java index 097e08d..9fa455e 100644 --- a/src/main/java/net/kewwbec/social/ui/GuildRosterPage.java +++ b/src/main/java/net/kewwbec/social/ui/GuildRosterPage.java @@ -62,9 +62,13 @@ public final class GuildRosterPage { List roster = ctx.guilds.roster(gc.guild().id()); int online = 0; PlayerPresence presence = NetworkCore.getInstance().getPlayerPresence(); + net.kewwbec.networkcore.api.VanishService vanish = NetworkCore.getInstance().getVanishService(); if (presence != null) { for (GuildMember m : roster) { - if (presence.getLocation(m.uuid()) != null) online++; + PlayerLocation l = presence.getLocation(m.uuid()); + if (l == null) continue; + if (vanish != null && vanish.isHiddenFrom(m.uuid(), playerRef)) continue; + online++; } } @@ -74,6 +78,7 @@ public final class GuildRosterPage { String rankName = rankNames.getOrDefault(m.rankId(), "?"); String self = m.uuid().equals(playerRef.getUuid()) ? " (you)" : ""; PlayerLocation loc = (presence == null) ? null : presence.getLocation(m.uuid()); + if (loc != null && vanish != null && vanish.isHiddenFrom(m.uuid(), playerRef)) loc = null; String status = (loc == null) ? "offline" : "on " + loc.serverId(); body.append("

") .append(escape(m.name()))