Class AsyncPlayerPreLoginEvent


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

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

    • Constructor Detail

      • AsyncPlayerPreLoginEvent

        @Deprecated
        public AsyncPlayerPreLoginEvent​(@NotNull
                                        String name,
                                        @NotNull
                                        InetAddress ipAddress)
        Deprecated.
      • AsyncPlayerPreLoginEvent

        public AsyncPlayerPreLoginEvent​(@NotNull
                                        String name,
                                        @NotNull
                                        InetAddress ipAddress,
                                        @NotNull
                                        UUID uniqueId)
    • Method Detail

      • getLoginResult

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

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

        @NotNull
        public String getKickMessage()
        Gets the current kick message that will be used if getResult() != Result.ALLOWED
        Returns:
        Current kick message
      • setKickMessage

        public void setKickMessage​(@NotNull
                                   String message)
        Sets the kick message to display if getResult() != Result.ALLOWED
        Parameters:
        message - New kick message
      • allow

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

        public void disallow​(@NotNull
                             AsyncPlayerPreLoginEvent.Result result,
                             @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
      • getName

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

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

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

        @NotNull
        public static HandlerList getHandlerList()