Class PlayerConnectionValidateLoginEvent
java.lang.Object
org.bukkit.event.Event
io.papermc.paper.event.connection.PlayerConnectionValidateLoginEvent
Validates whether a player connection is able to log in.
Called when a player is attempting to log in for the first time, or is finishing up being configured.
However, these underlying connection types are not guaranteed to be stable across versions.
Note: Since 1.21.7, during these phases, the connection
is either PlayerLoginConnection or PlayerConfigurationConnection,
allowing access to phase-specific API.
- Since:
- 1.21.7
-
Nested Class Summary
Nested classes/interfaces inherited from class Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionPlayerConnectionValidateLoginEvent(PlayerConnection connection, @Nullable net.kyori.adventure.text.Component kickMessage) -
Method Summary
Modifier and TypeMethodDescriptionvoidallow()Allows the player to log in.Gets the connection of the player in this event.static HandlerList@Nullable net.kyori.adventure.text.ComponentGets the reason for why a player is not allowed to join the server.booleanGets if the player is allowed to enter the next stage.voidkickMessage(net.kyori.adventure.text.Component message) Disallows the player from logging in, with the given reasonMethods inherited from class Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerConnectionValidateLoginEvent
@Internal public PlayerConnectionValidateLoginEvent(PlayerConnection connection, @Nullable net.kyori.adventure.text.Component kickMessage)
-
-
Method Details
-
getConnection
Gets the connection of the player in this event.However, these underlying connection types are not guaranteed to be stable across versions.
Note: Since 1.21.7, this connection is either
PlayerLoginConnectionorPlayerConfigurationConnectiondepending on which phase it is fired in, allowing access to phase-specific API.- Returns:
- connection
- Since:
- 1.21.7
- API Note:
- disconnecting the player through this connection or using any methods that may send packets is not supported
-
allow
public void allow()Allows the player to log in. This skips any login validation checks.- Since:
- 1.21.7
-
kickMessage
public void kickMessage(net.kyori.adventure.text.Component message) Disallows the player from logging in, with the given reason- Parameters:
message- Kick message to display to the user- Since:
- 1.21.7
-
getKickMessage
public @Nullable net.kyori.adventure.text.Component getKickMessage()Gets the reason for why a player is not allowed to join the server. This will be null in the case that the player is allowed to log in.- Returns:
- disallow reason
- Since:
- 1.21.7
-
isAllowed
public boolean isAllowed()Gets if the player is allowed to enter the next stage.- Returns:
- if allowed
- Since:
- 1.21.7
-
getHandlers
- Specified by:
getHandlersin classEvent- Since:
- 1.21.7
-
getHandlerList
- Since:
- 1.21.7
-