主配置 config.yml
plugins/GTGem/config.yml 控制宝石识别、槽位识别、默认成功率、消耗、拆卸、属性写入、Lore 展示和提示消息。
修改后执行:
text
/gtgem reload如果改了属性插件读取方式或 NBT 字段路径,建议重启服务器后再测试。
prefix 识别前缀
yaml
prefix:
gem: "§宝§石"
socket: "§孔§位"prefix 用于识别物品是否是 GTGem 宝石或槽位物品。
如果服务器已有物品系统中使用了固定标记,可以把这里改成对应标记。
| 字段 | 作用 |
|---|---|
gem | 宝石识别标记 |
socket | 槽位识别标记 |
一般不需要修改。只有迁移旧物品、兼容其他物品库标记时才改。
field-mapping NBT 字段路径
yaml
field-mapping:
gem-type: "gtgem"
equipment-sockets: "gtgem.sockets"| 字段 | 作用 |
|---|---|
gem-type | 宝石 NBT 根路径 |
equipment-sockets | 装备槽位 NBT 路径 |
宝石 NBT 示例:
yaml
gtgem:
type: gem
name: "力量宝石"
socket: "red"装备槽位 NBT 示例:
yaml
gtgem:
sockets:
red_1:
type: red
name: "红色槽位"如果改了 field-mapping,所有宝石和装备的 NBT 都要跟着改。
defaults 默认规则
yaml
defaults:
chance: 1.0
cost:
money: 0
exp: 0| 字段 | 作用 |
|---|---|
chance | 宝石未单独设置成功率时使用 |
cost.money | 默认金币消耗 |
cost.exp | 默认经验消耗 |
成功率使用 0.0 ~ 1.0:
text
1.0 = 100%
0.8 = 80%
0.5 = 50%全服默认 80% 成功,消耗 100 金币:
yaml
defaults:
chance: 0.8
cost:
money: 100
exp: 0宝石 NBT 中单独写了规则时,会优先使用宝石自己的规则。
consume-on-fail 失败消耗
yaml
consume-on-fail: true| 值 | 效果 |
|---|---|
true | 镶嵌失败后宝石消失 |
false | 镶嵌失败后宝石返还 |
高价值宝石可在宝石自身规则中单独控制,普通服务器可以用全局配置统一处理。
attribute 属性写入
yaml
attribute:
write-to-nbt: true
tag: "GTGemAttr"GTGem 可以把已镶嵌宝石提供的属性汇总写入装备 NBT,供 CraneAttribute 等属性插件读取。
| 字段 | 作用 |
|---|---|
write-to-nbt | 是否把宝石属性写入装备 NBT |
tag | 写入的 NBT 标签名 |
CraneAttribute 需要在读取配置中加入这个 tag,例如在 CA 的 read.yml 中把 GTGemAttr 加入 NBT tag 读取列表。
如果装备镶嵌成功但属性插件没有读取到属性,优先检查:
attribute.write-to-nbt是否为true。- 装备 NBT 中是否出现
GTGemAttr。 - 属性插件是否配置读取该 NBT tag。
remove 拆卸设置
yaml
remove:
use-global: false
require-cost: false
cost-money: 50
cost-exp: 10
global-rules:
conditions: []
cost-items: []
cost-money: 0
cost-exp: 0| 字段 | 作用 |
|---|---|
use-global | 是否强制使用全局拆卸规则 |
require-cost | 宝石没有拆卸规则时,是否使用兼容消耗 |
cost-money | 兼容金币消耗 |
cost-exp | 兼容经验消耗 |
global-rules | 全局拆卸规则 |
统一拆卸收费:
yaml
remove:
use-global: true
global-rules:
conditions: []
cost-items: []
cost-money: 500
cost-exp: 30按宝石单独设置拆卸规则:
yaml
remove:
use-global: falsedebug 调试
yaml
debug: false排查宝石识别、条件、消耗、属性写入时可以临时打开:
yaml
debug: true测试完成后关闭,避免控制台输出过多。
lore-template 槽位展示
yaml
lore-template:
socket-empty: "&7[ &c空槽位 &7<&e{type}&7> ]"
socket-filled: "&7[ &a已镶嵌 &7<&b{gem}&7> ]"
socket-display:
- "&7&m------ 镶嵌槽位 ------"| 字段 | 作用 |
|---|---|
socket-empty | 空槽位显示 |
socket-filled | 已镶嵌槽位显示 |
socket-display | 槽位区域标题 |
常用变量:
text
{type} 槽位类型
{gem} 宝石名称示例效果:
text
------ 镶嵌槽位 ------
[ 空槽位 <red> ]
[ 已镶嵌 <力量宝石> ]conditions-info 条件展示
yaml
conditions-info:
- "&7&m------ 镶嵌条件 ------"
- "{status} &f{condition}"
- "&7&m--------------------"| 变量 | 说明 |
|---|---|
{condition} | 原始条件表达式 |
{status} | 条件是否满足 |
这个配置只影响 GUI 或 Lore 中给玩家看的条件展示,不改变实际判定逻辑。
messages 提示消息
yaml
messages:
money-insufficient: "&c金币不足!需要 {money} 金币"
exp-insufficient: "&c经验不足!需要 {exp} 经验"
embed-success: "&a宝石镶嵌成功!"
embed-fail: "&c镶嵌失败!宝石已损坏。"
embed-fail-return: "&c镶嵌失败!宝石已返还。"
condition-not-met: "&c条件未满足,无法镶嵌!"
remove-success: "&a宝石拆卸成功!"
remove-fail: "&c拆卸失败!"
socket-occupied: "&c该槽位已有宝石"
gem-incompatible: "&c宝石与槽位类型不匹配"
invalid-gem: "&c无效的宝石"
invalid-socket: "&c无效的槽位"常用变量:
text
{money}
{exp}如果要保持玩家端提示统一,可以只改消息文本,不改规则配置。
常用配置方案
方案一:基础稳定版
yaml
defaults:
chance: 1.0
cost:
money: 0
exp: 0
consume-on-fail: false
attribute:
write-to-nbt: true
tag: "GTGemAttr"适合开服初期测试,所有宝石默认必定成功,失败不消耗。
方案二:正式经济版
yaml
defaults:
chance: 0.8
cost:
money: 500
exp: 20
consume-on-fail: true
attribute:
write-to-nbt: true
tag: "GTGemAttr"适合正式环境:80% 成功,失败消耗宝石,有金币和经验成本。
验证流程
- 准备一件带
gtgem.sockets的装备。 - 准备一颗带
gtgem.type: gem的宝石。 - 执行:
text
/gtgem open- 放入装备和宝石。
- 点击镶嵌。
- 使用
/gtgem debug item检查镶嵌后的装备 NBT。 - 如果接入属性插件,查看属性是否生效。
