Fix trees not growing naturally in protected regions.

Fixes WORLDGUARD-3166.
This commit is contained in:
sk89q 2014-08-31 17:52:03 -07:00
parent 73fe9cd62f
commit 1a12faf5ab

View File

@ -211,7 +211,13 @@ public void onBlockBurn(BlockBurnEvent event) {
@EventHandler(ignoreCancelled = true)
public void onStructureGrowEvent(StructureGrowEvent event) {
List<Block> 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?