Package com.destroystokyo.paper.event.player

# Class PlayerHandshakeEvent

java.lang.Object
org.bukkit.event.Event
com.destroystokyo.paper.event.player.PlayerHandshakeEvent

All Implemented Interfaces:
  `Cancellable`

public class PlayerHandshakeEvent extends Event implements Cancellable
This event is fired during a player handshake.

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

Constructors
Constructor
Description
`PlayerHandshakeEvent(@NotNull String originalHandshake, boolean cancelled)`
Deprecated.
in favour of `PlayerHandshakeEvent(@org.jetbrains.annotations.NotNull java.lang.String,@org.jetbrains.annotations.NotNull java.lang.String,boolean)`
`PlayerHandshakeEvent(@NotNull String originalHandshake, @NotNull String originalSocketAddressHostname, boolean cancelled)`
Creates a new `PlayerHandshakeEvent`.

## Method Summary

Modifier and Type
Method
Description
`@NotNull Component`
`failMessage()`
Gets 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.
`@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.
use `failMessage(Component)`
`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

`callEvent, getEventName, isAsynchronous`

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

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

## Constructor Details

### PlayerHandshakeEvent

@Deprecated public PlayerHandshakeEvent(@NotNull @NotNull String originalHandshake, boolean cancelled)
Deprecated.
in favour of `PlayerHandshakeEvent(@org.jetbrains.annotations.NotNull java.lang.String,@org.jetbrains.annotations.NotNull java.lang.String,boolean)`
Creates a new `PlayerHandshakeEvent`.

Parameters:
  `originalHandshake` - the original handshake string
  `cancelled` - if this event is enabled

### PlayerHandshakeEvent

public PlayerHandshakeEvent(@NotNull @NotNull String originalHandshake, @NotNull @NotNull String originalSocketAddressHostname, boolean cancelled)
Creates a new `PlayerHandshakeEvent`.

Parameters:
  `originalHandshake` - the original handshake string
  `originalSocketAddressHostname` - the original socket address hostname
  `cancelled` - 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 interface `Cancellable`
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 interface `Cancellable`
Parameters:
  `cancelled` - `true` if this event is cancelled, `false` otherwise

### getOriginalHandshake

@NotNull public @NotNull String getOriginalHandshake()
Gets the original handshake string.

Returns:
  the original handshake string

### getOriginalSocketAddressHostname

@NotNull public @NotNull 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

@Nullable public @Nullable String getServerHostname()
Gets the server hostname string.

This should not include the port.

Returns:
  the server hostname string

### setServerHostname

public void setServerHostname(@NotNull @NotNull String serverHostname)
Sets the server hostname string.

This should not include the port.

Parameters:
  `serverHostname` - the server hostname string

### getSocketAddressHostname

@Nullable public @Nullable String getSocketAddressHostname()
Gets the socket address hostname string.

This should not include the port.

Returns:
  the socket address hostname string

### setSocketAddressHostname

public void setSocketAddressHostname(@NotNull @NotNull String socketAddressHostname)
Sets the socket address hostname string.

This should not include the port.

Parameters:
  `socketAddressHostname` - the socket address hostname string

### getUniqueId

@Nullable public @Nullable UUID getUniqueId()
Gets the unique id.

Returns:
  the unique id

### setUniqueId

public void setUniqueId(@NotNull @NotNull UUID uniqueId)
Sets the unique id.

Parameters:
  `uniqueId` - the unique id

### getPropertiesJson

@Nullable public @Nullable String 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 the `fail 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 the `fail message`.

Parameters:
  `failed` - `true` if authentication failed, `false` otherwise

### setPropertiesJson

public void setPropertiesJson(@NotNull @NotNull String propertiesJson)
Sets the profile properties.

This should be a valid JSON string.

Parameters:
  `propertiesJson` - the profile properties, as JSON

### failMessage

@NotNull public @NotNull Component failMessage()
Gets the message to display to the client when authentication fails.

Returns:
  the message to display to the client

### failMessage

public void failMessage(@NotNull @NotNull Component failMessage)
Sets the message to display to the client when authentication fails.

Parameters:
  `failMessage` - the message to display to the client

### getFailMessage

@NotNull @Deprecated public @NotNull String getFailMessage()
Deprecated.
use `failMessage()`
Gets the message to display to the client when authentication fails.

Returns:
  the message to display to the client

### setFailMessage

@Deprecated public void setFailMessage(@NotNull @NotNull String failMessage)
Deprecated.
use `failMessage(Component)`
Sets the message to display to the client when authentication fails.

Parameters:
  `failMessage` - the message to display to the client

### getHandlers

@NotNull public @NotNull HandlerList getHandlers()

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()