Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
812618deba
Unintended side effects in recent versions, this patch has likely outlived its usefulness. Closes GH-452
58 Zeilen
2.2 KiB
Diff
58 Zeilen
2.2 KiB
Diff
From ecd53891c287dde51e1bc92bd2a4624c7c5d0cef Mon Sep 17 00:00:00 2001
|
|
From: DemonWav <demonwav@gmail.com>
|
|
Date: Wed, 30 Mar 2016 01:20:11 -0500
|
|
Subject: [PATCH] Add getEntity by UUID API
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 885fc80..7bb6033 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1506,6 +1506,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
|
this.Y = 0L;
|
|
}
|
|
|
|
+ public Entity getEntity(UUID uuid) { return this.a(uuid); } // Paper - OBFHELPER
|
|
@Nullable
|
|
public Entity a(UUID uuid) {
|
|
WorldServer[] aworldserver = this.worldServer;
|
|
@@ -1519,7 +1520,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
|
if (worldserver != null) {
|
|
Entity entity = worldserver.getEntity(uuid);
|
|
|
|
- if (entity != null) {
|
|
+ if (entity != null && !entity.dead) {
|
|
return entity;
|
|
}
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 15bef42..703aff1 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -53,6 +53,7 @@ import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
|
import org.bukkit.conversations.Conversable;
|
|
import org.bukkit.craftbukkit.boss.CraftBossBar;
|
|
import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
|
|
+import org.bukkit.craftbukkit.entity.CraftEntity;
|
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
import org.bukkit.craftbukkit.generator.CraftChunkData;
|
|
import org.bukkit.craftbukkit.help.SimpleHelpMap;
|
|
@@ -1848,5 +1849,14 @@ public final class CraftServer implements Server {
|
|
});
|
|
}
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public CraftEntity getEntity(UUID uuid) {
|
|
+ Entity entity = getHandle().getServer().getEntity(uuid);
|
|
+ if (entity == null) {
|
|
+ return null;
|
|
+ }
|
|
+ return entity.getBukkitEntity();
|
|
+ }
|
|
// Paper end
|
|
}
|
|
--
|
|
2.9.3
|
|
|