CraftAudit – 方块/实体审计日志与回滚工具 (Forge)
概述
CraftAudit 是一款面向 Minecraft Forge 的服务端审计模组/插件,用于记录由玩家和环境造成的世界变化(如方块放置/破坏、容器输入/输出、点燃、物品展示框/画作操作、水桶使用、击杀等)。它提供就地检查、区域查询、回滚/恢复和撤销功能,支持 SQLite 或 MySQL 存储。
特性
-
方块变化日志
- 玩家破坏/放置(可选 BlockState/NBT 快照)
- 环境破坏(natural_break):爆炸、流体、重力
-
交互日志
- 容器放入/取出(基于菜单会话,精确的方块位置)
- 告示牌编辑(记录文本)
- 点燃(营火/蜡烛/TNT/火)
- 红石交互:按钮/拉杆/门
- 物品展示框/画作:放入/取出/旋转/放置/破坏
- 水桶:装满/倒空/捕获/挤奶
- 击杀:记录击杀者、受害者、原因、投射物、武器、距离等
-
查询
- 在审计模式下,左键/右键点击方块以查看该位置的日志(分页显示)
- 区域+时间查询(
near 命令)
-
回滚/恢复/撤销
- 在一定半径和时间窗口内回滚玩家的放置/破坏操作(
rollback)
- 恢复所有破坏操作(玩家和环境),或按类型过滤(
restore)
- 恢复击杀:在日志位置重生非玩家实体(
restore ... kill)
- 撤销上一次的回滚/恢复操作(
undo):还原方块或移除生成的实体
-
存储
- SQLite(默认)或 MySQL 后端
- 可配置文件位置和 MySQL 参数
-
其他
- 物品/方块的本地化名称
- 审计模式豁免于日志记录(审计员的操作被忽略)
命令
所有 craftaudit 命令均有 /ca 别名。需要 OP 等级 2。
基本命令
/craftaudit status
显示数据库/模式状态
/craftaudit inspect 或 /ca i
切换审计模式(左键:方块日志,右键:交互日志)
/craftaudit log [page]
显示最后一次右键点击方块的交互日志(分页显示)
/craftaudit blocklog [page]
显示最后一次左键点击方块的方块日志(分页显示)
区域查询
/craftaudit near <radius> <time> [page]
搜索玩家附近的日志(按半径和时间)
- 时间格式:Ns/Nm/Nh/Nd(例如
30m、12h、5d)
回滚/恢复/撤销
/craftaudit rollback <player> <time> [radius=10]
在一定区域和时间范围内回滚玩家的放置/破坏操作
/craftaudit restore <time> [radius=10] [type]
恢复破坏或击杀,可选择按类型过滤:
- 无类型:所有破坏(玩家和环境)
break:仅玩家破坏
natural/natural_break:仅环境破坏
explosion/fluid/gravity:按原因分类的环境破坏
kill 或 kill:<entity_id>:恢复击杀(重生非玩家实体)
/craftaudit undo
撤销上一次的回滚/恢复操作(还原方块,移除生成的实体)
/craftaudit purge <time>
清除超过指定时间的旧日志(不可逆)
时间格式
安装
- 将模组 jar 文件放入 Forge 服务器的
mods 文件夹中
- 需要 Java 17(Forge 1.19+)
- 首次运行后生成配置文件
配置
- 数据库:
- SQLite:默认位于
gameDir/craftaudit/craftaudit.db
- MySQL:可配置主机、端口、数据库、用户、密码、SSL 及参数
数据与隐私
- 仅记录审计/回滚所需的关键事件、坐标、物品/方块/实体 ID
- 破坏时存储方块实体 NBT(压缩、大小限制、需手动开启)
- 定期使用
purge 清理旧日志
构建
- 需要 JDK 17 和 Forge MDK
- 典型步骤:导入 Gradle,同步依赖,构建 jar
贡献
许可证
采用 Creative Commons Attribution 4.0 International (CC BY 4.0) 许可
详见 LICENSE。
Copyright (c) 2025 CraftAudit contributors
CraftAudit – Block/Entity Audit Logger & Rollback Tool (Forge)
Overview
CraftAudit is a server-side audit mod/plugin for Minecraft Forge that records world changes made by players and the environment (block place/break, container I/O, ignition, item-frame/painting actions, bucket usage, kills, etc.). It provides in-place inspection, area queries, rollback/restore and undo features, supporting SQLite or MySQL storage.
Features
-
Block Change Logging
- Player break/place (with optional BlockState/NBT snapshots)
- Environment breaks (natural_break): explosion, fluid, gravity
-
Interaction Logging
- Container put/take (menu session-based, accurate block position)
- Sign editing (logs text)
- Ignition (campfire/candle/TNT/fire)
- Redstone interactions: button/lever/door
- Item frame/painting: put/take/rotate/place/break
- Bucket: fill/empty/catch/milk
- Kill: logs killer, victim, reason, projectile, weapon, distance, etc.
-
Query
- In audit mode, left/right-click a block to view logs for that position (paged)
- Area+time queries (
near command)
-
Rollback/Restore/Undo
- Rollback a player’s place/break within radius & time window (
rollback)
- Restore all breaks (player & environment) or filtered by type (
restore)
- Restore kills: respawn non-player entities at log positions (
restore ... kill)
- Undo last rollback/restore (
undo): revert blocks or remove spawned entities
-
Storage
- SQLite (default) or MySQL backend
- Configurable file location and MySQL parameters
-
Other
- Localized names for items/blocks
- Audit mode exempt from logging (auditor actions ignored)
Commands
All craftaudit commands have /ca alias. OP level 2 required.
Basic
/craftaudit status
Show database/mode status
/craftaudit inspect or /ca i
Toggle audit mode (left-click: block logs, right-click: interaction logs)
/craftaudit log [page]
Show interaction logs for last right-clicked block (paged)
/craftaudit blocklog [page]
Show block logs for last left-clicked block (paged)
Area Queries
/craftaudit near <radius> <time> [page]
Search logs near player (by radius & time)
- Time format: Ns/Nm/Nh/Nd (e.g.,
30m, 12h, 5d)
Rollback/Restore/Undo
/craftaudit rollback <player> <time> [radius=10]
Roll back a player’s place/break within area & time
/craftaudit restore <time> [radius=10] [type]
Restore breaks or kills, optionally filtered by type:
- No type: all breaks (player & environment)
break: only player breaks
natural/natural_break: only environment breaks
explosion/fluid/gravity: environment breaks by cause
kill or kill:<entity_id>: restore kills (respawn non-player entities)
/craftaudit undo
Undo last rollback/restore (revert blocks, remove spawned entities)
/craftaudit purge <time>
Purge logs older than time (irreversible)
Time Format
- Examples:
30s, 15m, 12h, 7d
Installation
- Place the mod jar in your Forge server’s
mods folder
- Requires Java 17 (Forge 1.19+)
- Config file is generated after first run
Configuration
- Database:
- SQLite: default at
gameDir/craftaudit/craftaudit.db
- MySQL: configurable host, port, database, user, password, SSL, params
Data & Privacy
- Only logs essential events, coordinates, item/block/entity IDs for audit/rollback
- BlockEntity NBT is stored (compressed, size-limited, opt-in) for BE blocks on break
- Use
purge regularly to clean up old logs
Build
- Requires JDK 17 and Forge MDK
- Typical steps: import Gradle, sync dependencies, build jar
Contributing
- Issues, PRs, and feature requests welcome
License
Licensed under Creative Commons Attribution 4.0 International (CC BY 4.0)
See LICENSE.
Copyright (c) 2025 CraftAudit contributors
评论 0
登录后参与评分
还没有评论,来抢沙发吧