From e31cedf583a4091b6bfc7f5832452e9d97472174 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Thu, 24 Nov 2011 20:27:16 +0000 Subject: [PATCH] Fixed NPE in player inventory + don't ignore the cancel state of world unloads --- src/main/java/net/minecraft/server/InventoryPlayer.java | 2 +- src/main/java/org/bukkit/craftbukkit/CraftServer.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraft/server/InventoryPlayer.java b/src/main/java/net/minecraft/server/InventoryPlayer.java index ef395e3adc..0626a81034 100644 --- a/src/main/java/net/minecraft/server/InventoryPlayer.java +++ b/src/main/java/net/minecraft/server/InventoryPlayer.java @@ -312,7 +312,7 @@ public class InventoryPlayer implements IInventory { } public boolean b(Block block) { - if (block.material.k()) { + if (block != null && block.material.k()) { // CraftBukkit - fix NPE return true; } else { ItemStack itemstack = this.getItem(this.itemInHandIndex); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index cfa8009026..5a730fd948 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -596,7 +596,7 @@ public final class CraftServer implements Server { } WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld()); - pluginManager.callEvent(new WorldUnloadEvent(handle.getWorld())); + pluginManager.callEvent(e); if (e.isCancelled()) { return false;