Class PlayerKickEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
org.bukkit.event.player.PlayerKickEvent
- All Implemented Interfaces:
Cancellable
Called when a player gets kicked from the server
- Since:
- 1.0.0
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class Event
Event.Result -
Field Summary
Fields inherited from class PlayerEvent
player -
Constructor Summary
ConstructorsConstructorDescriptionPlayerKickEvent(Player playerKicked, String kickReason, String leaveMessage) Deprecated, for removal: This API element is subject to removal in a future version.PlayerKickEvent(Player playerKicked, net.kyori.adventure.text.Component kickReason, net.kyori.adventure.text.Component leaveMessage) Deprecated, for removal: This API element is subject to removal in a future version.PlayerKickEvent(Player playerKicked, net.kyori.adventure.text.Component kickReason, net.kyori.adventure.text.Component leaveMessage, PlayerKickEvent.Cause cause) -
Method Summary
Modifier and TypeMethodDescriptiongetCause()Gets the cause of this kickstatic HandlerList@Nullable StringDeprecated.Deprecated.in favour ofreason()booleanGets the cancellation state of this event.@Nullable net.kyori.adventure.text.ComponentGets the leave message send to all online playersvoidleaveMessage(@Nullable net.kyori.adventure.text.Component leaveMessage) Sets the leave message send to all online playersnet.kyori.adventure.text.Componentreason()Gets the reason why the player is getting kickedvoidreason(net.kyori.adventure.text.Component kickReason) Sets the reason why the player is getting kickedvoidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetLeaveMessage(@Nullable String leaveMessage) Deprecated.in favour ofleaveMessage(Component)voidDeprecated.in favour ofreason(Component)Methods inherited from class PlayerEvent
getPlayerMethods inherited from class Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerKickEvent
@Internal @Deprecated(forRemoval=true) public PlayerKickEvent(Player playerKicked, String kickReason, String leaveMessage) Deprecated, for removal: This API element is subject to removal in a future version. -
PlayerKickEvent
@Internal @Deprecated(forRemoval=true) public PlayerKickEvent(Player playerKicked, net.kyori.adventure.text.Component kickReason, net.kyori.adventure.text.Component leaveMessage) Deprecated, for removal: This API element is subject to removal in a future version. -
PlayerKickEvent
@Internal public PlayerKickEvent(Player playerKicked, net.kyori.adventure.text.Component kickReason, net.kyori.adventure.text.Component leaveMessage, PlayerKickEvent.Cause cause)
-
-
Method Details
-
reason
public net.kyori.adventure.text.Component reason()Gets the reason why the player is getting kicked- Returns:
- string kick reason
- Since:
- 1.16.5
-
reason
public void reason(net.kyori.adventure.text.Component kickReason) Sets the reason why the player is getting kicked- Parameters:
kickReason- kick reason- Since:
- 1.16.5
-
getReason
Deprecated.in favour ofreason()Gets the reason why the player is getting kicked- Returns:
- string kick reason
- Since:
- 1.0.0
-
setReason
Deprecated.in favour ofreason(Component)Sets the reason why the player is getting kicked- Parameters:
kickReason- kick reason- Since:
- 1.0.0
-
leaveMessage
public @Nullable net.kyori.adventure.text.Component leaveMessage()Gets the leave message send to all online players- Returns:
- string kick reason
- Since:
- 1.16.5
-
leaveMessage
public void leaveMessage(@Nullable net.kyori.adventure.text.Component leaveMessage) Sets the leave message send to all online players- Parameters:
leaveMessage- leave message. Ifnull, no message will be sent- Since:
- 1.16.5
-
getLeaveMessage
Deprecated.in favour ofleaveMessage()Gets the leave message send to all online players- Returns:
- string kick reason
- Since:
- 1.0.0
-
setLeaveMessage
Deprecated.in favour ofleaveMessage(Component)Sets the leave message send to all online players- Parameters:
leaveMessage- leave message. Ifnull, no message will be sent- Since:
- 1.0.0
-
getCause
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelledin interfaceCancellable- Returns:
trueif this event is cancelled- Since:
- 1.0.0
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableSets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel-trueif you wish to cancel this event- Since:
- 1.0.0
-
getHandlers
- Specified by:
getHandlersin classEvent- Since:
- 1.1.0
-
getHandlerList
- Since:
- 1.1.0
-
leaveMessage()