From 443a949bac7f7726ac121df653ec39dbe1df4fd4 Mon Sep 17 00:00:00 2001 From: DemonWav Date: Wed, 30 Mar 2016 01:20:36 -0500 Subject: [PATCH] Add getEntity by UUID API --- .../Add-getEntity-by-UUID-API.patch | 45 +++++++++++++++ .../Add-getEntity-by-UUID-API.patch | 56 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 Spigot-API-Patches/Add-getEntity-by-UUID-API.patch create mode 100644 Spigot-Server-Patches/Add-getEntity-by-UUID-API.patch diff --git a/Spigot-API-Patches/Add-getEntity-by-UUID-API.patch b/Spigot-API-Patches/Add-getEntity-by-UUID-API.patch new file mode 100644 index 0000000000..0cb14dce59 --- /dev/null +++ b/Spigot-API-Patches/Add-getEntity-by-UUID-API.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: DemonWav +Date: Wed, 30 Mar 2016 01:19:51 -0500 +Subject: [PATCH] Add getEntity by UUID API + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -0,0 +0,0 @@ public final class Bukkit { + public static void reloadPermissions() { + server.reloadPermissions(); + } ++ ++ /** ++ * Find an entity on the server by its UUID ++ * ++ * @param uuid The UUID of the entity ++ * @return The entity that is identified by the given UUID, or null if one isn't found ++ */ ++ public static Entity getEntity(UUID uuid) { ++ return server.getEntity(uuid); ++ } + // Paper end + + public static Server.Spigot spigot() +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { + Spigot spigot(); + + void reloadPermissions(); // Paper ++ ++ /** ++ * Find an entity on the server by its UUID ++ * ++ * @param uuid The UUID of the entity ++ * @return The entity that is identified by the given UUID, or null if one isn't found ++ */ ++ Entity getEntity(UUID uuid); // Paper + } +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-getEntity-by-UUID-API.patch b/Spigot-Server-Patches/Add-getEntity-by-UUID-API.patch new file mode 100644 index 0000000000..e1d6bf9b8e --- /dev/null +++ b/Spigot-Server-Patches/Add-getEntity-by-UUID-API.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: DemonWav +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -0,0 +0,0 @@ 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) { ++ entity = world.getEntity(uuid); ++ if (entity != null) { ++ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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 + } +-- \ No newline at end of file