RoundStartEvent
The RoundStartEvent is triggered at the transition point between rounds. It is called after the plugin has selected the next task for the players but before that task is officially registered or started.
Technical Overview
Section titled “Technical Overview”- Package:
io.greenmc.santasays.api.event.round - Parent Class:
RoundEvent - Cancellable: No
Methods
Section titled “Methods”This event inherits all utility methods from the base RoundEvent class.
| Method | Return Type | Description |
|---|---|---|
getGame() | Game | Returns the game instance where the round is starting. |
getRoundNumber() | int | Returns the number of the round that is about to begin. |
isLastRound() | boolean | Checks if this starting round is the final round. |
Lifecycle Timing
Section titled “Lifecycle Timing”Understanding exactly when this event fires is crucial for synchronization:
- Previous Round Ends: The previous task is cleared.
- Task Selection: The plugin picks the next random task.
- RoundStartEvent Fired: This is where this event occurs.
- Task Registration: The selected task starts and objectives are sent to players.
Example Usage
Section titled “Example Usage”This example shows how to broadcast a special message at the start of specific rounds or trigger external logic like custom sound effects.
import io.greenmc.santasays.api.event.round.RoundStartEvent;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;
public class RoundTransitionListener implements Listener {
@EventHandler public void onRoundStart(RoundStartEvent event) { int roundNumber = event.getRoundNumber();
// Broadcast a milestone message every 5 rounds if (roundNumber % 5 == 0) { event.getGame().broadcastRawMessage("<orange><bold>MILESTONE! <yellow>You have reached Round " + roundNumber + "!"); }
// Logic for the very last round if (event.isLastRound()) { event.getGame().rawBroadcastMessage("<red><bold>THE FINAL CHALLENGE BEGINS NOW!"); } }}