Package org.bukkit.event.player

# 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.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`AsyncPlayerPreLoginEvent.Result`
Basic kick reasons for communicating to plugins

## Constructor Summary

Constructors
Constructor
Description
`AsyncPlayerPreLoginEvent(@NotNull String name, @NotNull InetAddress ipAddress)`
Deprecated.
`AsyncPlayerPreLoginEvent(@NotNull String name, @NotNull InetAddress ipAddress, @NotNull InetAddress rawAddress, @NotNull UUID uniqueId, @NotNull PlayerProfile profile)`
Deprecated.
`AsyncPlayerPreLoginEvent(@NotNull String name, @NotNull InetAddress ipAddress, @NotNull InetAddress rawAddress, @NotNull UUID uniqueId, @NotNull PlayerProfile profile, @NotNull String hostname)`
`AsyncPlayerPreLoginEvent(@NotNull String name, @NotNull InetAddress ipAddress, @NotNull UUID uniqueId)`
`AsyncPlayerPreLoginEvent(@NotNull String name, @NotNull InetAddress ipAddress, @NotNull UUID uniqueId, @NotNull PlayerProfile profile)`
Deprecated.

## Method Summary

Modifier and Type
Method
Description
`void`
`allow()`
Allows the player to log in
`void`
`disallow(@NotNull AsyncPlayerPreLoginEvent.Result result, @NotNull String message)`
Deprecated.
in favour of `disallow(org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result, net.kyori.adventure.text.Component)`
`void`
`disallow(@NotNull AsyncPlayerPreLoginEvent.Result result, Component message)`
Disallows the player from logging in, with the given reason
`void`
`disallow(PlayerPreLoginEvent.Result result, @NotNull String message)`
Deprecated.
This method uses a deprecated enum from `PlayerPreLoginEvent`
`void`
`disallow(PlayerPreLoginEvent.Result result, Component message)`
Deprecated.
This method uses a deprecated enum from `PlayerPreLoginEvent`
`@NotNull InetAddress`
`getAddress()`
Gets the player IP address.
`static @NotNull HandlerList`
`getHandlerList()`
`@NotNull HandlerList`
`getHandlers()`
`@NotNull String`
`getHostname()`
Gets the hostname that the player used to connect to the server, or blank if unknown
`@NotNull String`
`getKickMessage()`
Deprecated.
in favour of `kickMessage()`
`@NotNull AsyncPlayerPreLoginEvent.Result`
`getLoginResult()`
Gets the current result of the login, as an enum
`@NotNull String`
`getName()`
Gets the player's name.
`@NotNull PlayerProfile`
`getPlayerProfile()`
Gets the PlayerProfile of the player logging in
`@NotNull InetAddress`
`getRawAddress()`
Gets the raw address of the player logging in
`PlayerPreLoginEvent.Result`
`getResult()`
Deprecated.
This method uses a deprecated enum from `PlayerPreLoginEvent`
`@NotNull UUID`
`getUniqueId()`
Gets the player's unique ID.
`Component`
`kickMessage()`
Gets the current kick message that will be used if getResult() != Result.ALLOWED
`void`
`kickMessage(Component message)`
Sets the kick message to display if getResult() != Result.ALLOWED
`void`
`setKickMessage(@NotNull String message)`
Deprecated.
in favour of `kickMessage(net.kyori.adventure.text.Component)`
`void`
`setLoginResult(@NotNull AsyncPlayerPreLoginEvent.Result result)`
Sets the new result of the login, as an enum
`void`
`setPlayerProfile(@NotNull PlayerProfile profile)`
`void`
`setResult(PlayerPreLoginEvent.Result result)`
Deprecated.
This method uses a deprecated enum from `PlayerPreLoginEvent`

### Methods inherited from class org.bukkit.event.Event

`callEvent, getEventName, isAsynchronous`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AsyncPlayerPreLoginEvent

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

### AsyncPlayerPreLoginEvent

public AsyncPlayerPreLoginEvent(@NotNull @NotNull String name, @NotNull @NotNull InetAddress ipAddress, @NotNull @NotNull UUID uniqueId)

### AsyncPlayerPreLoginEvent

@Deprecated public AsyncPlayerPreLoginEvent(@NotNull @NotNull String name, @NotNull @NotNull InetAddress ipAddress, @NotNull @NotNull UUID uniqueId, @NotNull @NotNull PlayerProfile profile)
Deprecated.

### AsyncPlayerPreLoginEvent

@Deprecated public AsyncPlayerPreLoginEvent(@NotNull @NotNull String name, @NotNull @NotNull InetAddress ipAddress, @NotNull @NotNull InetAddress rawAddress, @NotNull @NotNull UUID uniqueId, @NotNull @NotNull PlayerProfile profile)
Deprecated.

### AsyncPlayerPreLoginEvent

public AsyncPlayerPreLoginEvent(@NotNull @NotNull String name, @NotNull @NotNull InetAddress ipAddress, @NotNull @NotNull InetAddress rawAddress, @NotNull @NotNull UUID uniqueId, @NotNull @NotNull PlayerProfile profile, @NotNull @NotNull String hostname)

## Method Details

### getPlayerProfile

@NotNull public @NotNull PlayerProfile getPlayerProfile()
Gets the PlayerProfile of the player logging in

Returns:
  The Profile

### setPlayerProfile

public void setPlayerProfile(@NotNull @NotNull PlayerProfile profile)

### getRawAddress

@NotNull public @NotNull InetAddress getRawAddress()
Gets the raw address of the player logging in

Returns:
  The address

### 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 @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:
  - `getLoginResult()`

### 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 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:
  - `setLoginResult(Result)`

### kickMessage

@NotNull public Component kickMessage()
Gets the current kick message that will be used if getResult() != Result.ALLOWED

Returns:
  Current kick message

### kickMessage

public void kickMessage(@NotNull Component message)
Sets the kick message to display if getResult() != Result.ALLOWED

Parameters:
  `message` - New kick message

### disallow

public void disallow(@NotNull @NotNull AsyncPlayerPreLoginEvent.Result result, @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:
  - `disallow(Result, String)`

### getKickMessage

@NotNull @Deprecated public @NotNull String getKickMessage()
Deprecated.
in favour of `kickMessage()`
Gets the current kick message that will be used if getResult() != Result.ALLOWED

Returns:
  Current kick message

### setKickMessage

@Deprecated public void setKickMessage(@NotNull @NotNull String message)
Deprecated.
in favour of `kickMessage(net.kyori.adventure.text.Component)`
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

@Deprecated public void disallow(@NotNull @NotNull AsyncPlayerPreLoginEvent.Result result, @NotNull @NotNull String message)
Deprecated.
in favour of `disallow(org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result, net.kyori.adventure.text.Component)`
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 @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:
  - `disallow(Result, String)`

### 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

### 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

### getHandlers

@NotNull public @NotNull HandlerList getHandlers()

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()