Class PlayerConnectionValidateLoginEvent

java.lang.Object
org.bukkit.event.Event
io.papermc.paper.event.connection.PlayerConnectionValidateLoginEvent

public class PlayerConnectionValidateLoginEvent extends Event
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.

Implementation Note:
Since 1.21.7, during these phases, the connection is either PlayerLoginConnection or PlayerConfigurationConnection, allowing access to phase-specific API.
However, these underlying connection types are not guaranteed to be stable across versions.
  • Constructor Details

  • Method Details

    • getConnection

      public PlayerConnection getConnection()
      Gets the connection of the player in this event.
      Returns:
      connection
      API Note:
      Disconnecting the player through this connection or using any methods that may send packets is not supported.
      Implementation Note:
      Since 1.21.7, this connection is either PlayerLoginConnection or PlayerConfigurationConnection depending on which phase it is fired in, allowing access to phase-specific API.
      However, these underlying connection types are not guaranteed to be stable across versions.
    • allow

      public void allow()
      Allows the player to log in. This skips any login validation checks.
    • kickMessage

      public void kickMessage(Component message)
      Disallows the player from logging in, with the given reason
      Parameters:
      message - Kick message to display to the user
    • getKickMessage

      public @Nullable 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
    • isAllowed

      public boolean isAllowed()
      Gets if the player is allowed to enter the next stage.
      Returns:
      if allowed
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()