Enum Class ServerSelectorType

java.lang.Object
java.lang.Enum<ServerSelectorType>
eu.cloudnetservice.modules.bridge.player.executor.ServerSelectorType
All Implemented Interfaces:
Serializable, Comparable<ServerSelectorType>, Constable

public enum ServerSelectorType extends Enum<ServerSelectorType>
The server selector type provides several constants to compare services based conditions.
Since:
4.0
  • Enum Constant Details

    • LOWEST_PLAYERS

      public static final ServerSelectorType LOWEST_PLAYERS
      The service with the lowest player count is preferred.
    • HIGHEST_PLAYERS

      public static final ServerSelectorType HIGHEST_PLAYERS
      The service with the highest player count is preferred.
    • RANDOM

      public static final ServerSelectorType RANDOM
      A random service is chosen.
  • Field Details

    • comparator

      private final Comparator<eu.cloudnetservice.driver.service.ServiceInfoSnapshot> comparator
  • Constructor Details

    • ServerSelectorType

      private ServerSelectorType(@NonNull @NonNull Comparator<eu.cloudnetservice.driver.service.ServiceInfoSnapshot> comparator)
      Creates a new server selector type enum constant with the given service comparator.
      Parameters:
      comparator - the comparator to apply to the services.
      Throws:
      NullPointerException - if the comparator is null.
  • Method Details

    • values

      public static ServerSelectorType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ServerSelectorType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • comparator

      @NonNull public @NonNull Comparator<eu.cloudnetservice.driver.service.ServiceInfoSnapshot> comparator()
      Gets the comparator used to sort the services infos according to the server selector type.
      Returns:
      the comparator for the server selector.