Class AdvancedServerListAPI

java.lang.Object
ch.andre601.advancedserverlist.api.AdvancedServerListAPI

public class AdvancedServerListAPI extends Object
Core class of the API for AdvancedServerList.
Use get() to retrieve the instance currently used.
  • Method Details

    • get

      public static @NonNull AdvancedServerListAPI get()
      Retrieves the instance used of this API.
      If no instance has been made so far will a new one be created.
      Returns:
      Instance of this API.
    • addPlaceholderProvider

      public void addPlaceholderProvider(@NonNull PlaceholderProvider placeholderProvider)

      Adds the provided PlaceholderProvider to the list, if it passes the following checks:

      • Provided PlaceholderProvider is not null.
      • The identifier is not null or empty.
      • The identifier does not contain any spaces.
      • A PlaceholderProvider with the same identifier doesn't exist already.

      Not passing any of the above checks results in a InvalidPlaceholderProviderException being thrown.

      Parameters:
      placeholderProvider - The PlaceholderProvider to add.
      Throws:
      InvalidPlaceholderProviderException - When the provided PlaceholderProvider instance has a null or empty identifier, the identifier contains spaces or another provider with the same identifier is already loaded.
    • retrievePlaceholderProvider

      public @Nullable PlaceholderProvider retrievePlaceholderProvider(@NonNull String identifier)
      Retrieves the PlaceholderProvider associated with the given identifier, or null should no such entry exist.
      Parameters:
      identifier - The identifier to find a matching PlaceholderProvider for.
      Returns:
      Possibly-null PlaceholderProvider instance.