礼物
/sf gift Steve rose
从你背包扣一朵虞美人,你和 Steve 的亲密度加 10,不受每日上限。只写 /sf gift 会列出全部礼物与价格;云界面点「送礼」从列表选。
写法
gifts:
rose:
name: 玫瑰
intimacy: 10
cost: {item: 'minecraft:poppy', amount: 1}
receiver-commands: []
gold:
name: 心意金币
intimacy: 20
cost: {money: 100}
receiver-commands: []
| 键 | 说明 |
|---|---|
| id(段名) | /sf gift 用的代号 |
name | 显示名称 |
intimacy | 送一次增加多少亲密度 |
cost | 二选一:{item: '物品ID', amount: 数量} 从背包扣物品;{money: 金额} 扣 Vault 金币(需要 Vault 与经济插件) |
receiver-commands | 对方收到时由后台执行的指令,可用 {sender}(送礼的人)与 {receiver}(收礼的人) |
默认的四种礼物是玫瑰(虞美人 ×1,+10)、蛋糕(蛋糕 ×1,+30)、钻石(钻石 ×1,+60)与心意金币(100 金币,+20)。改完 /sf reload。
让对方真的收到东西
receiver-commands 在收礼人所在的子服执行:
gifts:
rose:
name: 玫瑰
intimacy: 10
cost: {item: 'minecraft:poppy', amount: 1}
receiver-commands:
- 'give {receiver} minecraft:poppy 1'
写了指令的礼物只能送给在线的好友,显示离线、隐身的好友送不出去,东西也不会扣。没有指令的礼物,好友离线也能送,亲密度照样增加。完整例子见 做一个会给对方奖励的礼物。
扣物品的规则
只算背包里的普通物品,改过名字的同种物品不算,避免把有名字的装备当礼物送掉。
扣了钱没送成
写入数据库失败时,扣掉的物品或金币会退回。金币退回被经济插件拒绝时(账户冻结、超过上限等),记在 plugins/StarFriend/owed-money.yml,玩家上线时与每 5 分钟自动补发,补发成功会提示玩家。
会踩的坑
cost 没写 money 也没写 item,或者物品 ID 不存在时,这个礼物会被略过,后台说明原因。intimacy.enabled: false 时不能送礼。