Permalink
Browse files

Added option to only remove 1 damage from the axe in treelopper.

  • Loading branch information...
me4502 committed Jun 9, 2017
1 parent 6223a08 commit 34b99d04a5ca2ece11063360dc8c0062a2290f3c
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/main/java/com/sk89q/craftbook/mechanics/TreeLopper.java
@@ -71,7 +71,9 @@ public void onBlockBreak(BlockBreakEvent event) {
if(visitedLocations.contains(block.getLocation())) continue;
if(canBreakBlock(event.getPlayer(), originalBlock, block))
if(searchBlock(event, block, player, originalBlock, visitedLocations, broken, planted)) {
ItemUtil.damageHeldItem(event.getPlayer());
if (!singleDamageAxe) {
ItemUtil.damageHeldItem(event.getPlayer());
}
}
}
}
@@ -131,7 +133,9 @@ else if (data instanceof Tree)
if(visitedLocations.contains(block.getRelative(face).getLocation())) continue;
if(canBreakBlock(event.getPlayer(), originalBlock, block.getRelative(face)))
if(searchBlock(event, block.getRelative(face), player, originalBlock, visitedLocations, broken, planted)) {
ItemUtil.damageHeldItem(event.getPlayer());
if (!singleDamageAxe) {
ItemUtil.damageHeldItem(event.getPlayer());
}
}
}
@@ -145,6 +149,7 @@ else if (data instanceof Tree)
private boolean enforceDataValues;
private boolean placeSaplings;
private boolean breakLeaves;
private boolean singleDamageAxe;
@Override
public void loadConfiguration (YAMLProcessor config, String path) {
@@ -169,6 +174,9 @@ public void loadConfiguration (YAMLProcessor config, String path) {
config.setComment(path + "break-leaves", "If enabled, TreeLopper will break leaves connected to the tree. (If enforce-data is enabled, will only break leaves of same type)");
breakLeaves = config.getBoolean(path + "break-leaves", false);
config.setComment(path + "single-damage-axe", "Only remove one damage from the axe, regardless of the amount of logs removed.");
singleDamageAxe = config.getBoolean(path + "single-damage-axe", false);
}
private static class SaplingPlanter implements Runnable {

0 comments on commit 34b99d0

Please sign in to comment.