Chestnut
Chestnut 是一款 Minecraft 插件,它会监控特定方块,并在这些方块发生变动时发送可自定义的 Discord Webhook 消息。 你可以用它来监视邮箱、红石火把等,警报内容可根据你的风格和需求完全定制。
为什么叫 "Chestnut"(栗子)?
嗯,它最初的名字是 “Chest-Nut”——因为你知道,它在盯着箱子(chests)。
Alpha 版本通知:
Chestnut 目前处于 Alpha 阶段!——你可能会遇到一些 Bug 或缺失的功能。
欢迎提供反馈!请随时在 GitHub 仓库 提交问题或建议。
功能
- 通过站在支持的方块旁并运行命令来跟踪它们(储物容器、红石火把、讲台)。
- 内置触发器,如
storage、redstone_torch 和 lectern。
- 支持带有
<name>、<world>、<time> 或 <page> 等占位符的自定义消息模板。
- 可为每个事件设置可选的嵌入颜色(embed color)和缩略图图片。
- 异步发送 Discord Webhook,具备速率限制和重试机制。
支持的方块类型:
- 储物容器(例如箱子、 barrels、潜影盒)
- 红石火把
- 讲台
未来可能会根据时间推移或用户请求添加更多方块类型。
命令
| 命令 |
描述 |
/settracker <name> <trigger> |
开始创建追踪器,为其命名并选择触发器。你将有 15 秒的时间右键点击合适的方块以将其绑定。 |
/edittracker <name> … |
更改消息、颜色、缩略图等。 |
/trackerlist [page] |
显示所有追踪器,并提供交互式菜单以便快速对追踪器进行简单更改(基于 Husk Homes)。 |
/deltracker <name|all> |
删除追踪器。 |
/chestnut <help|reload|status> |
管理操作。 |
触发器参考
所有触发器都支持基本标签,如 <name>、<trigger>、<event>、<world>、<x>、<y>、<z> 和 <time>。
部分触发器会添加以下列出的额外标签。
注意:<name> 默认使用追踪器给定的标题;否则将使用追踪器的 ID 名称。
| 触发器 |
事件 |
额外标签 |
storage |
open, close |
<user>, <uuid>, <items> |
redstone_torch |
on, off |
<state> (lit 或 unlit) |
lectern |
insert_book, remove_book, page_change, open, close |
<user>, <uuid>, <page>, <book_title>, <book_author>, <book_pages>, <has_book> |
示例:监视邮箱
假设出生点有一个箱子,玩家会把物品丢进去。每当有人打开这个箱子时,你都希望收到一条 Discord 警报。
-
站在箱子旁并输入:
/settracker mailbox storage
运行命令后,你将有 15 秒 的时间右键点击该箱子以将其绑定到追踪器。
-
自定义通过 Webhook 发送的消息:
/edittracker mailbox msg open "<user> checked the <name>!"
/edittracker mailbox msg close "<user> closed the <name>. Items: <items>"
-
添加颜色和图标:
/edittracker mailbox color open #00FF00
/edittracker mailbox color close #FF0000
/edittracker mailbox thumbnail open https://example.com/open.png
/edittracker mailbox thumbnail close https://example.com/close.png
-
通过测试事件来尝试一下:
/edittracker mailbox test open
现在,每次使用该箱子时,都会向你的 Webhook 发送一个嵌入消息,其中包含配置好的标题、描述、颜色和缩略图。
示例:微调事件消息
假设你为图书馆里的一个讲台设置了追踪器,但只关心书籍插入或移除的情况,而不需要关注每一次翻页。以下是简化方法:
-
照常创建追踪器(如果尚未创建):
/settracker library_lectern lectern
- library_lectern = 你为这个追踪器起的名称
-
禁用你不想要的事件:
/edittracker library_lectern msg --disable page_change
/edittracker library_lectern msg --disable open
/edittracker library_lectern msg --disable close
这告诉 Chestnut 完全忽略这些事件。
-
将自定义消息恢复为默认值:
也许你对 insert_book 尝试了自定义消息,但后来发现还是更喜欢默认的消息:
/edittracker library_lectern msg --clear insert_book
-
稍后重新启用某个事件:
如果你改变主意,希望再次接收 page_change 事件:
/edittracker library_lectern msg --enable page_change
-
检查你的设置:
/edittracker library_lectern view
这将显示哪些事件已启用/禁用,以及它们会发送什么消息。
提示:想一键清空所有设置?
使用 --clear all 可立即将该追踪器的所有事件重置为默认消息。
结果: 你的讲台追踪器现在仅在插入书籍或翻页时发送警报,在保持 Discord 频道整洁的同时,依然跟踪重要的操作。
权限
chestnut.use – 允许玩家创建和管理追踪器。
chestnut.admin – 授予访问管理命令(如重载)的权限。
配置
config.yml 包含全局设置,例如默认嵌入颜色、Webhook URL 和速率限制。
常见问题
Q:我可以在已经拥有 Discord 机器人的服务器上使用该插件吗?
当然可以。Chestnut 独立运行,它直接向 Discord 发送 Webhook 消息。它不需要连接或控制现有的机器人,因此不会干扰你的机器人正在执行的任何操作。
Q:Chestnut 是否仅支持 Discord?
是的。目前,Chestnut 以专为 Discord 设计的格式发送 Webhook 消息。未来可能会扩展以支持其他服务。
Q:如果我追踪大量方块,它会拖慢服务器性能吗?
有可能。我尚未对极限情况进行压力测试,但像大多数插件一样,追踪极大量的方块可能会影响性能。建议从少量开始,并在监控服务器 TPS 的同时逐步增加。不过,你可能会先遇到 Discord 的速率限制,而不是出现性能问题。
Q:我可以将 Webhook 发送到多个频道吗?
目前不支持。Chestnut 每个服务器配置仅支持单个 Webhook URL。我希望未来能添加对多频道的支持。
Q:为什么我的警报看起来与示例截图不一样?
开箱即用,Chestnut 使用简单的默认消息,没有自定义颜色或缩略图。示例截图中展示的是通过 /edittracker 命令配置的自定义设置效果。
Q:如果我追踪的方块被破坏或移动了会发生什么?
Chestnut 通过方块的精确位置进行追踪,而不是根据该位置上是什么类型的方块。因此,如果你破坏了一个被追踪的箱子,并在同一位置替换成木桶(或其他任何东西),追踪器仍将处于活动状态,并可能对新的方块做出响应。如果方块被移动或完全移除,追踪器将继续在该位置监听,直到你删除或重新分配它。
Q:为什么 Chestnut 允许我选择非支持的方块(如草或梯子)作为目标?
因为 Chestnut 仅绑定到你右键点击的方块的精确 XYZ 坐标,它并不关心具体是什么方块。这意味着你可以使用任何方块,即使那些实际上不会触发事件的方块,作为占位符。例如,你可以在临时方块上设置追踪器,之后将其移除,再在那里放置其他方块用于追踪,而无需重新运行命令。
Q:我发现了一堆 Bug!?
哈哈,确实……这是我第一次正式尝试制作插件,也是第一次认真写 Java/Kotlin 代码。我自己更偏向于 Python。
Chestnut
Chestnut is a Minecraft plugin that watches specific blocks and
sends customizable Discord webhook messages when something happens to them. Use it to keep an eye on mailboxes, redstone torches, and more, with alerts that
can be fully tailored to match your style and needs.
Why "Chestnut"?
Well, it started as “Chest-Nut” — because, you know, it keeps an eye on chests.
Alpha Notice:
Chestnut is currently in alpha! — you may encounter bugs or missing features.
Feedback is welcome! Feel free to submit issues or suggestions on the
GitHub repository.
Features
- Track supported blocks (storage containers, redstone torches, lecterns) by standing next to them and running a command.
- Built‑in triggers such as
storage, redstone_torch and lectern.
- Custom message templates with placeholders like
<name>, <world>, <time>, or <page>.
- Optional embed colors and thumbnail images for each event.
- Discord webhooks sent asynchronously with rate limiting and retry.
Supported block types:
- Storage containers (e.g., chests, barrels, shulker boxes)
- Redstone torches
- Lecterns
More block types may be added over time or by request.
Commands
| Command |
Description |
/settracker <name> <trigger> |
Start creating a tracker by naming it and choosing a trigger. You’ll have 15 seconds to right-click an appropriate block to bind it. |
/edittracker <name> … |
Change messages, colors, thumbnails and more. |
/trackerlist [page] |
Show all trackers with an interactive menu to quickly make simple changes to trackers (based on Husk Homes). |
/deltracker <name|all> |
Remove trackers. |
/chestnut <help|reload|status> |
Administrative actions. |
Trigger Reference
All triggers support basic tags like <name>, <trigger>, <event>, <world>, <x>, <y>, <z> and <time>.
Some triggers add extra tags listed below.
Note: <name> defaults to the tracker's given title; otherwise it uses the tracker's id name.
| Trigger |
Events |
Extra tags |
storage |
open, close |
<user>, <uuid>, <items> |
redstone_torch |
on, off |
<state> (lit or unlit) |
lectern |
insert_book, remove_book, page_change, open, close |
<user>, <uuid>, <page>, <book_title>, <book_author>, <book_pages>, <has_book> |
Example: Monitoring a Mailbox
Imagine a chest at spawn where players drop off items. You want a Discord alert
whenever it is opened.
-
Stand by the chest and type:
/settracker mailbox storage
After running the command, you’ll have 15 seconds to right-click the chest to bind it to the tracker.
-
Customize the messages sent via webhook:
/edittracker mailbox msg open "<user> checked the <name>!"
/edittracker mailbox msg close "<user> closed the <name>. Items: <items>"
-
Add some color and icons:
/edittracker mailbox color open #00FF00
/edittracker mailbox color close #FF0000
/edittracker mailbox thumbnail open https://example.com/open.png
/edittracker mailbox thumbnail close https://example.com/close.png
-
Try it out with a test event:
/edittracker mailbox test open
Now every time the chest is used, an embed will be posted to your webhook with
the configured title, description, color, and thumbnail.
Example: Fine-Tuning Event Messages
Say you’ve set up a tracker for a lectern in your library, but you only care about when books are inserted or removed, not every single page turn. Here’s how you could clean it up:
-
Create the tracker as usual, if you haven't already:
/settracker library_lectern lectern
- library_lectern = the name you give this tracker
- lectern = the type of block to track
-
Disable the events you don’t want:
/edittracker library_lectern msg --disable page_change
/edittracker library_lectern msg --disable open
/edittracker library_lectern msg --disable close
This tells Chestnut to ignore those events completely.
-
Revert a custom message back to default:
Maybe you experimented with a custom message for insert_book but decided you liked the default better:
/edittracker library_lectern msg --clear insert_book
-
Re-enable an event later:
If you change your mind and want page_change events again:
/edittracker library_lectern msg --enable page_change
-
Check your settings:
/edittracker library_lectern view
This shows which events are enabled/disabled and what messages they’ll send.
Pro Tip: Want to wipe the slate clean?
Use --clear all to instantly reset all events back to their default messages for that tracker.
Result: Your lectern tracker now only sends alerts when books are inserted or the page turned, keeping your Discord feed tidy while still tracking what matters.
Permissions
chestnut.use – Allows players to create and manage trackers.
chestnut.admin – Grants access to admin commands like reload.
Configuration
config.yml contains global settings such as the default embed color, webhook
URL, and rate limits.
FAQ
Q: Can I use this plugin on a server that already has a Discord bot?
Yes, absolutely. Chestnut works independently, it sends webhook messages directly to Discord. It doesn’t need to connect to or control an existing bot, so it won’t interfere with whatever your bot is doing.
Q: Does Chestnut only work with Discord?
Yes. Right now Chestnut sends webhook messages in a format designed for Discord. This could possibly be extended to other services in the future.
Q: Will it slow down my server if I track a lot of blocks?
Possibly. I haven’t stress-tested the limits yet, but like most plugins, tracking very large numbers of blocks could impact performance. It’s best to start small and scale up while monitoring your server’s TPS. Though you will more likely hit Discords rate limit before having performance issues.
Q: Can I send webhooks to multiple channels?
Not at this time. Chestnut supports a single webhook URL per server configuration. I would like to add support for multiple channels in the future.
Q: Why don’t my alerts look like the example screenshots?
Out of the box, Chestnut uses simple default messages without custom colors or thumbnails. The examples in the screenshots use customized settings configured with /edittracker commands.
Q: What happens if the block I’m tracking is destroyed or moved?
Chestnut tracks blocks by their exact position, not by what type of block is there. So if you break a tracked chest and replace it with a barrel (or anything else) in the same spot, the tracker will still be active and may respond to the new block. If a block is moved or removed entirely, the tracker will keep listening at that location until you delete or reassign it.
Q: Why does Chestnut let me target non-supported blocks like grass or ladders?
Because Chestnut only binds to the exact XYZ location of the block you right-click, it doesn’t really care what the block is. This means you can use any block, even ones that won’t actually trigger events, as a placeholder. For example, you could set a tracker on a temporary block, remove it later, and then place something else there for tracking without re-running the command.
Q: I found a bunch of bugs! ?
lol yeah… this is my first official attempt at making a plugin, and truthfuly first go at writing java/kotlin. I'm more of a python guy myself.
评论 0
登录后参与评分
还没有评论,来抢沙发吧