Class PlayerHandshakeEvent
- All Implemented Interfaces:
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
ConstructorDescriptionPlayerHandshakeEvent
(@NotNull String originalHandshake, boolean cancelled) Deprecated.PlayerHandshakeEvent
(@NotNull String originalHandshake, @NotNull String originalSocketAddressHostname, boolean cancelled) Creates a newPlayerHandshakeEvent
. -
Method Summary
Modifier and TypeMethodDescriptionGets the message to display to the client when authentication fails.void
failMessage
(@NotNull Component failMessage) Sets the message to display to the client when authentication fails.Deprecated.usefailMessage()
static @NotNull HandlerList
Gets the original handshake string.Gets the original socket address hostname.Gets the profile properties.Gets the server hostname string.Gets the socket address hostname string.Gets the unique id.boolean
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.Methods inherited from class org.bukkit.event.Event
asynchronous, callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerHandshakeEvent
@Deprecated public PlayerHandshakeEvent(@NotNull @NotNull String originalHandshake, boolean cancelled) Deprecated.Creates a newPlayerHandshakeEvent
.- Parameters:
originalHandshake
- the original handshake stringcancelled
- if this event is enabled
-
PlayerHandshakeEvent
public PlayerHandshakeEvent(@NotNull @NotNull String originalHandshake, @NotNull @NotNull String originalSocketAddressHostname, boolean cancelled) Creates a newPlayerHandshakeEvent
.- Parameters:
originalHandshake
- the original handshake stringoriginalSocketAddressHostname
- the original socket address hostnamecancelled
- if this event is enabled
-
-
Method Details
-
isCancelled
public boolean isCancelled()Determines if this event is cancelled.When this event is cancelled, custom handshake logic will not be processed.
- Specified by:
isCancelled
in interfaceCancellable
- Returns:
true
if this event is cancelled,false
otherwise
-
setCancelled
public void setCancelled(boolean cancelled) Sets if this event is cancelled.When this event is cancelled, custom handshake logic will not be processed.
- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancelled
-true
if this event is cancelled,false
otherwise
-
getOriginalHandshake
Gets the original handshake string.- Returns:
- the original handshake string
-
getOriginalSocketAddressHostname
Gets the original socket address hostname.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"
.- Returns:
- the original socket address hostname
-
getServerHostname
Gets the server hostname string.This should not include the port.
- Returns:
- the server hostname string
-
setServerHostname
Sets the server hostname string.This should not include the port.
- Parameters:
serverHostname
- the server hostname string
-
getSocketAddressHostname
Gets the socket address hostname string.This should not include the port.
- Returns:
- the socket address hostname string
-
setSocketAddressHostname
Sets the socket address hostname string.This should not include the port.
- Parameters:
socketAddressHostname
- the socket address hostname string
-
getUniqueId
Gets the unique id.- Returns:
- the unique id
-
setUniqueId
Sets the unique id.- Parameters:
uniqueId
- the unique id
-
getPropertiesJson
Gets the profile properties.This should be a valid JSON string.
- Returns:
- the profile properties, as JSON
-
isFailed
public boolean isFailed()Determines if authentication failed.When
true
, the client connecting will be disconnected with thefail message
.- Returns:
true
if authentication failed,false
otherwise
-
setFailed
public void setFailed(boolean failed) Sets if authentication failed and the client should be disconnected.When
true
, the client connecting will be disconnected with thefail message
.- Parameters:
failed
-true
if authentication failed,false
otherwise
-
setPropertiesJson
Sets the profile properties.This should be a valid JSON string.
- Parameters:
propertiesJson
- the profile properties, as JSON
-
failMessage
Gets the message to display to the client when authentication fails.- Returns:
- the message to display to the client
-
failMessage
Sets the message to display to the client when authentication fails.- Parameters:
failMessage
- the message to display to the client
-
getFailMessage
Deprecated.usefailMessage()
Gets the message to display to the client when authentication fails.- Returns:
- the message to display to the client
-
setFailMessage
Deprecated.Sets the message to display to the client when authentication fails.- Parameters:
failMessage
- the message to display to the client
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-
PlayerHandshakeEvent(@org.jetbrains.annotations.NotNull java.lang.String,@org.jetbrains.annotations.NotNull java.lang.String,boolean)