模板、等级、物品库与多货币
保存家园模板
获取模板工具:
text
/gtmw template wand左键选择第一点,右键选择第二点,然后保存:
text
/gtmw template save starter 基础家园也可以只输入 /gtmw template save,按输入框依次填写模板 ID 和显示名称。每次选点后聊天栏会显示坐标,便于确认选区是否正确。
确认后生成:
text
plugins/GTMyWorld/templates/starter.gtb保存成功后插件会自动在 templates.yml 新增或更新同名模板并写入显示名称。之后可继续调整图标、介绍、权限和创建消耗:
yaml
templates:
starter:
enabled: true
display-name: '&a基础家园'
icon: GRASS
description:
- '&7适合新玩家的基础家园'
permission: gtmyworld.template.starter
conditions: []
transaction:
cooldown-ms: 1500
precheck: []
consume: []
execute: []
rollback: []模板文件名、配置 ID 和创建命令中的 ID 必须一致。
家园等级
levels.yml 中最高配置等级就是最大等级:
yaml
levels:
'2':
diameter: 96
max-members: 5
core-health: 150.0
transaction:
cooldown-ms: 1500
precheck:
- '[hascurrency] money 1000'
consume:
- '[currency] money take 1000'
execute: []
rollback:
- '[currency] money give 1000'
actions:
- '[message] &a家园已升级到 2 级。'diameter 是完整直径。升级后边界、成员位和核心上限同步更新。
多货币
货币配置位于 currencies.yml。GTCore 已支持的经济直接填写 provider:
yaml
default: money
currencies:
money:
name: '金币'
provider: vault
points:
name: '点券'
provider: playerpoints任意其他经济可使用 PAPI 余额变量与命令动作:
yaml
custom-points:
name: '自定义点券'
balance-placeholder: '%playerpoints_points%'
take-actions:
- '[console] points take {player} {amount}'
give-actions:
- '[console] points give {player} {amount}'
set-actions:
- '[console] points set {player} {amount}'在创建、升级、核心燃料或赎回事务中使用:
yaml
precheck:
- '[hascurrency] points 100'
consume:
- '[currency] points take 100'
rollback:
- '[currency] points give 100'物品库
物品条件、扣除、返还和 GUI 图标使用 GTCore 统一物品 ID。常用写法:
| 来源 | 示例 |
|---|---|
| 原版物品 | DIAMOND |
| NeigeItems | ni:starter_sword |
| MythicMobs | mm:ExampleItem |
| ItemsAdder | 使用 GTCore 中对应物品 ID |
| Oraxen、SX-Item、MMOItems 等 | 使用 GTCore 中对应物品 ID |
事务示例:
yaml
precheck:
- '[hasitem] DIAMOND 16'
- '[hasitem] ni:starter_sword 1'
consume:
- '[takeitem] DIAMOND 16'
- '[takeitem] ni:starter_sword 1'
rollback:
- '[item] ni:starter_sword 1'
- '[item] DIAMOND 16'每个扣除动作都应在 rollback 中填写对应返还动作,创建或保存失败时才能退还资源。
