Class PlayerJoinAttemptEvent
java.lang.Object
org.bukkit.event.Event
dev.despical.whackme.api.event.WhackMeEvent
dev.despical.whackme.api.event.player.PlayerEvent
dev.despical.whackme.api.event.player.PlayerJoinAttemptEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public final class PlayerJoinAttemptEvent
extends PlayerEvent
implements org.bukkit.event.Cancellable
Called after built-in arena checks pass but before a player is added to a
Whack Me game.
Cancelling the event prevents the join without modifying the target
Game. This is the extension point for custom permissions, queues,
maintenance rules, or third-party cooldowns.
@EventHandler
public void onJoinAttempt(PlayerJoinAttemptEvent event) {
if (maintenanceArenas.contains(event.getGame().getArena().getId())) {
event.setCancelled(true);
event.getPlayer().sendMessage("This arena is under maintenance.");
}
}
API Note: Cancellation does not send a message automatically. A listener cancelling the attempt should explain the reason to the player when useful.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionPlayerJoinAttemptEvent(org.bukkit.entity.Player player, Game game) Creates a join attempt event. -
Method Summary
Modifier and TypeMethodDescriptiongetGame()Returns the game the player is attempting to join.static org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListbooleanReturns whether a listener has denied this join attempt.voidsetCancelled(boolean cancel) Sets whether the player should be prevented from joining.Methods inherited from class PlayerEvent
getPlayer, getUser, toStringMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerJoinAttemptEvent
Creates a join attempt event.- Parameters:
player- player attempting to joingame- target game
-
-
Method Details
-
getGame
-
isCancelled
public boolean isCancelled()Returns whether a listener has denied this join attempt.- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable- Returns:
truewhen the join is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Sets whether the player should be prevented from joining.- Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable- Parameters:
cancel-trueto deny the join attempt
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlersin classorg.bukkit.event.Event
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()
-