Skip to content

世界类动作

world_time

设置副本世界的时间。

javascript
action.world_time(时间)
参数类型说明
时间Stringday / night / noon / midnight,或 tick 值,或 HH:MM 格式
javascript
action.world_time('night')
action.time('18:00')

别名:time

weather

设置副本世界的天气。

javascript
action.weather(天气类型)
action.weather(天气类型, 持续时间)
参数类型说明
天气类型Stringclear / rain / storm / thunder
持续时间String可选,如 5min
javascript
action.weather('storm')

setblock

设置指定位置的方块类型。

javascript
action.setblock(位置, 方块类型)
action.setblock(位置, 方块类型, 数据=BlockData)
参数类型说明
位置String坐标 x,y,z
方块类型StringBukkit Material 名称
数据String可选,BlockData 字符串(1.13+)
javascript
action.setblock('10,64,10', 'STONE')
action.setblock('10,64,10', 'OAK_DOOR', 'data=facing=north,half=lower')

explosion

在指定位置生成爆炸。

javascript
action.explosion(位置, 威力)
action.explosion(位置, 威力, 火焰=bool, 破坏=bool)
参数类型说明
位置String坐标 x,y,z
威力Float爆炸威力,默认 2.0
火焰Boolean是否产生火焰,默认 false
破坏Boolean是否破坏方块,默认 false
javascript
action.explosion('10,64,10', 4)

别名:explode

gamerule

设置副本世界的 GameRule,仅影响当前副本世界。

javascript
action.gamerule(规则名, 值)
参数类型说明
规则名StringBukkit GameRule 名称
Stringtrue / false 或整数
javascript
action.gamerule('keepInventory', 'true')
action.gamerule('doDaylightCycle', 'false')

常用规则:keepInventorydoMobSpawningdoDaylightCycledoWeatherCyclemobGriefingnaturalRegeneration

别名:set_gamerule

基于 MIT 许可发布