Class ServerConnectedEvent

java.lang.Object
com.velocitypowered.api.event.player.ServerConnectedEvent

@AwaitingEvent public final class ServerConnectedEvent extends Object
This event is fired once the player has successfully connected to the target server and the connection to the previous server has been de-established.

Note: For historical reasons, Velocity does wait on this event to finish firing before continuing the server connection process. This behavior is deprecated and likely to be removed in Polymer.

  • Constructor Details

    • ServerConnectedEvent

      public ServerConnectedEvent(Player player, RegisteredServer server, @Nullable RegisteredServer previousServer)
      Constructs a ServerConnectedEvent.
      Parameters:
      player - the player that was connected
      server - the server the player was connected to
      previousServer - the server the player was previously connected to, null if none
  • Method Details

    • getPlayer

      public Player getPlayer()
      Returns the player involved in this event.
      Returns:
      the Player who connected
    • getServer

      public RegisteredServer getServer()
      Returns the server the player successfully connected to.
      Returns:
      the RegisteredServer the player connected to
    • getPreviousServer

      public Optional<RegisteredServer> getPreviousServer()
      Returns the server the player was previously connected to, if any.
      Returns:
      an Optional of the previous RegisteredServer, or empty if none
    • toString

      public String toString()
      Overrides:
      toString in class Object