Package net.minestom.server.event.player
Class AsyncPlayerPreLoginEvent
java.lang.Object
net.minestom.server.event.player.AsyncPlayerPreLoginEvent
- All Implemented Interfaces:
Event
,EntityEvent
,PlayerEvent
Called before the player initialization, it can be used to kick the player before any connection
or to change his final username/uuid.
-
Constructor Summary
ConstructorDescriptionAsyncPlayerPreLoginEvent
(@NotNull Player player, @NotNull LoginPluginMessageProcessor pluginMessageProcessor) -
Method Summary
Modifier and TypeMethodDescription@NotNull Player
Gets the player.@NotNull UUID
Gets the player uuid.@NotNull String
Gets the player username.@NotNull CompletableFuture
<LoginPluginResponse> sendPluginRequest
(String channel, byte[] requestPayload) Sends a login plugin message request.void
setPlayerUuid
(@NotNull UUID playerUuid) Changes the player uuid.void
setUsername
(@NotNull String username) Changes the player username.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.event.trait.PlayerEvent
getEntity
-
Constructor Details
-
AsyncPlayerPreLoginEvent
public AsyncPlayerPreLoginEvent(@NotNull @NotNull Player player, @NotNull @NotNull LoginPluginMessageProcessor pluginMessageProcessor)
-
-
Method Details
-
getUsername
Gets the player username.- Returns:
- the player username
-
setUsername
Changes the player username.- Parameters:
username
- the new player username
-
getPlayerUuid
Gets the player uuid.- Returns:
- the player uuid
-
setPlayerUuid
Changes the player uuid.- Parameters:
playerUuid
- the new player uuid
-
sendPluginRequest
@NotNull public @NotNull CompletableFuture<LoginPluginResponse> sendPluginRequest(String channel, byte[] requestPayload) Sends a login plugin message request. Can be useful to negotiate with modded clients or proxies before moving on to the Configuration state.- Parameters:
channel
- the plugin message channelrequestPayload
- the contents of the plugin message, can be null for empty- Returns:
- a CompletableFuture for the response. The thread on which it completes is asynchronous.
-
getPlayer
Description copied from interface:PlayerEvent
Gets the player.- Specified by:
getPlayer
in interfacePlayerEvent
- Returns:
- the player
-