2021-02-26 23:27:53 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
2021-03-16 14:04:28 +01:00
|
|
|
index 8b4df4affb798c19a8f2e968b3ca77aa22241201..038e44fc94b9920f2af9e2ede626950d1add06bc 100644
|
2021-03-16 08:19:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2021-03-16 14:04:28 +01:00
|
|
|
@@ -172,7 +172,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2021-02-26 23:27:53 +01:00
|
|
|
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|
|
|
|
private CraftEntity bukkitEntity;
|
|
|
|
|
|
|
|
- PlayerChunkMap.EntityTracker tracker; // Paper
|
|
|
|
+ public PlayerChunkMap.EntityTracker tracker; // Paper package private -> public
|
2021-03-16 14:04:28 +01:00
|
|
|
public boolean collisionLoadChunks = false; // Paper
|
|
|
|
public Throwable addedToWorldStack; // Paper - entity debug
|
2021-02-26 23:27:53 +01:00
|
|
|
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
|
2021-03-16 14:04:28 +01:00
|
|
|
index 89737dfb0244a6dfe3a2cc2d77a7b16a64f469bb..c86d7435346d9cb04cf798939ccfa54488f20480 100644
|
2021-02-26 23:27:53 +01:00
|
|
|
--- 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;
|
2021-03-09 19:03:27 +01:00
|
|
|
@@ -2297,6 +2298,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2021-02-26 23:27:53 +01:00
|
|
|
}
|
|
|
|
// 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()
|
|
|
|
{
|