0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-21 20:56:14 +00:00
spigot/CraftBukkit-Patches/0037-Add-support-for-fetching-hidden-players.patch
2024-10-24 06:15:00 +11:00

36 lines
1.3 KiB
Diff

From 43b5056371684090ecd91947623bad4089e61443 Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Sun, 9 Feb 2014 14:03:03 -0500
Subject: [PATCH] Add support for fetching hidden players
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 595d83679a..a8d7d25a20 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2377,6 +2377,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
server.getServer().getPlayerList().respawn( getHandle(), false, Entity.RemovalReason.KILLED, org.bukkit.event.player.PlayerRespawnEvent.RespawnReason.PLUGIN );
}
}
+
+ @Override
+ public Set<Player> getHiddenPlayers()
+ {
+ Set<Player> ret = new HashSet<>();
+ for ( Player p : getServer().getOnlinePlayers() )
+ {
+ if ( !CraftPlayer.this.canSee(p) )
+ {
+ ret.add( p );
+ }
+ }
+
+ return java.util.Collections.unmodifiableSet( ret );
+ }
};
public Player.Spigot spigot()
--
2.47.0