创建事件
本指南适用于 EliteMobs 10 及更高版本
什么是自定义事件?
这里所说的自定义事件指的是在游戏中随机发生的事件,无论是基于玩家行为还是采用定时触发。插件预装了若干自定义事件,举几个例子,比如炎魔(Balrog)事件、海妖(Kraken)事件和宝藏哥布林(Treasure Goblin)事件。
之所以称这个系统为 自定义 事件,是因为这些事件不仅可以被自定义,还可以从零开始创建。下面是一份关于如何创建和自定义你自己的事件的指南。
创建你的自定义事件
自定义事件配置文件应创建在:
plugins/EliteMobs/customevents/
文件必须使用 .yml 格式。文件名(不含 .yml 扩展名)即成为事件的标识符。
示例:my_cool_event.yml 被引用为 my_cool_event
通用配置设置
以下设置可以 / 应该同时用于动作事件和定时事件。
isEnabled
设置事件是否启用。
| 键 | 值 | 默认值 |
|---|---|---|
isEnabled | 布尔值 | true |
示例
isEnabled: true
eventType
设置事件的类型。
| 键 | 值 | 默认值 |
|---|---|---|
eventType | DEFAULT / BREAK_BLOCK / FISH / TILL_SOIL / TIMED | 无 |
请注意,BREAK_BLOCK、FISH 和 TILL_SOIL 属于 动作事件,而 TIMED 属于 定时事件。DEFAULT 用于由其他方式或特殊条件触发的事件。
示例
eventType: BREAK_BLOCK
bossFilenames
设置将被生成的 Boss 列表。必填!
| 键 | 值 | 默认值 |
|---|---|---|
bossFilenames | 字符串列表 | 无 |
示例
bossFilenames:
- balrog.yml
- my_event_boss.yml
announcementPriority
设置 公告优先级。
| 键 | 值 | 默认值 |
|---|---|---|
announcementPriority | 整数 | 0 |
示例
announcementPriority: 1
startMessage
设置事件开始时发送的消息。
| 键 | 值 | 默认值 |
|---|---|---|
startMessage | 字符串 | 无 |
示例
startMessage: An event has started!
![]()
endMessage
设置事件结束时发送的消息。
| 键 | 值 | 默认值 |
|---|---|---|
endMessage | 字符串 | 无 |
示例
endMessage: An event has ended!
eventStartCommands
设置在事件开始时运行的命令。
| 键 | 值 | 默认值 |
|---|---|---|
eventStartCommands | 字符串列表 | 无 |
示例
eventStartCommands:
- say The event now starts!!
- "$chance=0.5$ say What a spawn!"

eventEndCommands
设置在事件结束时运行的命令。
| 键 | 值 | 默认值 |
|---|---|---|
eventEndCommands | 字符串列表 | 无 |
示例
eventEndCommands:
- say The event ends, so sad.
- "$chance=0.5$ say Too slow bud!"

事件配置示例
isEnabled: true
bossFilenames:
- "cool_boss.yml"
- "other_cool_boss.yml"
announcementPriority: 3
startMessage: "Cool event is starting!"
endMessage: "Cool event is ending!"
eventStartCommands:
- say The event started!
eventEndCommands:
- say The event ended!
完整定时事件示例
isEnabled: true
eventType: TIMED
bossFilenames:
- "my_timed_boss.yml"
announcementPriority: 3
startMessage: "A timed event has started!"
endMessage: "The timed event has ended!"
eventStartCommands:
- say The timed event began!
eventEndCommands:
- say The timed event concluded!
spawnType: "my_spawn_location.yml"
localCooldown: 120
globalCooldown: 30
weight: 100
eventDuration: 15
endEventWithBossDeath: true
minimumPlayerCount: 1
动作事件
当特定动作(例如破坏方块或钓鱼)发生时,有一定几率运行的事件。
注意:动作事件会自动应用一个针对每名玩家的冷却,以防止同一玩家反复触发事件。该冷却默认为 4 分钟,可通过 events.yml 中的 actionEventMinimumCooldownMinutes 进行配置。
chance
设置当动作发生时事件发生的几率。
| 键 | 值 | 默认值 |
|---|---|---|
chance | 0.0 到 1.0 之间的值 | 0 |
示例
chance: 0.001
breakableMaterials
设置当动作被设为 BREAK_BLOCK 时要检查的材质列表。
| 键 | 值 | 默认值 |
|---|---|---|
breakableMaterials | 材质 列表 | 无 |
示例
breakableMaterials:
- BEEHIVE
- BIRCH_WOOD
配置示例
chance: 0.001
breakableMaterials:
- COAL_ORE
假设事件类型为 BREAK_BLOCK,则设置为:当破坏一个煤矿石方块时有 0.1% 的几率运行该事件。
完整动作事件示例
isEnabled: true
eventType: BREAK_BLOCK
bossFilenames:
- "mining_boss.yml"
announcementPriority: 2
startMessage: "You've awakened something..."
chance: 0.001
breakableMaterials:
- DIAMOND_ORE
- EMERALD_ORE
定时事件
定时事件是在可配置的时间间隔发生的事件。一旦某个定时事件的冷却结束,就会根据事件的权重从定时事件列表中随机选取一个定时事件。
spawnType
设置事件所使用的 自定义生成,它定义了 Boss 可以在哪里生成。
| 键 | 值 | 默认值 |
|---|---|---|
spawnType | 文件名 | 无 |
示例
spawnType: nether_spawn.yml
localCooldown
设置在该事件可以被再次选中之前的时间量(以分钟为单位)。
| 键 | 值 | 默认值 |
|---|---|---|
localCooldown | 双精度 | 0 |
示例
localCooldown: 120
globalCooldown
设置在下一个事件被选中之前的时间量(以分钟为单位)。
| 键 | 值 | 默认值 |
|---|---|---|
globalCooldown | 双精度 | 0 |
示例
globalCooldown: 60
weight
设置事件的权重,影响它相对于其他事件被选中的几率。推荐值:100。
权重系统决定了事件被选中的相对概率。例如:
- 权重为 100 的事件 A 对比权重为 50 的事件 B = 事件 A 被选中的可能性是事件 B 的两倍
- 权重越高 = 被选中的几率越高
- 定时事件调度器在服务器启动约 5 分钟后开始,之后每分钟检查一次全局冷却是否已过去且是否可以选取事件
| 键 | 值 | 默认值 |
|---|---|---|
weight | 双精度 | 0 |
示例
weight: 60.5
eventDuration
设置事件的最大持续时间(以分钟为单位)。
| 键 | 值 | 默认值 |
|---|---|---|
eventDuration | 双精度 | 0 |
示例
eventDuration: 30
endEventWithBossDeath
设置事件是否随 Boss 死亡而结束。
| 键 | 值 | 默认值 |
|---|---|---|
endEventWithBossDeath | 布尔值 | true |
示例
endEventWithBossDeath: true
eventEndTime
设置事件结束时的游戏内时间(以游戏刻为单位)。使用 Minecraft 的时间系统,其中 0=黎明,6000=正午,12000=黄昏,18000=午夜,23000=深夜。设为 -1 可禁用基于时间的结束。
| 键 | 值 | 默认值 |
|---|---|---|
eventEndTime | 整数(0-24000,-1 表示禁用) | -1 |
示例
eventEndTime: 23000
minimumPlayerCount
设置事件开始前所需的最少在线玩家数量。
| 键 | 值 | 默认值 |
|---|---|---|
minimumPlayerCount | 整数 | 1 |
示例
minimumPlayerCount: 5
请注意,事件会进入队列,意味着它们只会在 spawnType 中定义的条件满足后才开始。
事件配置示例
isEnabled: true
bossFilenames:
- "cool_boss.yml"
- "other_cool_boss.yml"
announcementPriority: 3
startMessage: "Cool event is starting!"
endMessage: "Cool event is ending!"
eventStartCommands:
- say The event started!
eventEndCommands:
- say The event ended!
spawnType: "myCoolSpawn.yml"
localCooldown: 30
globalCooldown: 15
weight: 100
eventDuration: 20
endEventWithBossDeath: true
eventEndTime: 10000
minimumPlayerCount: 5
