add null check to getEntity API

This commit is contained in:
Aikar 2016-03-30 21:56:07 -04:00
parent fb74f6dbfd
commit 3b2d6fd59e

View file

@ -1,14 +1,14 @@
From 88d6d362e1437fc065603bbbb558448ff2443d52 Mon Sep 17 00:00:00 2001
From d229df3e11a546bfc6fc7016a72633c4efbcec02 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..0c037ff 100644
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,17 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
@@ -1622,4 +1622,20 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
}
// CraftBukkit end
@ -17,6 +17,9 @@ index 058735e..0c037ff 100644
+ 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;