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

  • Constructor Details

  • 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.
      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.
      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()