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.
This commit is contained in:
ryanhamshire 2014-09-29 15:37:39 -07:00
parent cd85562e40
commit 57cd709981

View File

@ -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--);
}
}
}
}
}