一个基于 TabooLib 的新一代高性能 NBT 检测与清理插件,采用现代化 JSONPath 查询引擎,为您的服务器提供更安全、更灵活的物品管理体验。
命令 | 描述 | 权限 |
---|---|---|
/nbtp |
显示帮助信息 | nbtprohibition.command |
/nbtp reload |
重载配置文件 | nbtprohibition.command.reload |
/nbtp check |
检查手持物品的 NBT | nbtprohibition.command.check |
/nbtp stats |
显示查询引擎性能统计 | nbtprohibition.command.stats |
/nbtp cache |
清空查询缓存 | nbtprohibition.command.cache |
NBT Prohibition v2.0 采用全新的 JSONPath 查询引擎,提供统一、强大且直观的 NBT 匹配语法。
# 简单属性访问
$.Unbreakable # 访问根级 Unbreakable 属性
$.display.Name # 访问嵌套属性
$.display.Lore[0] # 访问数组第一个元素
$.ench[*].id # 访问数组所有元素的 id 属性
# 等于条件
$.ench[?(@.id == 'minecraft:sharpness')] # 查找锋利附魔
# 比较条件
$.ench[?(@.lvl > 5)] # 查找等级大于5的附魔
$.ench[?(@.lvl >= 3 && @.lvl <= 10)] # 查找等级在3-10之间的附魔
# 字符串匹配
$.display.Lore[?(@.contains '作弊')] # 查找包含"作弊"的lore
$.display.Name[?(@.matches '^§[a-f0-9].*')] # 正则匹配颜色代码
# 复合条件
$.ench[?(@.id == 'sharpness' && @.lvl > 5)] # 多条件组合
$.ench[?(@.id == 'sharpness' || @.id == 'fire_aspect')] # 或条件
# 包含点号的键名
$.\"SB.SEffect\".oracle # SkyBlock 插件的特殊键名
$.\"special[key]\" # 包含括号的键名
$.\"key\\\"with\\\"quotes\" # 包含引号的键名
$..Name # 递归查找所有 Name 属性
$..Name[?(@.contains 'ADMIN')] # 递归查找包含 ADMIN 的 Name
$..**[?(@.contains '违禁词')] # 深度搜索包含违禁词的任何值
# 数组切片
$.ench[0:3] # 前3个附魔
$.ench[1:] # 除第一个外的所有附魔
$.ench[-2:] # 最后2个附魔
# 嵌套数组
$.inventory.items[*].tag.ench[?(@.lvl > 3)] # 背包物品的高等级附魔
$.container[*].items[?(@.Count > 32)] # 容器中数量大于32的物品
# NBT Prohibition v2.0 配置示例
settings:
# 启用新查询引擎
enable-new-engine: true
# 大小写敏感匹配
case-sensitive: true
# 启用查询缓存
enable-cache: true
# 最大缓存大小
max-cache-size: 1000
nbt-rules:
# 基础属性移除
- query: "$.Unbreakable"
description: "移除无法破坏属性"
action: "remove"
# 条件过滤
- query: "$.ench[?(@.id == 'minecraft:sharpness' && @.lvl > 5)]"
description: "移除超高等级锋利附魔"
action: "remove"
on-remove:
- "tell <player> &c检测到超高等级锋利附魔,已移除"
# 字符串匹配
- query: "$.display.Lore[?(@.contains '作弊' || @.contains 'cheat')]"
description: "移除包含违禁词的描述"
action: "remove"
# 特殊字符键名
- query: "$.\"SB.SEffect\".oracle"
description: "移除SkyBlock特殊效果"
action: "remove"
# 递归搜索
- query: "$..Name[?(@.contains 'ADMIN' || @.contains 'OP')]"
description: "移除伪造的管理员标识"
action: "remove"
# 批量规则
batch-rules:
cheating-items:
description: "清理作弊物品"
queries:
- "$.ench[?(@.lvl > 10)]"
- "$.display.Lore[?(@.contains '作弊')]"
- "$.\"SB.SEffect\""
on-complete:
- "tell <player> &a作弊物品检查完成"
performance:
query-optimization:
compile-queries: true # 编译查询提升性能
query-timeout: 5000 # 查询超时时间(毫秒)
max-recursion-depth: 10 # 最大递归深度
cache:
result-ttl: 300 # 结果缓存TTL(秒)
parse-ttl: 600 # 解析缓存TTL(秒)
auto-cleanup: true # 自动清理过期缓存
插件提供自动迁移功能,无需手动转换配置:
为获得最佳性能,建议手动转换为新语法:
旧适配器类型 | 旧语法 | 新语法 |
---|---|---|
Simple | Unbreakable |
$.Unbreakable |
Simple | display.Name |
$.display.Name |
ArrayIndex | ench[0] |
$.ench[0] |
ArrayWildcard | ench[*] |
$.ench[*] |
ValueMatch | id:sharpness |
$.id[?(@ == 'sharpness')] |
ArrayIndexValue | ench[0]:sharpness |
$.ench[0][?(@ == 'sharpness')] |
特殊字符 | "SB.SEffect".oracle |
$.\"SB.SEffect\".oracle |
功能 | 旧适配器系统 | 新查询引擎 | 性能提升 |
---|---|---|---|
简单路径查询 | ~1.0ms | ~0.1ms | 10x |
条件过滤查询 | ~5.0ms | ~0.5ms | 10x |
批量查询 | ~10.0ms | ~1.0ms | 10x |
缓存命中查询 | 不支持 | ~0.01ms | 100x+ |
内存使用 | 基准 | -30% | 更优 |
# 运行性能基准测试
./gradlew test --tests NBTPerformanceBenchmark
# 编译验证
./gradlew compileKotlin
settings:
debug: true # 启用详细调试信息
/nbtp stats
查看性能统计/nbtp cache
管理查询缓存欢迎提交 Issue 和 Pull Request!
git clone https://github.com/your-repo/NBTProhibition.git
cd NBTProhibition
./gradlew build
本项目采用 MIT License 开源协议。
NBT Prohibition - 为您的 Minecraft 服务器提供最强大的 NBT 安全防护