Class ServerInfo

java.lang.Object
com.velocitypowered.api.proxy.server.ServerInfo
All Implemented Interfaces:
Comparable<ServerInfo>

public final class ServerInfo extends Object implements Comparable<ServerInfo>
ServerInfo represents a server that a player can connect to. This object is immutable and safe for concurrent access.
  • Constructor Details

    • ServerInfo

      public ServerInfo(String name, InetSocketAddress address, @Nullable PlayerInfoForwarding forwardingMode)
      Creates a new ServerInfo object.
      Parameters:
      name - the name for the server
      address - the address of the server to connect to
      forwardingMode - the server info forwarding mode, or null if the mode from the config should be used
      Since:
      3.4.0
    • ServerInfo

      public ServerInfo(String name, InetSocketAddress address)
      Creates a new ServerInfo object.
      Parameters:
      name - the name for the server
      address - the address of the server to connect to
  • Method Details

    • getName

      public String getName()
      Gets the name of the server.
      Returns:
      the name of the server
    • getPlayerInfoForwardingMode

      public @Nullable PlayerInfoForwarding getPlayerInfoForwardingMode()
      Returns the forwarding mode used by the backend server to communicate with Velocity.
      Returns:
      the configured forwarding mode for the server, or null if the mode is inherited from the "player-info-forwarding-mode" set in the config
    • getAddress

      public InetSocketAddress getAddress()
      Gets the network address of the server.
      Returns:
      the InetSocketAddress of the server
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(ServerInfo o)
      Specified by:
      compareTo in interface Comparable<ServerInfo>