Class PlayerChooseInitialServerEvent

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

@AwaitingEvent public class PlayerChooseInitialServerEvent extends Object
Fired when a player has finished the login process, and we need to choose the first server to connect to. Velocity will wait on this event to finish firing before initiating the connection but you should try to limit the work done in this event. Failures will be handled by KickedFromServerEvent as normal.
  • Constructor Details

    • PlayerChooseInitialServerEvent

      public PlayerChooseInitialServerEvent(Player player, @Nullable RegisteredServer initialServer)
      Constructs a PlayerChooseInitialServerEvent.
      Parameters:
      player - the player that was connected
      initialServer - the initial server selected, may be null
  • Method Details

    • getPlayer

      public Player getPlayer()
    • getInitialServer

      public Optional<RegisteredServer> getInitialServer()
    • setInitialServer

      public void setInitialServer(@Nullable RegisteredServer server)
      Sets the new initial server.
      Parameters:
      server - the initial server the player should connect to
    • toString

      public String toString()
      Overrides:
      toString in class Object