Class ServerPing.Builder

java.lang.Object
com.velocitypowered.api.proxy.server.ServerPing.Builder
Enclosing class:
ServerPing

public static final class ServerPing.Builder extends Object
A builder for ServerPing objects.
  • Method Details

    • version

      public ServerPing.Builder version(ServerPing.Version version)
      Uses the modified version info in the response.
      Parameters:
      version - version info to set
      Returns:
      this builder, for chaining
    • onlinePlayers

      public ServerPing.Builder onlinePlayers(int onlinePlayers)
      Uses the modified onlinePlayers number in the response.
      Parameters:
      onlinePlayers - number for online players to set
      Returns:
      this builder, for chaining
    • maximumPlayers

      public ServerPing.Builder maximumPlayers(int maximumPlayers)
      Uses the modified maximumPlayers number in the response. This will not modify the actual maximum players that can join the server.
      Parameters:
      maximumPlayers - number for maximum players to set
      Returns:
      this builder, for chaining
    • samplePlayers

      public ServerPing.Builder samplePlayers(ServerPing.SamplePlayer... players)
      Uses the modified players array in the response.
      Parameters:
      players - array of SamplePlayers to set
      Returns:
      this builder, for chaining
    • modType

      public ServerPing.Builder modType(String modType)
      Uses the modified modType in the response.
      Parameters:
      modType - the mod type to set
      Returns:
      this builder, for chaining
    • mods

      public ServerPing.Builder mods(ModInfo.Mod... mods)
      Uses the modified mods array in the response.
      Parameters:
      mods - array of mods to use
      Returns:
      this builder, for chaining
    • mods

      public ServerPing.Builder mods(ModInfo mods)
      Uses the modified mods list in the response.
      Parameters:
      mods - the mods list to use
      Returns:
      this builder, for chaining
    • clearMods

      public ServerPing.Builder clearMods()
      Clears the current list of mods to use in the response.
      Returns:
      this builder, for chaining
    • clearSamplePlayers

      public ServerPing.Builder clearSamplePlayers()
      Clears the current list of PlayerSamples to use in the response.
      Returns:
      this builder, for chaining
    • notModCompatible

      public ServerPing.Builder notModCompatible()
      Defines the server as mod incompatible in the response.
      Returns:
      this builder, for chaining
    • nullPlayers

      public ServerPing.Builder nullPlayers()
      Enables nulling Players in the response. This will display the player count as ???.
      Returns:
      this builder, for chaining
    • description

      public ServerPing.Builder description(Component description)
      Uses the description Component in the response.
      Parameters:
      description - Component to use as the description.
      Returns:
      this builder, for chaining
    • favicon

      public ServerPing.Builder favicon(Favicon favicon)
      Uses the favicon in the response.
      Parameters:
      favicon - Favicon instance to use.
      Returns:
      this builder, for chaining
    • clearFavicon

      public ServerPing.Builder clearFavicon()
      Clears the current favicon used in the response.
      Returns:
      this builder, for chaining
    • build

      public ServerPing build()
      Uses the information from this builder to create a new ServerPing instance. The builder can be re-used after this event has been called.
      Returns:
      a new ServerPing instance
    • getVersion

      public ServerPing.Version getVersion()
    • getOnlinePlayers

      public int getOnlinePlayers()
    • getMaximumPlayers

      public int getMaximumPlayers()
    • getSamplePlayers

      public List<ServerPing.SamplePlayer> getSamplePlayers()
    • getDescriptionComponent

      public Optional<Component> getDescriptionComponent()
    • getFavicon

      public Optional<Favicon> getFavicon()
    • getModType

      public String getModType()
    • getMods

      public List<ModInfo.Mod> getMods()
    • toString

      public String toString()
      Overrides:
      toString in class Object