Paper/Spigot-Server-Patches/0234-Avoid-NPE-during-CraftBlockEntityState-load.patch
Aikar 094bb03a37
Optimize Hoppers
- Lots of itemstack cloning removed. Only clone if the item is actually moved
- Return true when a plugin cancels inventory move item event instead of false, as false causes pulls to cycle through all items.
  However, pushes do not exhibit the same behavior, so this is not something plugins could of been relying on.
- Add option (Default on) to cooldown hoppers when they fail to move an item due to full inventory
- Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
2018-02-12 23:26:02 -05:00

43 lines
1.7 KiB
Diff

From 8d120f57374eefc72809cd7bdfaa6d1909e7723b Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Mon, 18 Sep 2017 13:38:40 -0700
Subject: [PATCH] Avoid NPE during CraftBlockEntityState load
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 54b719d91..3f2c5b2d5 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -60,7 +60,7 @@ public class TileEntitySign extends TileEntity {
}
public MinecraftServer C_() {
- return TileEntitySign.this.world.getMinecraftServer();
+ return MinecraftServer.getServer(); // Paper - world may be null
}
};
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 266f87d7f..22dcaea72 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -24,6 +24,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
// copy tile entity data:
this.snapshot = this.createSnapshot(tileEntity);
+ if(this.snapshot != null) // Paper - avoid NPE during load
this.load(snapshot);
}
@@ -35,6 +36,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
// copy tile entity data:
this.snapshot = this.createSnapshot(tileEntity);
+ if(this.snapshot != null) // Paper - avoid NPE during load
this.load(snapshot);
}
--
2.16.1