mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 02:17:35 +01:00
58 lines
2.2 KiB
Diff
58 lines
2.2 KiB
Diff
From 1ad3298b70bd7775f2f4666f9981b07154a15a2c 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 4b60fed..64868c0 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1513,6 +1513,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;
|
|
@@ -1526,7 +1527,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
|
if (worldserver != null) {
|
|
Entity entity = worldserver.getEntity(uuid);
|
|
|
|
- if (entity != null) {
|
|
+ if (entity != null && entity.isAlive()) {
|
|
return entity;
|
|
}
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index de45d8b..5cb0eba 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -46,6 +46,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;
|
|
@@ -1865,5 +1866,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.8.3
|
|
|