Class AsyncPlayerPreLoginEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.AsyncPlayerPreLoginEvent

public class AsyncPlayerPreLoginEvent extends Event
Stores details for players attempting to log in.

This event is asynchronous, and not run using main thread.

When this event is fired, the player's locale is not available. Therefore, any translatable component will be rendered with the default locale, Locale.US.

Consider rendering any translatable yourself with GlobalTranslator.render(net.kyori.adventure.text.Component, java.util.Locale) if the client's language is known.

  • Constructor Details

    • AsyncPlayerPreLoginEvent

      @Internal @Deprecated(since="1.7.5", forRemoval=true) public AsyncPlayerPreLoginEvent(@NotNull @NotNull String name, @NotNull @NotNull InetAddress ipAddress)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • AsyncPlayerPreLoginEvent

      @Internal @Deprecated(since="1.20.5", forRemoval=true) public AsyncPlayerPreLoginEvent(@NotNull @NotNull String name, @NotNull @NotNull InetAddress ipAddress, @NotNull @NotNull UUID uniqueId)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • AsyncPlayerPreLoginEvent

      @Internal public AsyncPlayerPreLoginEvent(@NotNull @NotNull String name, @NotNull @NotNull InetAddress ipAddress, @NotNull @NotNull UUID uniqueId, boolean transferred)
    • AsyncPlayerPreLoginEvent

      @Internal @Deprecated(forRemoval=true) public AsyncPlayerPreLoginEvent(@NotNull @NotNull String name, @NotNull @NotNull InetAddress ipAddress, @NotNull @NotNull UUID uniqueId, boolean transferred, @NotNull PlayerProfile profile)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • AsyncPlayerPreLoginEvent

      @Internal @Deprecated(forRemoval=true) public AsyncPlayerPreLoginEvent(@NotNull @NotNull String name, @NotNull @NotNull InetAddress ipAddress, @NotNull @NotNull InetAddress rawAddress, @NotNull @NotNull UUID uniqueId, boolean transferred, @NotNull PlayerProfile profile)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • AsyncPlayerPreLoginEvent

      @Internal public AsyncPlayerPreLoginEvent(@NotNull @NotNull String name, @NotNull @NotNull InetAddress ipAddress, @NotNull @NotNull InetAddress rawAddress, @NotNull @NotNull UUID uniqueId, boolean transferred, @NotNull PlayerProfile profile, @NotNull @NotNull String hostname, PlayerLoginConnection playerLoginConnection)
  • Method Details

    • getLoginResult

      @NotNull public @NotNull AsyncPlayerPreLoginEvent.Result getLoginResult()
      Gets the current result of the login, as an enum
      Returns:
      Current Result of the login
    • getResult

      @Deprecated(since="1.3.2") @NotNull public PlayerPreLoginEvent.Result getResult()
      Deprecated.
      This method uses a deprecated enum from PlayerPreLoginEvent
      Gets the current result of the login, as an enum
      Returns:
      Current Result of the login
      See Also:
    • setLoginResult

      public void setLoginResult(@NotNull @NotNull AsyncPlayerPreLoginEvent.Result result)
      Sets the new result of the login, as an enum
      Parameters:
      result - New result to set
    • setResult

      @Deprecated(since="1.3.2") public void setResult(@NotNull PlayerPreLoginEvent.Result result)
      Deprecated.
      This method uses a deprecated enum from PlayerPreLoginEvent
      Sets the new result of the login, as an enum
      Parameters:
      result - New result to set
      See Also:
    • kickMessage

      @NotNull public @NotNull Component kickMessage()
      Gets the current kick message that will be used when the outcome is not allowed
      Returns:
      Current kick message
    • kickMessage

      public void kickMessage(@NotNull @NotNull Component message)
      Sets the kick message to display when the outcome is not allowed
      Parameters:
      message - New kick message
    • disallow

      public void disallow(@NotNull @NotNull AsyncPlayerPreLoginEvent.Result result, @NotNull @NotNull Component message)
      Disallows the player from logging in, with the given reason
      Parameters:
      result - New result for disallowing the player
      message - Kick message to display to the user
    • disallow

      @Deprecated public void disallow(@NotNull PlayerPreLoginEvent.Result result, @NotNull Component message)
      Deprecated.
      This method uses a deprecated enum from PlayerPreLoginEvent
      Disallows the player from logging in, with the given reason
      Parameters:
      result - New result for disallowing the player
      message - Kick message to display to the user
      See Also:
    • getKickMessage

      @NotNull @Deprecated public @NotNull String getKickMessage()
      Deprecated.
      in favour of kickMessage()
      Gets the current kick message that will be used when the outcome is not allowed
      Returns:
      Current kick message
    • setKickMessage

      @Deprecated public void setKickMessage(@NotNull @NotNull String message)
      Deprecated.
      Sets the kick message to display when the outcome is not allowed
      Parameters:
      message - New kick message
    • allow

      public void allow()
      Allows the player to log in
    • disallow

      @Deprecated public void disallow(@NotNull @NotNull AsyncPlayerPreLoginEvent.Result result, @NotNull @NotNull String message)
      Disallows the player from logging in, with the given reason
      Parameters:
      result - New result for disallowing the player
      message - Kick message to display to the user
    • disallow

      @Deprecated(since="1.3.2") public void disallow(@NotNull PlayerPreLoginEvent.Result result, @NotNull @NotNull String message)
      Deprecated.
      This method uses a deprecated enum from PlayerPreLoginEvent
      Disallows the player from logging in, with the given reason
      Parameters:
      result - New result for disallowing the player
      message - Kick message to display to the user
      See Also:
    • getName

      @NotNull public @NotNull String getName()
      Gets the player's name.
      Returns:
      the player's name
    • getAddress

      @NotNull public @NotNull InetAddress getAddress()
      Gets the player IP address.
      Returns:
      The IP address
    • getUniqueId

      @NotNull public @NotNull UUID getUniqueId()
      Gets the player's unique ID.
      Returns:
      The unique ID
    • getPlayerProfile

      @NotNull public PlayerProfile getPlayerProfile()
      Gets the PlayerProfile of the player logging in
      Returns:
      The Profile
    • setPlayerProfile

      public void setPlayerProfile(@NotNull PlayerProfile profile)
      Changes the PlayerProfile the player will login as
      Parameters:
      profile - The profile to use
    • getRawAddress

      @NotNull public @NotNull InetAddress getRawAddress()
      Gets the raw address of the player logging in
      Returns:
      The address
    • getHostname

      @NotNull public @NotNull String getHostname()
      Gets the hostname that the player used to connect to the server, or blank if unknown
      Returns:
      The hostname
    • isTransferred

      public boolean isTransferred()
      Gets if this connection has been transferred from another server.
      Returns:
      true if the connection has been transferred
    • getConnection

      @Experimental @NotNull public @NotNull PlayerLoginConnection getConnection()
      Gets the connection for the player logging in.
      Returns:
      connection
    • getHandlers

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

      @NotNull public static @NotNull HandlerList getHandlerList()