public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable
Modifier and Type | Class and Description |
---|---|
static class |
PlayerGameModeChangeEvent.Cause |
Event.Result
player
Constructor and Description |
---|
PlayerGameModeChangeEvent(@NotNull Player player,
@NotNull GameMode newGameMode)
Deprecated.
|
PlayerGameModeChangeEvent(@NotNull Player player,
@NotNull GameMode newGameMode,
@NotNull PlayerGameModeChangeEvent.Cause cause,
net.kyori.adventure.text.Component cancelMessage) |
Modifier and Type | Method and Description |
---|---|
net.kyori.adventure.text.Component |
cancelMessage()
Only valid if the cause of the gamemode change was directly due to a command..
|
void |
cancelMessage(net.kyori.adventure.text.Component message)
Sets the message shown to the command user if the event was cancelled.
|
@NotNull PlayerGameModeChangeEvent.Cause |
getCause()
Gets the cause of this gamemode change.
|
static @NotNull HandlerList |
getHandlerList() |
@NotNull HandlerList |
getHandlers() |
@NotNull GameMode |
getNewGameMode()
Gets the GameMode the player is switched to.
|
boolean |
isCancelled()
Gets the cancellation state of this event.
|
void |
setCancelled(boolean cancel)
Sets the cancellation state of this event.
|
getPlayer
callEvent, getEventName, isAsynchronous
@Deprecated public PlayerGameModeChangeEvent(@NotNull @NotNull Player player, @NotNull @NotNull GameMode newGameMode)
public boolean isCancelled()
Cancellable
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
Cancellable
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this event@NotNull public @NotNull GameMode getNewGameMode()
@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
@NotNull public @NotNull PlayerGameModeChangeEvent.Cause getCause()
@Nullable public net.kyori.adventure.text.Component cancelMessage()
This returns null
if the gamemode change was due to a plugin, or a
player joining the game with a gamemode not equal to the server default gamemode
and force-gamemode
is set to true.
public void cancelMessage(@Nullable net.kyori.adventure.text.Component message)
message
- the error message shown to the command user, null to show no message.Copyright © 2021. All rights reserved.