Class PreLoginEvent
java.lang.Object
com.velocitypowered.api.event.connection.PreLoginEvent
- All Implemented Interfaces:
ResultedEvent<PreLoginEvent.PreLoginComponentResult>
@AwaitingEvent
public final class PreLoginEvent
extends Object
implements ResultedEvent<PreLoginEvent.PreLoginComponentResult>
This event is fired when a player has initiated a connection with the proxy but before the proxy
authenticates the player with Mojang or before the player's proxy connection is fully established
(for offline mode). Velocity will wait for this event to finish firing before proceeding further
with the login process, but you should try to limit the work done in any event that fires during
the login process.
As of Velocity 3.1.0, you may cast the InboundConnection
to a
LoginPhaseConnection
to allow a
proxy plugin to send login plugin messages to the client.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Represents an "allowed/allowed with forced online\offline mode/denied" result with a reason allowed for denial.Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result
-
Constructor Summary
ConstructorDescriptionPreLoginEvent
(InboundConnection connection, String username) Deprecated.PreLoginEvent
(InboundConnection connection, String username, @Nullable UUID uuid) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the result associated with this event.@Nullable UUID
Returns the UUID of the connecting player.void
setResult
(@NonNull PreLoginEvent.PreLoginComponentResult result) Sets the result of this event.toString()
-
Constructor Details
-
PreLoginEvent
Deprecated.Creates a new instance, without an associated UUID.- Parameters:
connection
- the connection logging into the proxyusername
- the player's username
-
PreLoginEvent
Creates a new instance.- Parameters:
connection
- the connection logging into the proxyusername
- the player's usernameuuid
- the player's uuid, if known
-
-
Method Details
-
getConnection
-
getUsername
-
getUniqueId
Returns the UUID of the connecting player.This value is
null
on 1.19.2 and lower, up to 1.20.1 it is optional and from 1.20.2 it will always be available.- Returns:
- the uuid
- Since Minecraft:
- 1.19.3
-
getResult
Description copied from interface:ResultedEvent
Returns the result associated with this event.- Specified by:
getResult
in interfaceResultedEvent<PreLoginEvent.PreLoginComponentResult>
- Returns:
- the result of this event
-
setResult
Description copied from interface:ResultedEvent
Sets the result of this event. The result must be non-null.- Specified by:
setResult
in interfaceResultedEvent<PreLoginEvent.PreLoginComponentResult>
- Parameters:
result
- the new result
-
toString
-
PreLoginEvent(InboundConnection, String, UUID)