Paper/patches/server/0628-Expose-Tracked-Players.patch
2021-06-29 22:21:42 +01:00

33 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Fri, 26 Feb 2021 16:24:25 -0600
Subject: [PATCH] Expose Tracked Players
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5b5c9d1bedb5fb87f390e39942a64f4d87098eeb..313bfab694bb93968db927b5e4bd98a7c7931184 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2340,6 +2340,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end
+ // Paper start
+ @Override
+ public Set<Player> getTrackedPlayers() {
+ if (entity.tracker == null) {
+ return java.util.Collections.emptySet();
+ }
+
+ Set<Player> set = new HashSet<>(entity.tracker.seenBy.size());
+ for (net.minecraft.server.network.ServerPlayerConnection connection : entity.tracker.seenBy) {
+ set.add(connection.getPlayer().getBukkitEntity().getPlayer());
+ }
+ return set;
+ }
+ // Paper end
+
// Spigot start
private final Player.Spigot spigot = new Player.Spigot()
{