PlayerBecomeKingEvent
PlayerBecomeKingEvent fires after repeated-king and cooldown checks pass, but before KOTL changes the king or any statistics.
Technical Overview
Section titled “Technical Overview”- Package:
dev.despical.kotl.api.events.player - Parent Class:
PlayerEvent - Cancellable: Yes
Methods
Section titled “Methods”| Method | Return Type | Description |
|---|---|---|
getPlayer() | Player | Player attempting the crown claim. |
getUser() | User | KOTL user for that player. |
getGame() | Game | Active game. |
getArena() | Arena | Arena containing the plate. |
getPreviousKing() | String or null | King name captured before the claim. |
isRepeatedClaim() | boolean | Whether the same player is claiming consecutively. |
isCancelled() | boolean | Whether the claim is blocked. |
setCancelled(boolean) | void | Blocks or restores the claim. |
Example
Section titled “Example”import dev.despical.kotl.api.events.player.PlayerBecomeKingEvent;import org.bukkit.event.EventHandler;
@EventHandlerpublic void onCrownClaim(PlayerBecomeKingEvent event) { if (event.isRepeatedClaim() && !event.getPlayer().hasPermission("kotl.repeat")) { event.setCancelled(true); event.getPlayer().sendMessage("Another player must claim the crown first."); }}