Appearance
使用案例
本页提供几个完整的关卡配置案例,帮助你理解各模块和触发器的组合用法。
案例 1:跑酷关卡
玩家进入区域后自动触发,需要在限时内通过多个阶段,途中设有死亡陷阱和空气墙路障。
主关卡配置
plugins/AreaModule/level/跑酷挑战.yml
yaml
id: 跑酷挑战
type: parkour
trigger:
type: move-prob
prob: 1.0 # 进入即触发
min-distance: 0.3
cooldown: 30
time-limit: 120 # 限时 2 分钟
on-fail: |-
title color "&c&l挑战失败!" by 0 40 10
sound ENTITY_VILLAGER_NO by 1 1
region:
type: cube
pos-A: [100, 60, 200]
pos-B: [200, 90, 300]
world: world
sub-levels:
第一段:
priority: 1
第二段:
priority: 2
终点:
priority: 3子关卡:第一段
plugins/AreaModule/sublevels/跑酷挑战/第一段.yml
yaml
id: 第一段
on-start: |-
title color "&a&l第一段:越过障碍" by 0 20 10
sound BLOCK_NOTE_BLOCK_PLING by 1 2
on-exit: |-
tell color "&e第一段完成!继续前进!"
modules:
陷阱1:
type: deathtrap
pos-A: [110, 60, 220]
pos-B: [115, 61, 225]
on-death: |-
tell color "&c小心脚下的陷阱!"
陷阱2:
type: deathtrap
pos-A: [130, 60, 240]
pos-B: [135, 61, 245]
空气墙:
type: airwall
speed: 0.5
pos-A: [120, 60, 230]
pos-B: [122, 70, 235]
on-enter: |-
tell color "&7找找其他路线!"
到达检测:
type: singleaccess
pos-A: [140, 60, 250]
pos-B: [145, 65, 255]
on-enter: |-
areamodule:score add star by 1子关卡:第二段
plugins/AreaModule/sublevels/跑酷挑战/第二段.yml
yaml
id: 第二段
on-start: |-
title color "&6&l第二段:精准跳跃" by 0 20 10
modules:
陷阱区:
type: deathtrap
pos-A: [150, 60, 260]
pos-B: [180, 61, 280]
on-death: |-
tell color "&c掉下去了!"
提示地标:
type: landmark
hologram: parkour_guide
pos: [160, 68, 270]
到达检测:
type: singleaccess
pos-A: [185, 60, 285]
pos-B: [190, 65, 290]子关卡:终点
plugins/AreaModule/sublevels/跑酷挑战/终点.yml
yaml
id: 终点
on-start: |-
title color "&b&l最后冲刺!" by 0 20 10
modules:
终点检测:
type: singleaccess
pos-A: [195, 60, 295]
pos-B: [200, 65, 300]
on-enter: |-
title color "&a&l恭喜通关!" by 0 40 10
sound ENTITY_PLAYER_LEVELUP by 1 1
自动完成:
type: autoclose
time: 100案例 2:Boss 战关卡
击杀特定怪物后触发 Boss 战,分为清小怪和打 Boss 两个阶段,通过 killtrigger 和分数系统追踪进度。
主关卡配置
plugins/AreaModule/level/Boss战.yml
yaml
id: Boss战
type: combat
trigger:
type: kill-prob
prob: 0.3
mob-id: DarkSoldier
cooldown: 300
time-limit: 180
on-fail: |-
title color "&c&lBoss 战失败..." by 0 40 10
tell color "&7不要气馁,下次再来!"
region:
type: cube
pos-A: [0, 55, 0]
pos-B: [50, 80, 50]
world: world
scores:
kill:
max: 10
initial: 0
sub-levels:
清理小怪:
priority: 1
Boss阶段:
priority: 2子关卡:清理小怪
plugins/AreaModule/sublevels/Boss战/清理小怪.yml
yaml
id: 清理小怪
on-start: |-
title color "&c&l警告:敌人来袭!" by 0 20 10
actionbar color "&e击杀 10 只暗影士兵以召唤 Boss"
on-exit: |-
title color "&4&lBoss 即将降临!" by 0 40 10
sound ENTITY_ENDER_DRAGON_GROWL by 1 0.5
modules:
刷怪点A:
type: spawner
async: false
pos: [10, 56, 10]
period: 60
times: 5
distance: 20
random-x: 3
random-z: 3
mobs:
- mob: DarkSoldier
amount: 2
刷怪点B:
type: spawner
async: false
pos: [40, 56, 40]
period: 80
times: 4
distance: 20
mobs:
- mob: DarkSoldier
amount: 1
- mob: DarkArcher
amount: 1
击杀计数:
type: killtrigger
mob-type: DarkSoldier
on-kill: |-
areamodule:score add kill by 1
tell color "&a击杀进度: {{ areamodule:score progress kill }}"
Boss战提示:
type: message
message-type: BOSSBAR
message: "&c暗影入侵 &7- &e击杀进度: %areamodule_progress_kill%"子关卡:Boss 阶段
plugins/AreaModule/sublevels/Boss战/Boss阶段.yml
yaml
id: Boss阶段
on-start: |-
title color "&4&lBoss: 暗影领主" by 0 40 10
sound ENTITY_WITHER_SPAWN by 1 1
on-exit: |-
title color "&a&l胜利!暗影领主已被击败!" by 0 60 10
sound UI_TOAST_CHALLENGE_COMPLETE by 1 1
modules:
Boss刷怪:
type: spawner
async: false
pos: [25, 56, 25]
period: 1
times: 1
distance: 30
mobs:
- mob: ShadowLord
amount: 1
Boss击杀检测:
type: killtrigger
mob-type: ShadowLord
on-kill: |-
tell color "&6&lBoss 已击败!"
NPC奖励:
type: ady-npc
npc-name: "战场指挥官"
npc-type: VILLAGER
pos: [25, 56, 20]
script: |-
tell color "&6指挥官: 干得漂亮!这是你的奖励。"
Boss血条:
type: message
message-type: BOSSBAR
message: "&4暗影领主 &7- &c击败它!"案例 3:收集任务
在区域内探索并点击散落的收集点,收集够指定数量后通关。适合休闲探索类玩法。
主关卡配置
plugins/AreaModule/level/宝藏猎人.yml
yaml
id: 宝藏猎人
type: collect
trigger:
type: move-prob
prob: 0.5
min-distance: 0.3
cooldown: 60
time-limit: 0 # 不限时
region:
type: cube
pos-A: [-50, 60, -50]
pos-B: [50, 80, 50]
world: world
scores:
gem: 5 # 需要收集 5 颗宝石
sub-levels:
探索收集:
priority: 1
领取奖励:
priority: 2子关卡:探索收集
plugins/AreaModule/sublevels/宝藏猎人/探索收集.yml
yaml
id: 探索收集
on-start: |-
title color "&b&l宝藏猎人" by 0 40 10
tell color "&e在区域内找到 5 颗隐藏的宝石!"
tell color "&7提示: 右键点击发光的方块"
sound ENTITY_PLAYER_LEVELUP by 1 2
modules:
宝石1:
type: clickable
pos: [-30, 62, -20]
on-click: |-
areamodule:score add gem by 1
tell color "&a找到一颗宝石!进度: {{ areamodule:score progress gem }}"
sound ENTITY_EXPERIENCE_ORB_PICKUP by 1 1
宝石2:
type: clickable
pos: [10, 65, 30]
on-click: |-
areamodule:score add gem by 1
tell color "&a找到一颗宝石!进度: {{ areamodule:score progress gem }}"
sound ENTITY_EXPERIENCE_ORB_PICKUP by 1 1
宝石3:
type: clickable
pos: [40, 63, -10]
on-click: |-
areamodule:score add gem by 1
tell color "&a找到一颗宝石!进度: {{ areamodule:score progress gem }}"
sound ENTITY_EXPERIENCE_ORB_PICKUP by 1 1
宝石4:
type: clickable
pos: [-15, 68, 40]
on-click: |-
areamodule:score add gem by 1
tell color "&a找到一颗宝石!进度: {{ areamodule:score progress gem }}"
sound ENTITY_EXPERIENCE_ORB_PICKUP by 1 1
宝石5:
type: clickable
pos: [25, 61, -35]
on-click: |-
areamodule:score add gem by 1
tell color "&a找到一颗宝石!进度: {{ areamodule:score progress gem }}"
sound ENTITY_EXPERIENCE_ORB_PICKUP by 1 1
提示地标:
type: landmark
hologram: gem_guide
pos: [0, 70, 0]
进度提示:
type: message
message-type: ACTIONBAR
message: "&b宝石收集进度: %areamodule_progress_gem%"子关卡:领取奖励
plugins/AreaModule/sublevels/宝藏猎人/领取奖励.yml
yaml
id: 领取奖励
on-start: |-
title color "&a&l全部找到!" by 0 20 10
tell color "&6前往中心点领取你的奖励"
modules:
奖励NPC:
type: ady-npc
npc-name: "藏宝人"
npc-type: VILLAGER
pos: [0, 62, 0]
script: |-
tell color "&6藏宝人: 厉害!你找到了所有宝石,这是你的奖励!"
自动完成:
type: autoclose
time: 200案例 4:多人协作关卡
需要 5 名玩家同时在场才能触发,利用按压方块和区域检测设计需要配合的机制。
主关卡配置
plugins/AreaModule/level/团队试炼.yml
yaml
id: 团队试炼
type: team
trigger:
type: player-count
prob: 1.0
required-players: 5
cooldown: 600
time-limit: 300
on-fail: |-
title color "&c&l试炼失败!" by 0 40 10
tell color "&7需要团队更好的配合!"
region:
type: cube
pos-A: [300, 50, 300]
pos-B: [380, 80, 380]
world: world
scores:
switch:
max: 3
initial: 0
sub-levels:
协力开关:
priority: 1
最终挑战:
priority: 2子关卡:协力开关
plugins/AreaModule/sublevels/团队试炼/协力开关.yml
yaml
id: 协力开关
on-start: |-
title color "&d&l团队试炼开始!" by 0 40 10
tell color "&e找到并按压 3 个开关来打开大门"
tell color "&7每个开关需要按住 3 秒"
on-exit: |-
title color "&a&l大门已打开!" by 0 20 10
sound BLOCK_IRON_DOOR_OPEN by 1 1
modules:
开关A:
type: pressable
pos: [310, 55, 310]
time: 60
on-click: |-
areamodule:score add switch by 1
tell color "&a开关A已激活!进度: {{ areamodule:score progress switch }}"
sound BLOCK_STONE_BUTTON_CLICK_ON by 1 1
开关B:
type: pressable
pos: [350, 55, 350]
time: 60
on-click: |-
areamodule:score add switch by 1
tell color "&a开关B已激活!进度: {{ areamodule:score progress switch }}"
sound BLOCK_STONE_BUTTON_CLICK_ON by 1 1
开关C:
type: pressable
pos: [370, 55, 320]
time: 60
on-click: |-
areamodule:score add switch by 1
tell color "&a开关C已激活!进度: {{ areamodule:score progress switch }}"
sound BLOCK_STONE_BUTTON_CLICK_ON by 1 1
空气墙门:
type: airwall
speed: 0.4
pos-A: [338, 50, 338]
pos-B: [342, 60, 342]
on-enter: |-
tell color "&7大门还没有打开,需要激活所有开关!"
状态提示:
type: message
message-type: BOSSBAR
message: "&d团队试炼 &7- &e开关进度: %areamodule_progress_switch%"子关卡:最终挑战
plugins/AreaModule/sublevels/团队试炼/最终挑战.yml
yaml
id: 最终挑战
on-start: |-
title color "&c&l最终挑战:团灭守卫!" by 0 40 10
on-exit: |-
title color "&a&l团队试炼通过!" by 0 60 10
sound UI_TOAST_CHALLENGE_COMPLETE by 1 1
modules:
守卫刷怪:
type: spawner
async: false
pos: [340, 55, 340]
period: 100
times: 3
distance: 25
random-x: 5
random-z: 5
mobs:
- mob: TrialGuardian
amount: 3
- mob: TrialMage
amount: 2
守卫击杀:
type: killtrigger
mob-type: TrialGuardian
on-kill: |-
tell color "&a击败了一个守卫!"
延迟完成:
type: delay-executor
time: 200
script: |-
tell color "&6试炼即将结束..."
自动完成:
type: autoclose
time: 400案例 5:经济触发的奇遇
玩家身上金币达到一定数量后,在特定区域行走有概率触发隐藏关卡。
主关卡配置
plugins/AreaModule/level/商人奇遇.yml
yaml
id: 商人奇遇
type: economy
trigger:
type: money-prob
prob: 0.1
min-money: 5000
cooldown: 1800
time-limit: 0
region:
type: cube
pos-A: [500, 60, 500]
pos-B: [530, 75, 530]
world: world
sub-levels:
神秘商人:
priority: 1子关卡:神秘商人
plugins/AreaModule/sublevels/商人奇遇/神秘商人.yml
yaml
id: 神秘商人
on-start: |-
title color "&6&l✦ 神秘商人出现了!" by 0 40 10
sound ENTITY_ENDERMAN_TELEPORT by 1 1
tell color "&6一位神秘的商人出现在附近,快去和他交谈!"
on-exit: |-
tell color "&7神秘商人消失在了迷雾中..."
modules:
神秘商人NPC:
type: ady-npc
npc-name: "&6神秘商人"
npc-type: VILLAGER
pos: [515, 62, 515]
script: |-
tell color "&6神秘商人: 你好呀,有钱人!看看我的珍藏吧..."
进入提示:
type: accessible
pos-A: [510, 60, 510]
pos-B: [520, 70, 520]
on-enter: |-
actionbar color "&6你感觉到附近有一股神秘的气息..."
限时完成:
type: autoclose
time: 600案例 6:Chemdah 任务联动
将关卡的进度与 Chemdah 任务系统同步,实现多人协作完成任务的效果。关卡启动时自动为区域内所有玩家接受任务,完成后为所有参与者标记任务完成。
前置条件
- 服务器已安装 Chemdah 插件
- 已在 Chemdah 中创建了对应的任务模板(Quest Template)
主关卡配置
plugins/AreaModule/level/遗迹探索.yml
yaml
id: 遗迹探索
type: adventure
trigger:
type: player-count
prob: 1.0
required-players: 2
cooldown: 600
time-limit: 300
on-fail: |-
title color "&c&l探索失败!" by 0 40 10
region:
type: cube
pos-A: [400, 50, 400]
pos-B: [480, 80, 480]
world: world
scores:
relic:
max: 3
initial: 0
# Chemdah 任务联动配置
chemdah:
quest: "ruin_exploration" # Chemdah 任务模板 ID
task: "collect_relics" # 任务条目 ID(可选,不填取第一个)
sync-scores: # 分数同步映射
relic: "relic_count" # AreaModule 的 relic 分数 → Chemdah 的 relic_count 数据节点
on-start: accept # 关卡启动时为所有参与者接受任务
on-finish: complete # 关卡完成时为所有参与者完成任务
on-fail: restart # 关卡失败时重置任务进度
sub-levels:
收集遗物:
priority: 1
离开遗迹:
priority: 2子关卡:收集遗物
plugins/AreaModule/sublevels/遗迹探索/收集遗物.yml
yaml
id: 收集遗物
on-start: |-
title color "&6&l遗迹探索" by 0 40 10
tell color "&e和队友一起找到 3 件远古遗物!"
on-exit: |-
title color "&a&l所有遗物已找到!" by 0 20 10
modules:
遗物A:
type: clickable
pos: [420, 55, 420]
on-click: |-
areamodule:score add relic by 1
tell color "&a找到一件遗物!进度: {{ areamodule:score progress relic }}"
areamodule:chemdah sync
遗物B:
type: clickable
pos: [450, 58, 440]
on-click: |-
areamodule:score add relic by 1
tell color "&a找到一件遗物!进度: {{ areamodule:score progress relic }}"
areamodule:chemdah sync
遗物C:
type: clickable
pos: [470, 53, 460]
on-click: |-
areamodule:score add relic by 1
tell color "&a找到一件遗物!进度: {{ areamodule:score progress relic }}"
areamodule:chemdah sync
进度提示:
type: message
message-type: BOSSBAR
message: "&6遗迹探索 &7- &e遗物进度: %areamodule_progress_relic%"子关卡:离开遗迹
plugins/AreaModule/sublevels/遗迹探索/离开遗迹.yml
yaml
id: 离开遗迹
on-start: |-
title color "&a&l遗迹正在崩塌!快撤离!" by 0 40 10
sound ENTITY_ENDER_DRAGON_GROWL by 1 0.5
on-exit: |-
title color "&a&l探索完成!" by 0 60 10
sound UI_TOAST_CHALLENGE_COMPLETE by 1 1
modules:
出口检测:
type: singleaccess
pos-A: [400, 50, 400]
pos-B: [405, 55, 405]
on-enter: |-
tell color "&a你成功逃离了遗迹!"
自动完成:
type: autoclose
time: 200工作流程说明
- 2 名玩家进入区域 →
player-count触发器激活关卡 - 关卡启动 →
on-start: accept为所有区域内玩家接受 Chemdah 任务ruin_exploration - 收集遗物 → 每次收集后调用
chemdah sync将relic分数同步到 Chemdah 的relic_count节点 - 全部收集完成 →
on-finish: complete为所有参与者完成 Chemdah 任务 - 若超时失败 →
on-fail: restart重置参与者的任务进度
Chemdah 侧任务模板示例
plugins/Chemdah/core/quest/ruin_exploration.yml
yaml
ruin_exploration:
task:
collect_relics:
objective:
type: custom # 由 AreaModule 通过 API 驱动进度
goal:
- "relic_count >= 3"案例 7:在脚本中配合 Chemdah 使用
除了通过配置文件声明式联动,你也可以在 Kether 脚本中配合 Chemdah 自带的语句使用。
在 on-kill 中同步分数并操作 Chemdah 数据
yaml
on-kill: |-
areamodule:score add kill by 1
areamodule:chemdah sync
tell color "&e击杀进度 +1"在 on-exit 中同步分数并完成任务
yaml
on-exit: |-
areamodule:chemdah sync
quest select "my_quest"
quest complete
title color "&a&l任务完成!" by 0 40 10TIP
areamodule:chemdah sync 是 AreaModule 提供的语句,用于将关卡分数同步到 Chemdah。 quest select、quest accept、quest complete、quest data 等是 Chemdah 自带的语句,可以直接在 AreaModule 的脚本中使用。