奖励与变量
奖励写在模板的 rewards 下。一个模板可以有多个奖励,按 r1、r2、r3 的顺序独立执行。
yaml
rewards:
r1:
id: DIAMOND
amount: "1"
mode: INVENTORY
r2:
command:
- "console:xp give %player% 5"原版物品奖励
直接写 Material:
yaml
rewards:
r1:
id: DIAMOND
amount: "1"
mode: INVENTORY效果:采集后给玩家 1 个钻石。
掉落到地上:
yaml
rewards:
r1:
id: RAW_IRON
amount: "3"
mode: DROPmode 常用值:
| 值 | 效果 |
|---|---|
INVENTORY | 直接进入背包 |
DROP | 掉落在采集点位置 |
物品库奖励
NeigeItems:
yaml
rewards:
r1:
id: "ni:ruby"
amount: "1"
mode: INVENTORYMythicMobs:
yaml
rewards:
r1:
id: "mm:LEGEND_SWORD"
amount: "1"
mode: DROP写法规则:
| 前缀 | 内容 |
|---|---|
| 无前缀 | 原版 Material |
ni: | NeigeItems 物品 |
mm: | MythicMobs 物品 |
命令奖励
yaml
rewards:
r1:
command:
- "console:eco give %player% 100"
- "console:xp give %player% 5"
- "player:me 完成了一次采集"命令身份:
| 前缀 | 执行方式 |
|---|---|
console: | 控制台执行 |
player: | 玩家自己执行 |
op: | 玩家临时 OP 执行 |
有些插件不支持控制台执行指令,可以用 op::
yaml
command:
- "op:someplugin reward %player%"命令奖励提示
命令奖励可以自定义提示:
yaml
rewards:
r1:
command:
- "console:eco give %player% 100"
message:
- "&a采集成功"
- "&7获得金币:&e100"如果不写 message,会使用主配置里的默认奖励提示。
数量公式
amount 支持数字、PAPI 和算术表达式。
等级越高给得越多:
yaml
rewards:
r1:
id: DIAMOND
amount: "1 + %player_level% / 10"
mode: INVENTORY活动倍率:
yaml
rewards:
r1:
id: RAW_IRON
amount: "2 * %server_gt_event_rate%"
mode: INVENTORYVIP 倍率:
yaml
rewards:
r1:
id: EMERALD
amount: "1 + %vault_rank_weight%"
mode: INVENTORY变量返回值必须能转成数字。变量为空或不是数字时,先用 PAPI 测试命令确认返回值。
条件奖励
每个 reward 都可以单独写 condition。没有写 condition 的奖励会一直执行。
职业奖励:
yaml
rewards:
r1:
id: "ni:warrior_sword"
amount: "1"
condition: "%player_class% == WARRIOR"
r2:
id: "ni:apprentice_wand"
amount: "1"
condition: "%player_class% == MAGE"
r3:
id: STICK
amount: "1"效果:
- 战士获得
ni:warrior_sword。 - 法师获得
ni:apprentice_wand。 - 所有人都会额外获得 1 根木棍。
复杂条件
支持 &&、||、! 和括号:
yaml
condition: "(%player_class% == WARRIOR || %player_class% == MAGE) && %player_level% >= 30"只允许主世界:
yaml
condition: "%player_world% == world"只允许拥有权限变量的玩家:
yaml
condition: "%player_has_permission_gtgather.vip% == 1"采集条件和奖励条件的区别
| 位置 | 作用 |
|---|---|
triggers | 决定玩家能不能开始采集 |
rewards.*.condition | 决定某条奖励是否发放 |
例子:所有人都能采集,但 VIP 多拿 1 个钻石:
yaml
rewards:
normal:
id: DIAMOND
amount: "1"
vip:
id: DIAMOND
amount: "1"
condition: "%player_has_permission_gtgather.vip% == 1"常用变量
玩家变量
text
%player_name%
%player_level%
%player_world%
%player_x%
%player_y%
%player_z%冷却变量
text
%gtgather_cooldown%
%gtgather_cooldown_<spawnId>%
%gtgather_cooldown_raw_<spawnId>%
%gtgather_cooldown_tpl_<templateId>%冷却变量适合写在菜单、计分板、提示文字里。
完整示例:职业奖励点
yaml
templates:
branched_reward:
display: "§6§l职业奖励点"
entity-type: TEXT_DISPLAY
description:
- "§6战士: 剑"
- "§b法师: 法杖"
- "§7其他: 通用奖励"
rewards:
warrior:
id: "ni:warrior_sword"
amount: "1"
mode: INVENTORY
condition: "%player_class% == WARRIOR"
mage:
id: "ni:apprentice_wand"
amount: "1"
mode: INVENTORY
condition: "%player_class% == MAGE"
common:
id: STICK
amount: "1"
mode: INVENTORY
money:
command:
- "console:eco give %player% 100"
message:
- "&a采集完成"
- "&7金币:&e100"完整示例:等级缩放矿
yaml
templates:
level_scaled:
display: "§a§l等级缩放矿"
entity-type: ARMOR_STAND
display-item: DIAMOND_ORE
description:
- "§7等级越高,奖励越多"
cast:
enabled: true
duration: "3.0"
cooldown: "20s"
rewards:
r1:
id: DIAMOND
amount: "1 + %player_level% / 10"
mode: INVENTORY
r2:
command:
- "console:xp give %player% 5"排查奖励
奖励没发:
- 开启
debug.log-reward。 - 先用原版
DIAMOND测试。 - 检查
ni:、mm:物品 ID 是否真实存在。 - 检查
condition是否返回 true。 - 检查玩家背包是否满。
条件奖励不触发:
- 用 PAPI 测试命令看变量实际返回值。
- 字符串条件按实际返回值写。
- 复杂条件先拆成多条简单条件测试。
命令奖励不执行:
- 把命令单独放到控制台测试。
- 不要在命令前写
/。 - 插件不支持控制台时改用
op:。 - 确认
%player%是否被正确替换。
