Skip to content

奖励与变量

奖励写在模板的 rewards 下。一个模板可以有多个奖励,按 r1r2r3 的顺序独立执行。

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: DROP

mode 常用值:

效果
INVENTORY直接进入背包
DROP掉落在采集点位置

物品库奖励

NeigeItems:

yaml
rewards:
  r1:
    id: "ni:ruby"
    amount: "1"
    mode: INVENTORY

MythicMobs:

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: INVENTORY

VIP 倍率:

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"

排查奖励

奖励没发:

  1. 开启 debug.log-reward
  2. 先用原版 DIAMOND 测试。
  3. 检查 ni:mm: 物品 ID 是否真实存在。
  4. 检查 condition 是否返回 true。
  5. 检查玩家背包是否满。

条件奖励不触发:

  1. 用 PAPI 测试命令看变量实际返回值。
  2. 字符串条件按实际返回值写。
  3. 复杂条件先拆成多条简单条件测试。

命令奖励不执行:

  1. 把命令单独放到控制台测试。
  2. 不要在命令前写 /
  3. 插件不支持控制台时改用 op:
  4. 确认 %player% 是否被正确替换。