From 57cd7099812ffef60311e5ce1b1ce979d5c6e9c0 Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Mon, 29 Sep 2014 15:37:39 -0700 Subject: [PATCH] Stopped limiting tree growth. This is a performance enhancement - the cost of limiting tree growth is way too high considering the VERY low risk of "tree grief". Also a positive side effect - no more weird-looking "sliced" trees. --- .../GriefPrevention/BlockEventHandler.java | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java b/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java index fbb3a47..75926ac 100644 --- a/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java @@ -742,42 +742,4 @@ public class BlockEventHandler implements Listener //everything else is NOT OK dispenseEvent.setCancelled(true); } - - @EventHandler(ignoreCancelled = true) - public void onTreeGrow (StructureGrowEvent growEvent) - { - Location rootLocation = growEvent.getLocation(); - Claim rootClaim = this.dataStore.getClaimAt(rootLocation, false, null); - String rootOwnerName = null; - - //who owns the spreading block, if anyone? - if(rootClaim != null) - { - //tree growth in subdivisions is dependent on who owns the top level claim - if(rootClaim.parent != null) rootClaim = rootClaim.parent; - - //if an administrative claim, just let the tree grow where it wants - if(rootClaim.isAdminClaim()) return; - - //otherwise, note the owner of the claim - rootOwnerName = rootClaim.getOwnerName(); - } - - //for each block growing - for(int i = 0; i < growEvent.getBlocks().size(); i++) - { - BlockState block = growEvent.getBlocks().get(i); - Claim blockClaim = this.dataStore.getClaimAt(block.getLocation(), false, rootClaim); - - //if it's growing into a claim - if(blockClaim != null) - { - //if there's no owner for the new tree, or the owner for the new tree is different from the owner of the claim - if(rootOwnerName == null || !rootOwnerName.equals(blockClaim.getOwnerName())) - { - growEvent.getBlocks().remove(i--); - } - } - } - } }