Class PlayerJoinArenaEvent
java.lang.Object
org.bukkit.event.Event
com.tomkeuper.bedwars.api.events.player.PlayerJoinArenaEvent
public class PlayerJoinArenaEvent
extends org.bukkit.event.Event
Represents an event that is triggered when a player joins an arena as a player or spectator.
This event is not triggered for players who died and become spectators; listen to the kill event for this purpose.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerJoinArenaEvent
(IArena arena, org.bukkit.entity.Player player, boolean spectator) Constructs a PlayerJoinArenaEvent. -
Method Summary
Modifier and TypeMethodDescriptiongetArena()
Get the arena where the event occurred.static org.bukkit.event.HandlerList
Get the list of handlers for the event.org.bukkit.event.HandlerList
Get the list of handlers for the event.Get the custom join message associated with the event.org.bukkit.entity.Player
Get the player who is joining the arena.boolean
Check if the event is cancelled.boolean
Check if the player is joining the arena as a spectator.void
setCancelled
(boolean cancelled) Cancel the event if needed.void
setMessage
(String message) Set a custom join message for the event.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
PlayerJoinArenaEvent
Constructs a PlayerJoinArenaEvent.- Parameters:
arena
- The arena the player is joining.player
- The player joining the arena.spectator
- Whether the player is joining as a spectator.
-
-
Method Details
-
getArena
Get the arena where the event occurred.- Returns:
- The arena instance.
-
getPlayer
public org.bukkit.entity.Player getPlayer()Get the player who is joining the arena.- Returns:
- The player instance.
-
isSpectator
public boolean isSpectator()Check if the player is joining the arena as a spectator.- Returns:
- true if the player is joining as a spectator, false if as a regular player.
-
isCancelled
public boolean isCancelled()Check if the event is cancelled.- Returns:
- true if the event is cancelled, false otherwise.
-
setCancelled
public void setCancelled(boolean cancelled) Cancel the event if needed.- Parameters:
cancelled
- true to cancel the event, false otherwise.
-
setMessage
Set a custom join message for the event. The value of the 'message' parameter can be set to null to disable the join message and prevent it from being displayed.- Parameters:
message
- The custom join message, or null to disable the message.
-
getMessage
Get the custom join message associated with the event.- Returns:
- The custom join message.
-
getHandlers
public org.bukkit.event.HandlerList getHandlers()Get the list of handlers for the event.- Specified by:
getHandlers
in classorg.bukkit.event.Event
- Returns:
- The list of event handlers.
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()Get the list of handlers for the event.- Returns:
- The list of event handlers.
-