From 1a12faf5ab13fcae46d72e8bc5ffa32d734b54b0 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 31 Aug 2014 17:52:03 -0700 Subject: [PATCH] Fix trees not growing naturally in protected regions. Fixes WORLDGUARD-3166. --- .../bukkit/listener/EventAbstractionListener.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java b/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java index 65c0fafc..8cc46a32 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java @@ -211,7 +211,13 @@ public void onBlockBurn(BlockBurnEvent event) { @EventHandler(ignoreCancelled = true) public void onStructureGrowEvent(StructureGrowEvent event) { List blockList = Lists.transform(event.getBlocks(), new BlockStateAsBlockFunction()); - Events.fireBulkEventToCancel(event, new PlaceBlockEvent(event, create(event.getPlayer()), event.getLocation().getWorld(), blockList, Material.AIR)); + + Player player = event.getPlayer(); + if (player != null) { + Events.fireBulkEventToCancel(event, new PlaceBlockEvent(event, create(player), event.getLocation().getWorld(), blockList, Material.AIR)); + } else { + Events.fireBulkEventToCancel(event, new PlaceBlockEvent(event, create(event.getLocation().getBlock()), event.getLocation().getWorld(), blockList, Material.AIR)); + } } // TODO: Handle EntityCreatePortalEvent?