3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 19:40:07 +01:00

add null check to getEntity API

Dieser Commit ist enthalten in:
Aikar 2016-03-30 21:56:07 -04:00
Ursprung fb74f6dbfd
Commit 3b2d6fd59e

Datei anzeigen

@ -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> From: DemonWav <demonwav@gmail.com>
Date: Wed, 30 Mar 2016 01:20:11 -0500 Date: Wed, 30 Mar 2016 01:20:11 -0500
Subject: [PATCH] Add getEntity by UUID API 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 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 --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/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; return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
} }
// CraftBukkit end // CraftBukkit end
@ -17,6 +17,9 @@ index 058735e..0c037ff 100644
+ public Entity getEntity(UUID uuid) { + public Entity getEntity(UUID uuid) {
+ Entity entity; + Entity entity;
+ for (WorldServer world : worldServer) { + for (WorldServer world : worldServer) {
+ if (world == null) {
+ continue;
+ }
+ entity = world.getEntity(uuid); + entity = world.getEntity(uuid);
+ if (entity != null && !entity.dead) { + if (entity != null && !entity.dead) {
+ return entity; + return entity;