Class KickedFromServerEvent.RedirectPlayer

java.lang.Object
com.velocitypowered.api.event.player.KickedFromServerEvent.RedirectPlayer
All Implemented Interfaces:
KickedFromServerEvent.ServerKickResult, ResultedEvent.Result
Enclosing class:
KickedFromServerEvent

public static final class KickedFromServerEvent.RedirectPlayer extends Object implements KickedFromServerEvent.ServerKickResult
Tells the proxy to redirect the player to another server.
  • Method Details

    • isAllowed

      public boolean isAllowed()
      Description copied from interface: ResultedEvent.Result
      Returns whether or not the event is allowed to proceed. Plugins may choose to skip denied events, and the proxy will respect the result of this method.
      Specified by:
      isAllowed in interface ResultedEvent.Result
      Returns:
      whether or not the event is allowed to proceed
    • getServer

      public @NonNull RegisteredServer getServer()
      Returns the target server to which the player should be redirected.
      Returns:
      the server to redirect to
    • getMessageComponent

      public @Nullable Component getMessageComponent()
      Returns the message that will be sent to the player after redirection. This may be null if the kick reason should be reused or nothing should be sent.
      Returns:
      the message component, or null
    • create

      public static KickedFromServerEvent.RedirectPlayer create(@NonNull RegisteredServer server, Component message)
      Creates a new redirect result to forward the player to the specified server. The specified message will be sent to the player after the redirection. Use Component.empty() to skip sending any messages to the player.
      Parameters:
      server - the server to send the player to
      message - the message will be sent to the player after redirecting
      Returns:
      the redirect result
    • create

      Creates a new redirect result to forward the player to the specified server. The kick reason will be displayed to the player
      Parameters:
      server - the server to send the player to
      Returns:
      the redirect result
    • toString

      public String toString()
      Overrides:
      toString in class Object