Skip to content

PlayerBecomeKingEvent

PlayerBecomeKingEvent fires after repeated-king and cooldown checks pass, but before KOTL changes the king or any statistics.


  • Package: dev.despical.kotl.api.events.player
  • Parent Class: PlayerEvent
  • Cancellable: Yes

MethodReturn TypeDescription
getPlayer()PlayerPlayer attempting the crown claim.
getUser()UserKOTL user for that player.
getGame()GameActive game.
getArena()ArenaArena containing the plate.
getPreviousKing()String or nullKing name captured before the claim.
isRepeatedClaim()booleanWhether the same player is claiming consecutively.
isCancelled()booleanWhether the claim is blocked.
setCancelled(boolean)voidBlocks or restores the claim.

import dev.despical.kotl.api.events.player.PlayerBecomeKingEvent;
import org.bukkit.event.EventHandler;
@EventHandler
public 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.");
}
}