Class PlayerHandshakeEvent

java.lang.Object
org.bukkit.event.Event
com.destroystokyo.paper.event.player.PlayerHandshakeEvent
All Implemented Interfaces:
Cancellable

@NullMarked 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 run.

WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS

Since:
1.9.4
  • Constructor Details

    • PlayerHandshakeEvent

      @Deprecated @Internal public PlayerHandshakeEvent(String originalHandshake, boolean cancelled)
      Deprecated.
    • PlayerHandshakeEvent

      @Internal public PlayerHandshakeEvent(String originalHandshake, String originalSocketAddressHostname, boolean cancelled)
  • Method Details

    • getOriginalHandshake

      public String getOriginalHandshake()
      Gets the original handshake string.
      Returns:
      the original handshake string
      Since:
      1.9.4
    • getOriginalSocketAddressHostname

      public 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
      Since:
      1.16.5
    • getServerHostname

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

      This should not include the port.

      Returns:
      the server hostname string
      Since:
      1.9.4
    • setServerHostname

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

      This should not include the port.

      Parameters:
      serverHostname - the server hostname string
      Since:
      1.9.4
    • getSocketAddressHostname

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

      This should not include the port.

      Returns:
      the socket address hostname string
      Since:
      1.9.4
    • setSocketAddressHostname

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

      This should not include the port.

      Parameters:
      socketAddressHostname - the socket address hostname string
      Since:
      1.9.4
    • getUniqueId

      public @Nullable UUID getUniqueId()
      Gets the unique id.
      Returns:
      the unique id
      Since:
      1.9.4
    • setUniqueId

      public void setUniqueId(UUID uniqueId)
      Sets the unique id.
      Parameters:
      uniqueId - the unique id
      Since:
      1.9.4
    • getPropertiesJson

      public @Nullable String getPropertiesJson()
      Gets the profile properties.

      This should be a valid JSON string.

      Returns:
      the profile properties, as JSON
      Since:
      1.9.4
    • 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
      Since:
      1.9.4
    • 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
      Since:
      1.9.4
    • setPropertiesJson

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

      This should be a valid JSON string.

      Parameters:
      propertiesJson - the profile properties, as JSON
      Since:
      1.9.4
    • failMessage

      public Component failMessage()
      Gets the message to display to the client when authentication fails.
      Returns:
      the message to display to the client
      Since:
      1.16.5
    • failMessage

      public void failMessage(Component failMessage)
      Sets the message to display to the client when authentication fails.
      Parameters:
      failMessage - the message to display to the client
      Since:
      1.16.5
    • getFailMessage

      @Deprecated public String getFailMessage()
      Deprecated.
      Gets the message to display to the client when authentication fails.
      Returns:
      the message to display to the client
      Since:
      1.9.4
    • setFailMessage

      @Deprecated public void setFailMessage(String failMessage)
      Deprecated.
      Sets the message to display to the client when authentication fails.
      Parameters:
      failMessage - the message to display to the client
      Since:
      1.9.4
    • isCancelled

      public boolean isCancelled()
      Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

      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
      Since:
      1.9.4
    • setCancelled

      public void setCancelled(boolean cancel)
      Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

      When this event is cancelled, custom handshake logic will not be processed.

      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
      Since:
      1.9.4
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
      Since:
      1.9.4
    • getHandlerList

      public static HandlerList getHandlerList()
      Since:
      1.9.4