Advanced TreeCapitator
版本: 1.5.3 | API: Paper 1.21+ | 作者: Duong2012G
许可证: Apache-2.0 | 链接: Modrinth
仅用一次斧头挥击即可砍伐整棵树——完全支持幸运符、精准采集以及真实的工具耐久度机制。
功能特性
| 功能 |
描述 |
| BFS 树木砍伐 |
使用 26 方向广度优先搜索查找并破坏所有相连的原木。正确处理巨橡树、金合欢树和深色橡木的斜向原木。 |
| 可配置的水平范围限制 |
限制 BFS 的水平扩散范围——防止附近的树木被合并到同一次砍伐中。默认值:8 格。可通过 max-horizontal-distance 进行配置(v1.5.0 新增)。 |
| 可配置的三维距离限制 |
max-distance 限制所有三个轴向的 BFS 总深度。默认值:50——足以容纳高达 30+ 格的丛林树。可通过 max-distance 进行配置(v1.5.1 新增;此前为硬编码 30)。 |
require-leaves 守卫机制 |
在砍伐前检查相邻树叶——防止在玩家建造的原木墙和小木屋上意外触发。现已正确覆盖去皮原木变体(v1.5.1 修复)。 |
| 保护插件支持 |
对每个额外破坏的方块触发 BlockBreakEvent——WorldGuard、GriefPrevention、Lands 和 Residence 等插件可以取消单个方块的破坏。 |
| 防递归守卫 |
breakingTrees 集合防止插件在触发保护事件时自我重复触发。已移除可变集合暴露问题(v1.5.1 修复)。 |
| 幸运符与精准采集 |
通过 breakNaturally(tool) 自动应用于所有方块,无需额外配置。 |
| 耐久度预检查 |
在破坏任何方块之前计算最大可破坏原木数量——斧头绝不可能破坏超过其剩余耐久度允许的数量。 |
| 原版未损坏附魔概率 |
耐久度损耗采用逐次随机判定,匹配 Minecraft 实际的未损坏(Unbreaking)公式(v1.5.0 修复)。 |
| 配置验证 |
所有数值均被钳制在有效范围内——格式错误的配置文件不会导致崩溃或破坏插件功能。 |
| 可配置的树叶消耗 |
leaf-durability-ratio 控制多少树叶相当于一点耐久度消耗(默认:10)。部分消耗通过概率方式解决(v1.5.1 修复)。 |
| 部分砍伐 |
大于 max-blocks 的树木将被砍伐至该限制;剩余原木可通过额外的挥击进行收集。 |
| 按玩家开关 |
每位玩家可使用 /atc toggle 启用/禁用树木砍伐,且不影响其他玩家。断开连接时重置开关状态。 |
| 插件 API |
TreeCapitatorEvent 允许其他插件取消砍伐或提供自定义奖励。所有 API 方法均标注 @NotNull(v1.5.1 新增)。 |
| 世界白名单/黑名单 |
限制哪些世界允许树木砍伐。 |
| 下界与竹子支持 |
支持绯红菌核、诡异菌核和竹块。对于这些类型的方块,require-leaves 守卫会自动绕过。 |
| 粒子与音效反馈 |
每次砍伐都有视觉反馈。声音在树根处播放,确保附近玩家能正确听到(v1.5.0 修复)。 |
| 热重载 |
使用 /atc reload 应用配置更改,无需重启服务器。 |
| 真实挖掘时间 |
可选的 realistic-break-time 将砍伐过程分散到真实的挖掘时间内,而不是在同一刻破坏所有原木——堵住了“即时木材农场”漏洞。默认:关闭(v1.5.3 新增)。 |
安装说明
- 下载
AdvancedTreeCapitator-1.5.3.jar
- 将其放入服务器的
plugins/ 文件夹中
- 重启或重新加载服务器
- 根据需要编辑
plugins/AdvancedTreeCapitator/config.yml
- 运行
/atc reload 以应用更改而无需重启
要求: Paper(或任何 Paper 分支)1.21+,Java 17+
权限设置
| 权限节点 |
描述 |
默认值 |
advancedtreecapitator.use |
使用树木砍伐 + /atc toggle |
true(所有玩家) |
advancedtreecapitator.admin |
使用 /atc reload 重新加载配置 |
op |
命令列表
| 命令 |
描述 |
所需权限 |
/atc toggle |
为自己启用或禁用树木砍伐 |
advancedtreecapitator.use |
/atc reload |
重新加载配置文件 |
advancedtreecapitator.admin |
使用方法
- 手持
tool-whitelist 列表中列出的斧头
- 如果
require-sneak: true,请潜行(Shift)
- 破坏树的底部原木——整棵相连的树将一次性掉落
幸运符: 所有原木和树叶都会自动获得幸运符加成掉落。
精准采集: 原木和树叶将以方块形式掉落,而非物品。
配置参考
# ── 激活设置 ──────────────────────────────────────────────────
enabled: true
require-axe: true # 必须手持 tool-whitelist 中的斧头
require-sneak: true # 必须处于潜行状态(Shift)
require-leaves: true # 至少需要 1 个相邻树叶——防止结构损坏
# 自 v1.5.1 起覆盖去皮原木变体
# ── 树木检测 ───────────────────────────────────────────────
max-blocks: 100 # 每次砍伐的最大原木数(超出限制的部分砍伐)
max-horizontal-distance: 8 # BFS 水平扩散上限(v1.5.0 新增,此前为硬编码)
max-distance: 50 # BFS 三维曼哈顿距离上限——增加此值以支持高大的丛林树
# (v1.5.1 新增,v1.5.0 中为硬编码 30)
# ── 计时设置 ───────────────────────────────────────────────
cooldown-ms: 200 # 每位玩家的冷却时间(毫秒)
realistic-break-time: false # 将砍伐过程分散到真实的挖掘时间内,而不是
# 在同一刻破坏所有原木/树叶(v1.5.3 新增)
# ── 树叶设置 ───────────────────────────────────────────────
break-leaves: false # 同时破坏相邻树叶
── 耐久度 ──────────────────────────────────────────────────
damage-axe: true # 根据破坏的方块数量按比例扣除耐久度
damage-multiplier: 1.0 # 每个原木方块的耐久消耗(尊重“无损”附魔)
leaf-durability-ratio: 10 # 多少树叶等于 1 点耐久消耗(当 break-leaves: true 时)
# 部分命中现在使用概率判定(v1.5.1 修复)
── 特效 ─────────────────────────────────────────────────────
particle-effect: true
sound-effect: true # 音效在树根处播放(v1.5.0 修复)
── 世界限制 ───────────────────────────────────────────────────
whitelist-worlds: [] # 仅允许这些世界(空 = 所有世界)
blacklist-worlds: [] # 禁止这些世界(空 = 无)
### 世界限制
```yaml
# 仅允许特定世界:
whitelist-worlds:
- world
- world_nether
# 或禁止特定世界:
blacklist-worlds:
- creative_world
添加自定义原木类型
将任何 Material 枚举名称(不区分大小写)添加到 log-types:
log-types:
- OAK_LOG
- STRIPPED_OAK_LOG # 去皮变体现在受 require-leaves 约束(v1.5.1)
- MUSHROOM_STEM # 启用巨型蘑菇砍伐
# 按需添加更多...
插件 API — TreeCapitatorEvent
其他插件可以通过 TreeCapitatorEvent 挂钩到树木砍伐事件:
import dev.duong2012g.atc.TreeCapitatorEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class MyListener implements Listener {
@EventHandler
public void onTreeFell(TreeCapitatorEvent event) {
Player player = event.getPlayer();
int logCount = event.getLogs().size(); // 包含起始方块
// 示例:在受保护区域取消砍伐
if (isProtectedRegion(player.getLocation())) {
event.setCancelled(true);
return;
}
// 示例:根据树木大小给予经济奖励
economy.depositPlayer(player, logCount * 0.5);
}
}
事件字段:
| 方法 |
返回类型 |
描述 |
getPlayer() |
@NotNull Player |
触发砍伐的玩家 |
getLogs() |
@NotNull Set<Block> (不可修改) |
所有计划被破坏的原木方块,包括起始方块。大小 = 整棵树的大小。 |
getLeaves() |
@NotNull Set<Block> (不可修改) |
计划被破坏的树叶方块(如果 break-leaves: false 或被修剪则为空) |
setCancelled(true) |
— |
取消整棵树的砍伐;冷却时间将退还(v1.5.0 修复) |
注意(v1.5.0 修复): 在 v1.4.0 及更早版本中,Javadoc 错误地声称
getLogs() 不包含起始方块。它一直包含起始方块。如果您的插件
为了规避此问题而从 getLogs().size() 中减去了 1,请在升级到 v1.5.0+ 时移除该调整。
v1.5.3 新增内容
| # |
功能 |
影响 |
| 1 |
新增 realistic-break-time 选项(默认:false) |
启用后,砍伐的树木将逐个原木/树叶依次破碎,而不是瞬间全部破碎,每个方块的延迟时间等于玩家当前工具挖掘该方块的真实原版时间。这堵住了“挥动一次斧头,瞬间获得整棵树”的刷木漏洞,同时保留了一次挥砍自动砍伐的功能。 |
v1.5.2 新增内容
| # |
修复 |
影响 |
| 1 |
api-version 从 '1.20' 提升至 '1.21' |
插件不再在不支持 Particle.BLOCK 的 1.20.x 服务器上加载——防止启用时出现 NoSuchFieldError |
| 2 |
修正下界茎干和竹子的破碎音效 |
CRIMSON_STEM/WARPED_STEM 现在播放 BLOCK_NETHER_WOOD_BREAK;BAMBOO_BLOCK 播放 BLOCK_BAMBOO_WOOD_BREAK |
| 3 |
cfg 在任务执行时重新获取,而非在构造时 |
在事件和任务之间的单 tick 窗口内执行 /atc reload 现在总是生效 |
v1.5.1 新增内容
| # |
修复 |
影响 |
| 1 |
BFS 距离检查移至 logsToBreak.add() 之前 |
max-horizontal-distance 现在在边界处正常工作——超出限制之外的方块不再被包含在砍伐范围内 |
| 2 |
极端 YAML 值下的 cooldown-ms 溢出 |
大于 Integer.MAX_VALUE 的值不再静默禁用冷却时间 |
| 3 |
max-distance 现在可配置(默认 50,之前硬编码为 30) |
高大的丛林树不再会在树干中间被截断 |
| 4 |
移除了 getBreakingTrees() 公共 getter |
防递归保护机制不再能被外部插件破坏 |
| 5 |
isOverworldLog() 涵盖去皮原木变体 |
STRIPPED_OAK_LOG 等列入 log-types 的原木现在正确遵守 require-leaves 设置 |
| 6 |
树叶耐久度部分命中通过概率解决 |
破坏少于 leaf-durability-ratio 数量的树叶不再静默丢弃该次命中 |
| 7 |
TreeCapitatorEvent 公共 API 上的 @NotNull 注解 |
提升第三方集成的 IDE 和静态分析支持 |
v1.5.0 新增内容
| # |
修复 |
影响 |
| 1 |
Enchantment.UNBREAKING 常量替换已弃用的 getByKey() |
“无损”附魔现在在 Paper 1.21+ 上正常工作 |
| 2 |
任务执行前增加 isOnline() 检查 |
消除玩家在单 tick 窗口内断开连接时的不安全调用 |
| 3 |
PlayerQuitEvent 清除所有每玩家状态 |
断开连接时,切换状态和冷却时间正确重置 |
| 4 |
当 TreeCapitatorEvent 被取消时退还冷却时间 |
当另一个插件阻止砍伐时,玩家不会受到惩罚 |
| 5 |
修正 TreeCapitatorEvent Javadoc(“包含起始方块”) |
第三方插件现在可以从 getLogs().size() 获取准确的树木大小 |
| 6 |
“无损”附魔使用每次命中的随机判定(符合原版逻辑) |
耐久度消耗现在感觉更自然,且变化方式与原版一致 |
| 7 |
音效在树根处播放,而非玩家位置 |
附近的玩家能听到砍伐声;音频与视觉匹配 |
| 8 |
max-horizontal-distance 现在可配置 |
拥有宽阔树冠的整合包树木不再需要修改代码 |
已知问题
- Folia 不兼容 — 尚未使用 Folia 的
RegionScheduler API。计划于 v1.6.0 版本中实现。
更新日志
请参阅 CHANGELOG.md
许可证
Apache-2.0 © Duong2012G
Advanced TreeCapitator
Version: 1.5.3 | API: Paper 1.21+ | Author: Duong2012G
License: Apache-2.0 | Link: Modrinth
Fell an entire tree with a single axe swing — Fortune, Silk Touch, and realistic
tool durability fully supported.
Features
| Feature |
Description |
| BFS tree felling |
Finds and breaks all connected logs using a 26-direction breadth-first search. Handles Big Oak, Acacia, and Dark Oak diagonal logs correctly. |
| Configurable horizontal cap |
Limits horizontal BFS spread — keeps nearby trees from being merged into one fell. Default: 8 blocks. Configurable via max-horizontal-distance (added v1.5.0). |
| Configurable 3-D distance cap |
max-distance limits total BFS depth in all three axes. Default: 50 — accommodates Jungle trees up to 30+ blocks tall. Configurable via max-distance (added v1.5.1; was hardcoded 30). |
require-leaves guard |
Checks for adjacent leaves before felling — prevents accidental activation on player-built log walls and cabins. Now correctly covers stripped-log variants (fixed v1.5.1). |
| Protection plugin support |
Fires BlockBreakEvent for each extra block — WorldGuard, GriefPrevention, Lands, and Residence can cancel individual blocks. |
| Anti-recursion guard |
breakingTrees set prevents the plugin from re-triggering itself when it fires protection events. Mutable-set exposure removed (fixed v1.5.1). |
| Fortune & Silk Touch |
Work automatically on every block via breakNaturally(tool), no extra configuration needed. |
| Durability pre-check |
Calculates max breakable logs before breaking any — the axe can never fell more than its remaining durability allows. |
| Vanilla Unbreaking rolls |
Durability loss uses per-hit random rolls matching Minecraft's actual Unbreaking formula (fixed v1.5.0). |
| Config validation |
All numeric values are clamped to a valid range — a malformed config cannot crash or break the plugin. |
| Configurable leaf cost |
leaf-durability-ratio controls how many leaves equal one durability hit (default: 10). Partial hits resolved probabilistically (fixed v1.5.1). |
| Partial chop |
Trees larger than max-blocks are chopped up to the limit; remaining logs can be harvested with additional swings. |
| Per-player toggle |
Each player can enable/disable tree felling with /atc toggle without affecting others. Toggle state resets on disconnect. |
| Plugin API |
TreeCapitatorEvent lets other plugins cancel felling or grant custom rewards. All API methods annotated @NotNull (added v1.5.1). |
| World whitelist/blacklist |
Restrict which worlds allow tree felling. |
| Nether & Bamboo support |
Crimson Stem, Warped Stem, and Bamboo Block are supported. require-leaves is automatically bypassed for these types. |
| Particle & sound effects |
Visual feedback on each fell. Sound plays at the tree base so nearby players hear it correctly (fixed v1.5.0). |
| Hot reload |
Apply config changes with /atc reload, no restart needed. |
| Realistic break time |
Optional realistic-break-time spreads the fell out over real mining time instead of breaking every log instantly — closes the "instant wood farm" exploit. Default: off (added v1.5.3). |
Installation
- Download
AdvancedTreeCapitator-1.5.3.jar
- Place it in your server's
plugins/ folder
- Restart or reload the server
- Edit
plugins/AdvancedTreeCapitator/config.yml as needed
- Run
/atc reload to apply changes without restarting
Requirements: Paper (or any Paper fork) 1.21+, Java 17+
Permissions
| Permission |
Description |
Default |
advancedtreecapitator.use |
Use tree felling + /atc toggle |
true (all players) |
advancedtreecapitator.admin |
Reload config with /atc reload |
op |
Commands
| Command |
Description |
Permission |
/atc toggle |
Enable or disable tree felling for yourself |
advancedtreecapitator.use |
/atc reload |
Reload the configuration file |
advancedtreecapitator.admin |
How to Use
- Hold an axe listed in
tool-whitelist
- Sneak (Shift) if
require-sneak: true
- Break the base log of a tree — the entire connected tree drops at once
Fortune: All logs and leaves receive Fortune bonus drops automatically.
Silk Touch: Logs and leaves drop as their block form instead of items.
Configuration Reference
# ── Activation ──────────────────────────────────────────────────
enabled: true
require-axe: true # must hold an axe from tool-whitelist
require-sneak: true # must be sneaking (Shift)
require-leaves: true # at least 1 adjacent leaf required — prevents structure damage
# covers stripped-log variants since v1.5.1
# ── Tree detection ───────────────────────────────────────────────
max-blocks: 100 # max logs per fell (partial chop above limit)
max-horizontal-distance: 8 # BFS horizontal spread cap (added v1.5.0, was hardcoded before)
max-distance: 50 # BFS 3-D Manhattan cap — increase for tall Jungle trees
# (added v1.5.1, was hardcoded 30 in v1.5.0)
# ── Timing ──────────────────────────────────────────────────────
cooldown-ms: 200 # per-player cooldown in milliseconds
realistic-break-time: false # spread the fell over real mining time instead of
# breaking every log/leaf in the same tick (added v1.5.3)
# ── Leaves ──────────────────────────────────────────────────────
break-leaves: false # also break adjacent leaves
# ── Durability ──────────────────────────────────────────────────
damage-axe: true # apply durability loss proportional to blocks broken
damage-multiplier: 1.0 # durability cost per log block (Unbreaking respected)
leaf-durability-ratio: 10 # how many leaves = 1 durability hit (when break-leaves: true)
# partial hits now use probabilistic roll (fixed v1.5.1)
# ── Effects ─────────────────────────────────────────────────────
particle-effect: true
sound-effect: true # sound plays at the tree base (fixed v1.5.0)
# ── World restrictions ───────────────────────────────────────────
whitelist-worlds: [] # only these worlds (empty = all)
blacklist-worlds: [] # block these worlds (empty = none)
World Restrictions
# Allow only specific worlds:
whitelist-worlds:
- world
- world_nether
# Or block specific worlds:
blacklist-worlds:
- creative_world
Adding Custom Log Types
Add any Material enum name (case-insensitive) to log-types:
log-types:
- OAK_LOG
- STRIPPED_OAK_LOG # stripped variants are now subject to require-leaves (v1.5.1)
- MUSHROOM_STEM # enables huge mushroom felling
# add more as needed...
Plugin API — TreeCapitatorEvent
Other plugins can hook into tree felling via the TreeCapitatorEvent:
import dev.duong2012g.atc.TreeCapitatorEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class MyListener implements Listener {
@EventHandler
public void onTreeFell(TreeCapitatorEvent event) {
Player player = event.getPlayer();
int logCount = event.getLogs().size(); // includes the origin block
// Example: cancel felling in a protected region
if (isProtectedRegion(player.getLocation())) {
event.setCancelled(true);
return;
}
// Example: reward economy based on tree size
economy.depositPlayer(player, logCount * 0.5);
}
}
Event fields:
| Method |
Returns |
Description |
getPlayer() |
@NotNull Player |
The player who triggered the fell |
getLogs() |
@NotNull Set<Block> (unmodifiable) |
All log blocks scheduled to break, including the origin block. Size = full tree size. |
getLeaves() |
@NotNull Set<Block> (unmodifiable) |
Leaf blocks scheduled to break (empty if break-leaves: false or set was trimmed) |
setCancelled(true) |
— |
Cancels the entire tree felling; cooldown is refunded (fixed v1.5.0) |
Note (fixed v1.5.0): In v1.4.0 and earlier, the Javadoc incorrectly stated that
getLogs() excluded the origin block. It has always included it. If your plugin
subtracted 1 from getLogs().size() as a workaround, remove that adjustment when
upgrading to v1.5.0+.
What's New in v1.5.3
| # |
Feature |
Impact |
| 1 |
New realistic-break-time option (default: false) |
When enabled, a felled tree is broken one log/leaf at a time instead of all at once, with each delay equal to that block's real vanilla mining time for the player's current tool. Closes the "swing once, get an entire tree instantly" wood-farming exploit while keeping one-swing auto-felling. |
What's New in v1.5.2
| # |
Fix |
Impact |
| 1 |
api-version raised from '1.20' to '1.21' |
Plugin no longer loads on 1.20.x servers where Particle.BLOCK doesn't exist — prevents NoSuchFieldError on enable |
| 2 |
Correct break sound for Nether stems and Bamboo |
CRIMSON_STEM/WARPED_STEM now play BLOCK_NETHER_WOOD_BREAK; BAMBOO_BLOCK plays BLOCK_BAMBOO_WOOD_BREAK |
| 3 |
cfg fetched fresh in task execution, not at construction |
A /atc reload in the one-tick window between event and task now always takes effect |
What's New in v1.5.1
| # |
Fix |
Impact |
| 1 |
BFS distance check moved before logsToBreak.add() |
max-horizontal-distance now works correctly at the boundary — blocks just beyond the limit are no longer included in the fell |
| 2 |
cooldown-ms overflow on extreme YAML values |
Values > Integer.MAX_VALUE no longer silently disable the cooldown |
| 3 |
max-distance is now configurable (default 50, was hardcoded 30) |
Tall Jungle trees no longer get truncated mid-trunk |
| 4 |
getBreakingTrees() public getter removed |
Anti-recursion guard can no longer be corrupted by external plugins |
| 5 |
isOverworldLog() covers stripped-log variants |
STRIPPED_OAK_LOG etc. in log-types now correctly honour require-leaves |
| 6 |
Leaf durability partial hits resolved probabilistically |
Breaking fewer leaves than leaf-durability-ratio no longer silently discards the hit |
| 7 |
@NotNull on TreeCapitatorEvent public API |
IDE and static analysis support for third-party integrations |
What's New in v1.5.0
| # |
Fix |
Impact |
| 1 |
Enchantment.UNBREAKING constant replaces deprecated getByKey() |
Unbreaking now works correctly on Paper 1.21+ |
| 2 |
isOnline() guard before task execution |
No more unsafe calls when player disconnects in 1-tick window |
| 3 |
PlayerQuitEvent clears all per-player state |
Toggle state and cooldown reset correctly on disconnect |
| 4 |
Cooldown refunded when TreeCapitatorEvent is cancelled |
Players aren't penalised when another plugin blocks a fell |
| 5 |
TreeCapitatorEvent Javadoc corrected ("includes origin") |
Third-party plugins now get accurate tree size from getLogs().size() |
| 6 |
Unbreaking uses per-hit random rolls (vanilla-accurate) |
Durability loss now feels natural and varies like vanilla |
| 7 |
Sound plays at tree base, not the player |
Nearby players hear the fell; audio matches the visual |
| 8 |
max-horizontal-distance is now configurable |
Modpack trees with wide canopies no longer need a code change |
Known Issues
- Folia incompatibility — Folia's
RegionScheduler API is not yet used. Planned for v1.6.0.
Changelog
See CHANGELOG.md
License
Apache-2.0 © Duong2012G
评论 0
登录后参与评分
还没有评论,来抢沙发吧