2014-07-03 03:47:25 +02:00
From d3ac50de254102713cf758ecb7f0db8ae3d1f7cf Mon Sep 17 00:00:00 2001
2014-06-22 22:24:20 +02:00
From: Suddenly <suddenly@suddenly.coffee>
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
2014-06-22 22:55:54 +02:00
index c7b3495..f7a6140 100644
2014-06-22 22:24:20 +02:00
--- 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();
+ 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});
2014-06-22 22:55:54 +02:00
}
- if (!this.l()) {
- flag = suckInItems(this) || flag;
- }
2014-06-22 22:24:20 +02:00
+ 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