mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
53 lines
2.3 KiB
Diff
53 lines
2.3 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/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 881db84a1afe2da5d30732c282f36b294c721c41..d62179765f93738e8444b507238b4fd79a1e9443 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -172,7 +172,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
|
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|
|
private CraftEntity bukkitEntity;
|
|
|
|
- PlayerChunkMap.EntityTracker tracker; // Paper
|
|
+ public PlayerChunkMap.EntityTracker tracker; // Paper package private -> public
|
|
public boolean collisionLoadChunks = false; // Paper
|
|
public Throwable addedToWorldStack; // Paper - entity debug
|
|
public CraftEntity getBukkitEntity() {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index e81de526a847c730abf86016354c1dc57780ec8b..05248f560d643080a3eac581c01aa89fb3709e6c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -16,6 +16,7 @@ import java.net.InetSocketAddress;
|
|
import java.net.SocketAddress;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
+import java.util.Collections; // Paper
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
import java.util.LinkedHashMap;
|
|
@@ -2309,6 +2310,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
}
|
|
// Paper end
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public Set<Player> getTrackedPlayers() {
|
|
+ if (entity.tracker == null) {
|
|
+ return Collections.emptySet();
|
|
+ }
|
|
+
|
|
+ Set<Player> set = new HashSet<>(entity.tracker.trackedPlayers.size());
|
|
+ for (EntityPlayer entityPlayer : entity.tracker.trackedPlayers) {
|
|
+ set.add(entityPlayer.getBukkitEntity().getPlayer());
|
|
+ }
|
|
+ return set;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
// Spigot start
|
|
private final Player.Spigot spigot = new Player.Spigot()
|
|
{
|