2016-04-18 14:43:19 +00:00
|
|
|
From 1225a5c9172f97e3dd4edb31ce1357ab905ea957 Mon Sep 17 00:00:00 2001
|
2016-03-30 06:20:36 +00:00
|
|
|
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
|
2016-03-31 01:56:07 +00:00
|
|
|
index 058735e..06dec17 100644
|
2016-03-30 06:20:36 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2016-03-31 01:56:07 +00:00
|
|
|
@@ -1622,4 +1622,20 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
2016-03-30 06:20:36 +00:00
|
|
|
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) {
|
2016-03-31 01:56:07 +00:00
|
|
|
+ if (world == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
2016-03-30 06:20:36 +00:00
|
|
|
+ entity = world.getEntity(uuid);
|
2016-03-30 14:41:12 +00:00
|
|
|
+ if (entity != null && !entity.dead) {
|
2016-03-30 06:20:36 +00:00
|
|
|
+ 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
|
2016-04-14 03:18:46 +00:00
|
|
|
index 281f4a4..128b597 100644
|
2016-03-30 06:20:36 +00:00
|
|
|
--- 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;
|
2016-04-14 03:18:46 +00:00
|
|
|
@@ -1849,5 +1850,14 @@ public final class CraftServer implements Server {
|
2016-03-30 06:20:36 +00:00
|
|
|
((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
|
|
|
|
}
|
|
|
|
--
|
2016-03-31 00:50:23 +00:00
|
|
|
2.8.0
|
2016-03-30 06:20:36 +00:00
|
|
|
|