Appearance
主关卡配置
主关卡配置文件位于 plugins/AreaModule/level/ 目录下,每个 .yml 文件定义一个关卡。
完整配置示例
yaml
id: 野外区域
type: default
trigger:
type: move-prob
prob: 0.05
cooldown: 60
time-limit: 0
on-fail: |-
title color "&c&l挑战失败!" by 0 40 10
region:
type: cube
pos-A: [100, 60, 200]
pos-B: [200, 80, 300]
world: world
scores:
star: 10
coin:
max: 100
initial: 20
sub-levels:
野外区域第一关:
priority: 1
野外区域第二关:
priority: 2
野外区域第三关:
priority: 3字段说明
id
- 类型:
String - 必填:是
关卡的唯一标识符,不能重复。
type
- 类型:
String - 默认值:
default
关卡类型,任意字符串。可用于分类(如 economy、combat、buff),也可通过 PlaceholderAPI 的 %areamodule_type% 读取。
trigger
- 类型:配置节
- 必填:是
关卡的触发器配置,决定关卡何时自动启动。详见 触发器。
cooldown
- 类型:
Long(秒) - 默认值:
0
关卡冷却时间。上一次触发后,需要等待指定秒数才能再次触发。
time-limit
- 类型:
Long(秒) - 默认值:
0(不限时)
关卡限时。设为正数后,关卡启动后超过该时间会自动失败,触发 LevelFailEvent(原因为 TIMEOUT)。
on-fail
- 类型:
String(Kether 脚本) - 默认值:空
关卡失败时执行的 Kether 脚本。
region
- 类型:配置节
- 必填:是
关卡的生效区域。目前支持立方体区域:
yaml
region:
type: cube
pos-A: [x1, y1, z1]
pos-B: [x2, y2, z2]
world: world所有模块的坐标必须在此区域范围内,否则加载时会报错。
scores
- 类型:配置节
- 可选
关卡级别的全局分数变量。详见 分数系统。
sub-levels
- 类型:配置节
- 必填:是
子关卡列表。每个键是子关卡 ID(对应 sublevels/<关卡ID>/<子关卡ID>.yml),值中需要指定 priority。
yaml
sub-levels:
第一关:
priority: 1 # 数字越小越先执行
第二关:
priority: 2TIP
priority 决定了子关卡的执行顺序。数字越小,越先执行。
WARNING
每个关卡至少需要一个子关卡,否则启动时会返回 NoSubLevels 错误。