This system lets you define multiple timed “event phases” in the config where each phase runs console commands after a specified number of ticks from the event starting.
Allows a Paper plugin event system to execute console commands at timed intervals after /event start.
start:
phases:
- after:
commands:
- "command 1"
- "command 2"
- after: <ticks>
commands:
- "command 3"
SET CENTER POSITION
/event cornucopia center
SET RADIUS
/event cornucopia radius
Example:
/event cornucopia radius 15
ENABLE AUTO MODE
/event mode auto
/event mode manual
/event start
BEHAVIOR:
Player runs:
/event start
EventManager.startEvent() executes:
runStartPhases():
FOR each phase in config "start.phases":
read:
delay = phase.after
commands = phase.commands
schedule task:
BukkitScheduler.runTaskLater(plugin, task, delay)
When delay expires:
FOR each command in phase.commands:
Bukkit.dispatchCommand(CONSOLE, command)
Example:
phase A:
after: 1
commands:
- "pvp disable"
phase B:
after: 20
commands:
- "say Event started"
RESULT:
tick 1 -> pvp disabled
tick 20 -> message broadcast
IMPORTANT:
WRONG (invalid YAML):
start:
phases:
after: 1
commands:
after: 20
commands:
CAUSE:
CORRECT EXAMPLE:
start:
phases:
- after: 1
commands:
- "clear"
- after: 20
commands:
- "say This is 1 second after the event start!"