From 62ae1a679c19bef5d2097e9654e309d5241ffc7d Mon Sep 17 00:00:00 2001 From: Suddenly Date: Sun, 22 Jun 2014 15:24:20 -0500 Subject: [PATCH] Prevent null hopper owners crashing the server --- ...ll-hopper-owners-crashing-the-server.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 CraftBukkit-Patches/0150-Prevent-null-hopper-owners-crashing-the-server.patch diff --git a/CraftBukkit-Patches/0150-Prevent-null-hopper-owners-crashing-the-server.patch b/CraftBukkit-Patches/0150-Prevent-null-hopper-owners-crashing-the-server.patch new file mode 100644 index 000000000..27920d77f --- /dev/null +++ b/CraftBukkit-Patches/0150-Prevent-null-hopper-owners-crashing-the-server.patch @@ -0,0 +1,44 @@ +From 49438c7205d9dbb80e861a3c7c5bd113e45de256 Mon Sep 17 00:00:00 2001 +From: Suddenly +Date: Tue, 27 May 2014 14:00:41 +0100 +Subject: [PATCH] Prevent null hopper owners crashing the server + + +diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java +index c7b3495..45be65f 100644 +--- a/src/main/java/net/minecraft/server/TileEntityHopper.java ++++ b/src/main/java/net/minecraft/server/TileEntityHopper.java +@@ -243,13 +243,23 @@ public class TileEntityHopper extends TileEntity implements IHopper { + if (!this.j() && BlockHopper.c(this.p())) { + boolean flag = false; + +- if (!this.k()) { +- flag = this.x(); +- } +- +- if (!this.l()) { +- flag = suckInItems(this) || flag; +- } ++ try { // PaperSpigot Start (Try/catch to prevent null owner crash) ++ if (!this.k()) { ++ flag = this.x(); ++ } ++ } catch (NullPointerException e) { ++ this.getWorld().setAir(this.x, this.y, this.z); ++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Null owner found for hopper, removing hopper at {0} {1}, {2}, {3}", new Object[]{this.getWorld().getWorld().getName(), this.x, this.y, this.z}); ++ } ++ ++ try { ++ if (!this.l()) { ++ flag = suckInItems(this) || flag; ++ } ++ } catch (NullPointerException e) { ++ this.getWorld().setAir(this.x, this.y, this.z); ++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Null owner found for hopper, removing hopper at {0} {1}, {2}, {3}", new Object[]{this.getWorld().getWorld().getName(), this.x, this.y, this.z}); ++ } // PaperSpigot End + + if (flag) { + this.c(world.spigotConfig.hopperTransfer); // Spigot +-- +1.9.1 +