mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
61 lines
2.3 KiB
Diff
61 lines
2.3 KiB
Diff
From ab9e23811fe4a0adfc0453deeadd7b59b6dd9690 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 058735e..06dec17 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1622,4 +1622,20 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
|
return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
|
|
}
|
|
// CraftBukkit end
|
|
+
|
|
+ // Paper start
|
|
+ public Entity getEntity(UUID uuid) {
|
|
+ Entity entity;
|
|
+ for (WorldServer world : worldServer) {
|
|
+ if (world == null) {
|
|
+ continue;
|
|
+ }
|
|
+ entity = world.getEntity(uuid);
|
|
+ if (entity != null && !entity.dead) {
|
|
+ return entity;
|
|
+ }
|
|
+ }
|
|
+ return null;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 9ed9fbb..5b70d7a 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;
|
|
@@ -1853,5 +1854,14 @@ public final class CraftServer implements Server {
|
|
((SimplePluginManager) pluginManager).clearPermissions();
|
|
loadCustomPermissions();
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public CraftEntity getEntity(UUID uuid) {
|
|
+ Entity entity = getHandle().getServer().getEntity(uuid);
|
|
+ if (entity == null) {
|
|
+ return null;
|
|
+ }
|
|
+ return entity.getBukkitEntity();
|
|
+ }
|
|
// Paper end
|
|
}
|
|
--
|
|
2.8.0
|
|
|