Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/org/milkteamc/autotreechop/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public class Config {
private int maxTreeSize;
private int maxDiscoveryBlocks;
private boolean callBlockBreakEvent;
private boolean incrementBlockStatistics;

public Config(AutoTreeChop plugin) {
this.plugin = plugin;
Expand Down Expand Up @@ -228,6 +229,7 @@ private void loadValues() {
maxTreeSize = config.getInt("max-tree-size", 500);
maxDiscoveryBlocks = config.getInt("max-discovery-blocks", 1000);
callBlockBreakEvent = config.getBoolean("call-block-break-event", true);
incrementBlockStatistics = config.getBoolean("increment-block-statistics", false);

autoReplantEnabled = config.getBoolean("enable-auto-replant", true);
replantDelayTicks = config.getLong("replant-delay-ticks", 15L);
Expand Down Expand Up @@ -546,6 +548,10 @@ public boolean isCallBlockBreakEvent() {
return callBlockBreakEvent;
}

public boolean isIncrementBlockStatistics() {
return incrementBlockStatistics;
}

public int getIdleTimeoutSeconds() {
return idleTimeoutSeconds;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ private void executeTreeChop(
}
block.breakNaturally();

if (config.isIncrementBlockStatistics()) {
player.incrementStatistic(org.bukkit.Statistic.MINE_BLOCK, originalLogType);
Comment thread
awdrgyj8 marked this conversation as resolved.
Outdated
}

actuallyRemovedLogs.add(location);
sessionManager.trackRemovedLogForPlayer(playerUUID.toString(), location);
playerConfig.incrementDailyBlocksBroken();
Expand Down Expand Up @@ -566,6 +570,7 @@ private boolean removeLeafBlock(
EffectUtils.showLeafRemovalEffect(player, leafBlock);
}

Material leafMaterial = leafBlock.getType();
Comment thread
awdrgyj8 marked this conversation as resolved.
Outdated
if (config.getLeafRemovalDropItems()) {
leafBlock.breakNaturally();
} else {
Expand All @@ -577,6 +582,10 @@ private boolean removeLeafBlock(
}
}

if (config.isIncrementBlockStatistics()) {
player.incrementStatistic(org.bukkit.Statistic.MINE_BLOCK, leafMaterial);
Comment thread
awdrgyj8 marked this conversation as resolved.
Outdated
}

// Update daily blocks count if needed
if (config.getLeafRemovalCountsTowardsLimit()) {
playerConfig.incrementDailyBlocksBroken();
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ max-discovery-blocks: 1000
# Call BlockBreakEvent for each block
# true = Better plugin compatibility
call-block-break-event: true
# Increment player's Minecraft block-break statistic (Statistic.MINE_BLOCK) for every block broken by ATC,
Comment thread
awdrgyj8 marked this conversation as resolved.
Outdated
# including all chain-chopped logs and leaves (if leaf removal is enabled).
increment-block-statistics: false

# Protection plugins setting
# If you are using Residence, you can set which Flag players have access to AutoTreeChop in residence.
Expand Down