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

  • Constructor Details

    • PlayerHandshakeEvent

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

      @Internal public PlayerHandshakeEvent(String originalHandshake, String originalSocketAddressHostname, boolean cancelled)
  • 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 cancel)
      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:
      cancel - true if this event is cancelled, false otherwise
    • getOriginalHandshake

      public String getOriginalHandshake()
      Gets the original handshake string.
      Returns:
      the original handshake string
    • 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
    • getServerHostname

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

      This should not include the port.

      Returns:
      the server hostname string
    • setServerHostname

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

      This should not include the port.

      Parameters:
      serverHostname - the server hostname string
    • getSocketAddressHostname

      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(String socketAddressHostname)
      Sets the socket address hostname string.

      This should not include the port.

      Parameters:
      socketAddressHostname - the socket address hostname string
    • getUniqueId

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

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

      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(String propertiesJson)
      Sets the profile properties.

      This should be a valid JSON string.

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

      public 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(Component failMessage)
      Sets the message to display to the client when authentication fails.
      Parameters:
      failMessage - the message to display to the client
    • 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
    • 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
    • getHandlers

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

      public static HandlerList getHandlerList()