Spyglass
Spyglass 记录方块、容器、聊天、命令、战斗和移动事件,允许你使用 key:value 语言查询它们,并支持按玩家、区域、原因或批量回滚任何操作 - 同时服务器保持 20 TPS。
三种存储后端:嵌入式 SQLite(零设置,默认)、MongoDB 和 ClickHouse。SQLite 让它像 CoreProtect 一样易于部署;当你需要更大容量时,可以使用更大的后端。
性能
2,000,376 方块回滚 - Paper 1.21.8,6 GB 堆内存,Aikar 标志:
|
SG SQLite |
SG MongoDB |
SG ClickHouse |
CP SQLite |
CP MySQL |
| 回滚 |
~3 秒 |
~7 秒 |
~5 秒 |
~11 秒 |
~12 秒 |
| 撤销/恢复 |
~3 秒 |
~6 秒 |
~4 秒 |
~9 秒 |
~210 秒 |
| TPS (最低/平均) |
20.0 / 20.0 |
20.0 / 20.0 |
20.0 / 20.0 |
14 / 19 |
13 / 20 |
| 最差的单个刻 |
~37 毫秒 |
~100 毫秒 |
~50 毫秒 |
~670 毫秒 |
~270 毫秒 |
| 磁盘占用 |
~156 MiB |
~145 MiB |
~11 MiB |
~160 MiB |
~180 MiB |
回滚完全在主线线程外运行。没有后端低于 20 TPS。
功能
仅 Spyglass
- 战斗日志 - 命中和投射物射击
- 移动和传送日志
- 命令日志中的密码脱敏
- 通过显示名称、描述或附魔搜索物品
- 通过可选的 Velocity 伴侣进行跨服务器搜索
- 扩展 API - 自定义事件、查询参数、显示渲染器、回滚效果
- 容器回收 - 回滚中被销毁的容器内的物品可通过
/sg inventory 恢复
- 一键撤销,任意大小,回溯你的历史记录
- 崩溃恢复 - 中断的回滚可以在重启后从保存的光标处恢复
- 回滚不生成新的日志行
- 自动数据修剪/可配置的 TTL
- 回滚完全在主线线程外运行
与 CoreProtect 共享
- 方块、实体和实体日志
- 聊天、命令、会话和 IP 日志
- 爆炸、火焰、液体和生长
- WorldEdit 捕获 - 所有操作,不仅仅是
//set
- 检查器魔杖和方块历史查找
- 按玩家、时间或区域回滚和恢复
仅 CoreProtect
要求
- Paper 1.21.8 或更新的 1.21.x(不支持 Spigot 或 Folia)
- Java 21
- 以下之一:SQLite(默认,零设置)、MongoDB 或 ClickHouse
- 可选: WorldEdit 7.3+ 或 FastAsyncWorldEdit 2.15+ 用于编辑捕获和
-we 区域查询
命令
根命令:/spyglass 或 /sg。所有权限默认为 op。
| 命令 |
别名 |
权限 |
/sg search <query> |
s, lookup |
spyglass.search |
/sg rollback <query> |
rb, roll |
spyglass.rollback |
/sg restore <query> |
rs |
spyglass.rollback |
/sg undo |
u |
spyglass.rollback |
/sg rbqueue |
queue, rbq |
spyglass.rollback |
/sg tool |
t, inspect |
spyglass.tool |
/sg inventory |
inv, salvage |
spyglass.rollback |
/sg events |
e |
spyglass.use |
/sg page <n> |
p, pg |
spyglass.use |
/sg help |
h, ? |
spyglass.use |
两个权限控制一个功能而不是一个命令:
spyglass.search.ip - 显示加入 IP 并解锁 ip: 查询键
spyglass.worldedit - 允许 -we 标志使用 WorldEdit 选择作为搜索区域
查询语言
搜索、回滚和恢复共享一个 key:value 语法。组合任意数量的键;在值前加上 ! 以排除它。
/sg search p:Steve b:diamond_ore t:1d r:50
/sg rollback p:griefer a:break,!place t:6h r:100
键
| 键 |
说明 |
p: |
玩家 - 逗号分隔表示 OR,p:!Steve 表示排除 |
a: |
事件类型 - 参见 /sg events;a:!place 表示排除 |
b: |
方块材料 - b:!chest 表示排除 |
i: |
物品材料 |
iname: |
物品显示名称(子字符串) |
ilore: |
物品描述行(子字符串) |
ench: |
附魔 - 例如 ench:sharpness=5 |
e: |
实体类型 |
c: |
原因 - 例如 c:tnt,!creeper |
m: |
聊天、告示牌或书籍文本(子字符串) |
r: |
半径(方块数) |
t: |
时间窗口 - t:1d, t:30m, t:1d12h(默认:4小时) |
w: |
世界名称 |
srv: |
服务器名称(多服务器) |
ip: |
来源 IP - 需要 spyglass.search.ip |
标志
| 标志 |
效果 |
-g |
全局 - 跳过默认半径 |
-we |
使用当前 WorldEdit 选择作为区域 |
-ord:asc / -ord:desc |
排序顺序 |
-ng |
不合并重复的相邻结果 |
-nc |
抑制聊天摘要行 |
-ex |
显示额外详细信息列 |
-nod:r,t |
删除默认值(无半径或时间限制运行) |
示例
# 谁在过去一天内破坏了这块方块?
/sg search b:* t:1d r:5
# 回滚玩家在过去两小时内所做的所有事情,全局范围。
/sg rollback p:Bob a:place,break t:2h -g
# TNT 破坏 - 玩家点燃的 TNT 归因于点火者。
/sg rollback p:griefer t:1h r:30
# 回滚除容器外的所有内容。
/sg rollback p:griefer t:6h r:100 b:!chest
# 谁捡起了名为 Excalibur 的剑?
/sg search a:pickup iname:Excalibur t:1w -g
# 追踪一把锋利 V 的物品通过掉落和拾取。
/sg search ench:sharpness=5 t:1d -g
# 特定 IP 今天运行的每个命令。
/sg search ip:1.2.3.4 a:command t:1d -g
# 恢复过去一小时内 WorldEdit 选择内的破坏。
//wand
/sg restore a:break t:1h -we
许可证
基于 PolyForm Internal Use License 1.0.0 的源码可用许可,并增加了 Minecraft 服务器的附加权限。您可以运行它并为自己的服务器分叉它,包括商业服务器。不允许重新分发、再许可和销售。
GitHub
Spyglass
Spyglass records block, container, chat, command, combat, and movement events, lets you query them with a key:value language, and rolls back any of it - by player, region, cause, or in bulk - while the server holds 20 TPS.
Three storage backends: embedded SQLite (zero setup, default), MongoDB, and ClickHouse. SQLite makes it as easy to drop in as CoreProtect; the larger backends are there when you outgrow it.
Performance
2,000,376-block rollback - Paper 1.21.8, 6 GB heap, Aikar flags:
|
SG SQLite |
SG MongoDB |
SG ClickHouse |
CP SQLite |
CP MySQL |
| Rollback |
~3 s |
~7 s |
~5 s |
~11 s |
~12 s |
| Undo / restore |
~3 s |
~6 s |
~4 s |
~9 s |
~210 s |
| TPS (min / avg) |
20.0 / 20.0 |
20.0 / 20.0 |
20.0 / 20.0 |
14 / 19 |
13 / 20 |
| Worst single tick |
~37 ms |
~100 ms |
~50 ms |
~670 ms |
~270 ms |
| On-disk footprint |
~156 MiB |
~145 MiB |
~11 MiB |
~160 MiB |
~180 MiB |
Rollback runs entirely off the main thread. No backend dips below 20 TPS.
Features
Spyglass only
- Combat logging - hits and projectile shots
- Movement and teleport logging
- Password redaction in command logs
- Item search by display name, lore, or enchantment
- Cross-server search via an optional Velocity companion
- Extension API - custom events, query params, display renderers, rollback effects
- Container salvage - items inside a rollback-destroyed container are recoverable via
/sg inventory
- One-command undo, any size, walks back through your history
- Crash-resume - an interrupted rollback is resumable from a saved cursor on restart
- Rollback emits no new log rows
- Automatic data pruning / configurable TTL
- Rollback runs fully off the main thread
Shared with CoreProtect
- Block, container, and entity logging
- Chat, command, session, and IP logging
- Explosions, fire, liquids, and growth
- WorldEdit capture - all operations, not just
//set
- Inspector wand and block history lookup
- Rollback and restore by player, time, or region
CoreProtect only
- Preview a rollback before applying
Requirements
- Paper 1.21.8 or newer 1.21.x (not Spigot or Folia)
- Java 21
- One of: SQLite (default, zero setup), MongoDB, or ClickHouse
- Optional: WorldEdit 7.3+ or FastAsyncWorldEdit 2.15+ for edit capture and
-we region queries
Commands
Root: /spyglass or /sg. All permissions default to op.
| Command |
Aliases |
Permission |
/sg search <query> |
s, lookup |
spyglass.search |
/sg rollback <query> |
rb, roll |
spyglass.rollback |
/sg restore <query> |
rs |
spyglass.rollback |
/sg undo |
u |
spyglass.rollback |
/sg rbqueue |
queue, rbq |
spyglass.rollback |
/sg tool |
t, inspect |
spyglass.tool |
/sg inventory |
inv, salvage |
spyglass.rollback |
/sg events |
e |
spyglass.use |
/sg page <n> |
p, pg |
spyglass.use |
/sg help |
h, ? |
spyglass.use |
Two permissions gate a feature rather than a command:
spyglass.search.ip - reveals join IPs and unlocks the ip: query key
spyglass.worldedit - allows the -we flag to use a WorldEdit selection as the search region
Query language
Search, rollback, and restore share one key:value syntax. Combine any number of keys; prefix a value with ! to exclude it.
/sg search p:Steve b:diamond_ore t:1d r:50
/sg rollback p:griefer a:break,!place t:6h r:100
Keys
| Key |
Notes |
p: |
Player(s) - comma-separated for OR, p:!Steve to exclude |
a: |
Event type - see /sg events; a:!place to exclude |
b: |
Block material - b:!chest to exclude |
i: |
Item material |
iname: |
Item display name (substring) |
ilore: |
Item lore line (substring) |
ench: |
Enchantment - e.g. ench:sharpness=5 |
e: |
Entity type |
c: |
Cause - e.g. c:tnt,!creeper |
m: |
Chat, sign, or book text (substring) |
r: |
Radius in blocks |
t: |
Time window - t:1d, t:30m, t:1d12h (default: 4h) |
w: |
World name |
srv: |
Server name (multi-server) |
ip: |
Source IP - requires spyglass.search.ip |
Flags
| Flag |
Effect |
-g |
Global - skip the default radius |
-we |
Use your active WorldEdit selection as the region |
-ord:asc / -ord:desc |
Sort order |
-ng |
Don't merge duplicate adjacent results |
-nc |
Suppress the chat summary line |
-ex |
Show extra detail columns |
-nod:r,t |
Drop defaults (run with no radius or time bound) |
Examples
# Who broke this block in the last day?
/sg search b:* t:1d r:5
# Roll back everything a player did in the last 2 hours, globally.
/sg rollback p:Bob a:place,break t:2h -g
# TNT grief - player-lit TNT is attributed to the igniter.
/sg rollback p:griefer t:1h r:30
# Roll back everything except containers.
/sg rollback p:griefer t:6h r:100 b:!chest
# Who picked up a sword named Excalibur?
/sg search a:pickup iname:Excalibur t:1w -g
# Track a sharpness V item through drops and pickups.
/sg search ench:sharpness=5 t:1d -g
# Every command a specific IP ran today.
/sg search ip:1.2.3.4 a:command t:1d -g
# Restore breaks inside a WorldEdit selection from the last hour.
//wand
/sg restore a:break t:1h -we
License
Source-available under the PolyForm Internal Use License 1.0.0, with an added permission for Minecraft servers. You may run it and fork it for your own servers, including commercial ones. Redistribution, sublicensing, and resale are not permitted.
GitHub
评论 0
登录后参与评分
还没有评论,来抢沙发吧