跳到主要内容

Kether 动作

TreasuresLite 注册了一组 Kether 动作,可在 TabooLib Kether 脚本中使用,与宝箱系统交互。

动作列表

tsl-put

放置一个临时缓存宝箱到指定坐标,并立即更新该玩家的宝箱显示。

语法:

tsl-put {宝箱ID} {x} {y} {z}
tsl-put {宝箱ID} {x} {y} {z} face {朝向}

示例:

action: |-
tsl-put "def" 100 64 200 face "east"

放入的宝箱存储在玩家的临时缓存中,与 normal/random 坐标独立管理。

tsl-open

为当前玩家打开指定宝箱的领取 GUI。

语法:

tsl-open {宝箱ID}

示例:

action: |-
tsl-open "def"

tsl-cancel

取消当前的宝箱打开事件。只能在 events.open 脚本中使用,用于阻止宝箱被打开。

语法:

tsl-cancel

示例:

events:
open: |-
# 如果玩家等级不够,取消打开
if check player level < 10 then {
tell "等级不够,无法打开"
tsl-cancel
}

tsl-close

关闭当前玩家正在查看的宝箱 GUI。支持虚拟化界面和普通界面。

语法:

tsl-close

示例:

events:
open: |-
# 3 秒后自动关闭
wait 60
tsl-close

tsl-claim

一次性领取当前 GUI 中所有未领取的奖励物品。通常在 events.close 中使用,确保玩家关闭界面时自动领取剩余奖励。

语法:

tsl-claim

示例:

events:
close: |-
tsl-claim

事件脚本中的变量

变量可用事件说明
&amountclaim, generator actions领取的物品数量
&has_amountopen_key.deny玩家手持物品数量
&consumeopen_key.deny是否需要消耗钥匙
&chest-worldspawn宝箱所在世界
&chest-xspawn宝箱 X 坐标
&chest-yspawn宝箱 Y 坐标
&chest-zspawn宝箱 Z 坐标

自定义事件

插件提供以下 Bukkit 事件,可在其他插件中监听:

事件类触发时机可取消
TreasureOpenEvent玩家右键打开宝箱
TreasureSpawnEvent宝箱发包显示给玩家
TreasureDestroyEvent宝箱 GUI 关闭后销毁