創建事件
本指南適用於 EliteMobs 7.3.4 及更高版本
什麼是自定義事件?
這裡的自定義事件是指在遊戲中隨機發生的事件,無論是基於玩家行動還是有定時觸發器。該插件預裝了許多自定義事件,例如炎魔事件、海妖事件和寶藏哥布林事件等。
此系統被稱為自定義事件,因為這些事件不僅可以自定義,還可以從頭創建。以下是如何創建和自定義您自己的事件的指南。
創建您的自定義事件
自定義事件配置文件應創建在:
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 | none |
請注意,BREAK_BLOCK、FISH 和 TILL_SOIL 是動作事件,TIMED 是定時事件。DEFAULT 用於由其他方式或特殊條件觸發的事件。
示例
eventType: BREAK_BLOCK
bossFilenames
設置將生成的首領列表。必填!
| 鍵 | 值 | 默認值 |
|---|---|---|
bossFilenames | 字符串列表 | none |
示例
bossFilenames:
- balrog.yml
- my_event_boss.yml
announcementPriority
設置公告優先級。
| 鍵 | 值 | 默認值 |
|---|---|---|
announcementPriority | 整數 | none |
示例
announcementPriority: 1
startMessage
設置事件開始時發送的消息。
| 鍵 | 值 | 默認值 |
|---|---|---|
startMessage | 字符串 | none |
示例
startMessage: An event has started!
![]()
endMessage
設置事件結束時發送的消息。
| 鍵 | 值 | 默認值 |
|---|---|---|
endMessage | 字符串 | none |
示例
endMessage: An event has ended!
eventStartCommands
設置在事件開始時運行的命令。
| 鍵 | 值 | 默認值 |
|---|---|---|
eventStartCommands | 字符串列表 | none |
示例
eventStartCommands:
- say The event now starts!!
- "$chance=0.5$ say What a spawn!"

eventEndCommands
設置在事件結束時運行的命令。
| 鍵 | 值 | 默認值 |
|---|---|---|
eventEndCommands | 字符串列表 | none |
示例
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
動作事件
當特定動作(如破壞方塊或釣魚)發生時有機會運行的事件。
請注意:動作事件會自動對每個玩家應用 60 分鐘的冷卻時間,以防止同一玩家反復觸發事件。
chance
設置當動作發生時事件發生的機率。
| 鍵 | 值 | 默認值 |
|---|---|---|
chance | 0.0 到 1.0 之間的值 | 0 |
示例
chance: 0.001
breakableMaterials
設置當動作設置為 BREAK_BLOCK 時要檢查的材料列表。
| 鍵 | 值 | 默認值 |
|---|---|---|
breakableMaterials | 材料列表 | none |
示例
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
設置事件使用的自定義生成,定義首領可以生成的位置。
| 鍵 | 值 | 默認值 |
|---|---|---|
spawnType | 文件名 | none |
示例
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
設置事件是否隨首領死亡而結束。
| 鍵 | 值 | 默認值 |
|---|---|---|
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
