Class KickedFromServerEvent

All Implemented Interfaces:

@AwaitingEvent public final class KickedFromServerEvent extends Object implements ResultedEvent<KickedFromServerEvent.ServerKickResult>
Fired when a player is kicked from a server. You may either allow Velocity to kick the player (with an optional reason override) or redirect the player to a separate server. By default, Velocity will notify the user (if they are already connected to a server) or disconnect them (if they are not on a server and no other servers are available). Velocity will wait on this event to finish firing before taking the specified action.
  • Constructor Details

    • KickedFromServerEvent

      public KickedFromServerEvent(Player player, RegisteredServer server, @Nullable Component originalReason, boolean duringServerConnect, KickedFromServerEvent.ServerKickResult result)
      Creates a KickedFromServerEvent instance.
      player - the player affected
      server - the server the player disconnected from
      originalReason - the reason for being kicked, optional
      duringServerConnect - whether or not the player was kicked during the connection process
      result - the initial result
  • Method Details

    • getResult

      public @NonNull KickedFromServerEvent.ServerKickResult getResult()
      Description copied from interface: ResultedEvent
      Returns the result associated with this event.
      Specified by:
      getResult in interface ResultedEvent<KickedFromServerEvent.ServerKickResult>
      the result of this event
    • setResult

      public void setResult(@NonNull KickedFromServerEvent.ServerKickResult result)
      Description copied from interface: ResultedEvent
      Sets the result of this event. The result must be non-null.
      Specified by:
      setResult in interface ResultedEvent<KickedFromServerEvent.ServerKickResult>
      result - the new result
    • getPlayer

      public @NonNull Player getPlayer()
      The player who has been kicked out.
      the player affected
    • getServer

      public @NonNull RegisteredServer getServer()
      The server from which the player has been kicked.
      the server the player disconnected from
    • getServerKickReason

      public Optional<Component> getServerKickReason()
      The reason why the player was kicked, the server may or may not provide this reason.
      the reason for being kicked, optional
    • kickedDuringServerConnect

      public boolean kickedDuringServerConnect()
      Returns whether or not the player got kicked while connecting to another server.
      whether or not the player got kicked
    • kickedDuringLogin

      @Deprecated public boolean kickedDuringLogin()
      kickedDuringServerConnect() has a better name and reflects the actual result
      Returns whether or not the player got kicked while logging in.
      whether or not the player got kicked