public class PlayerHandshakeEvent extends Event implements Cancellable
If there are no listeners listening to this event, the logic default to your server platform will be ran.
WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS
Event.Result
Constructor and Description |
---|
PlayerHandshakeEvent(@NotNull String originalHandshake,
boolean cancelled)
Deprecated.
in favour of
PlayerHandshakeEvent(String, String, boolean) |
PlayerHandshakeEvent(@NotNull String originalHandshake,
@NotNull String originalSocketAddressHostname,
boolean cancelled)
Creates a new
PlayerHandshakeEvent . |
Modifier and Type | Method and Description |
---|---|
@NotNull net.kyori.adventure.text.Component |
failMessage()
Gets the message to display to the client when authentication fails.
|
void |
failMessage(@NotNull net.kyori.adventure.text.Component failMessage)
Sets the message to display to the client when authentication fails.
|
@NotNull String |
getFailMessage()
Deprecated.
use
failMessage() |
static @NotNull HandlerList |
getHandlerList() |
@NotNull HandlerList |
getHandlers() |
@NotNull String |
getOriginalHandshake()
Gets the original handshake string.
|
@NotNull String |
getOriginalSocketAddressHostname()
Gets the original socket address hostname.
|
@Nullable String |
getPropertiesJson()
Gets the profile properties.
|
@Nullable String |
getServerHostname()
Gets the server hostname string.
|
@Nullable String |
getSocketAddressHostname()
Gets the socket address hostname string.
|
@Nullable UUID |
getUniqueId()
Gets the unique id.
|
boolean |
isCancelled()
Determines if this event is cancelled.
|
boolean |
isFailed()
Determines if authentication failed.
|
void |
setCancelled(boolean cancelled)
Sets if this event is cancelled.
|
void |
setFailed(boolean failed)
Sets if authentication failed and the client should be disconnected.
|
void |
setFailMessage(@NotNull String failMessage)
Deprecated.
|
void |
setPropertiesJson(@NotNull String propertiesJson)
Sets the profile properties.
|
void |
setServerHostname(@NotNull String serverHostname)
Sets the server hostname string.
|
void |
setSocketAddressHostname(@NotNull String socketAddressHostname)
Sets the socket address hostname string.
|
void |
setUniqueId(@NotNull UUID uniqueId)
Sets the unique id.
|
callEvent, getEventName, isAsynchronous
@Deprecated public PlayerHandshakeEvent(@NotNull @NotNull String originalHandshake, boolean cancelled)
PlayerHandshakeEvent(String, String, boolean)
PlayerHandshakeEvent
.originalHandshake
- the original handshake stringcancelled
- if this event is enabledpublic PlayerHandshakeEvent(@NotNull @NotNull String originalHandshake, @NotNull @NotNull String originalSocketAddressHostname, boolean cancelled)
PlayerHandshakeEvent
.originalHandshake
- the original handshake stringoriginalSocketAddressHostname
- the original socket address hostnamecancelled
- if this event is enabledpublic boolean isCancelled()
When this event is cancelled, custom handshake logic will not be processed.
isCancelled
in interface Cancellable
true
if this event is cancelled, false
otherwisepublic void setCancelled(boolean cancelled)
When this event is cancelled, custom handshake logic will not be processed.
setCancelled
in interface Cancellable
cancelled
- true
if this event is cancelled, false
otherwise@NotNull public @NotNull String getOriginalHandshake()
@NotNull public @NotNull String getOriginalSocketAddressHostname()
This does not include the port.
In cases where this event is manually fired and the plugin wasn't updated yet, the default is "127.0.0.1"
.
@Nullable public @Nullable String getServerHostname()
This should not include the port.
public void setServerHostname(@NotNull @NotNull String serverHostname)
This should not include the port.
serverHostname
- the server hostname string@Nullable public @Nullable String getSocketAddressHostname()
This should not include the port.
public void setSocketAddressHostname(@NotNull @NotNull String socketAddressHostname)
This should not include the port.
socketAddressHostname
- the socket address hostname string@Nullable public @Nullable UUID getUniqueId()
public void setUniqueId(@NotNull @NotNull UUID uniqueId)
uniqueId
- the unique id@Nullable public @Nullable String getPropertiesJson()
This should be a valid JSON string.
public boolean isFailed()
When true
, the client connecting will be disconnected
with the fail message
.
true
if authentication failed, false
otherwisepublic void setFailed(boolean failed)
When true
, the client connecting will be disconnected
with the fail message
.
failed
- true
if authentication failed, false
otherwisepublic void setPropertiesJson(@NotNull @NotNull String propertiesJson)
This should be a valid JSON string.
propertiesJson
- the profile properties, as JSON@NotNull public @NotNull net.kyori.adventure.text.Component failMessage()
public void failMessage(@NotNull @NotNull net.kyori.adventure.text.Component failMessage)
failMessage
- the message to display to the client@NotNull @Deprecated public @NotNull String getFailMessage()
failMessage()
@Deprecated public void setFailMessage(@NotNull @NotNull String failMessage)
failMessage(Component)
failMessage
- the message to display to the client@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2021. All rights reserved.