Interface WhitelistManager


public interface WhitelistManager
A service for managing the whitelist of allowed players.
Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(PlayerProfile profile)
    Adds a profile to the list.
    default boolean
    add(UUID uuid, String name)
    Adds an identity to the list.
    default boolean
    allows(UUID uuid)
    Checks whether an identity may connect as far as the whitelist is concerned.
    boolean
    contains(UUID uuid)
    Checks whether an identity is listed, regardless of whether the whitelist is enforced.
    boolean
    Checks whether the whitelist is being enforced.
    boolean
    enabled(boolean enabled)
    Starts or stops enforcing the whitelist.
    Gets the listed identities.
    void
    Loads the whitelist.
    boolean
    remove(UUID uuid)
    Removes an identity from the list.
    int
    Gets how many identities are listed.
  • Method Details

    • load

      void load()
      Loads the whitelist.
    • enabled

      @Contract(pure=true) boolean enabled()
      Checks whether the whitelist is being enforced.
      Returns:
      true when only listed players may connect
      Since:
      0.1.0
    • enabled

      boolean enabled(boolean enabled)
      Starts or stops enforcing the whitelist.

      This does not disconnect anyone. Fidorial kicks the players who are no longer allowed separately, so that a change made by other means does not carry that side effect.

      Parameters:
      enabled - whether the whitelist should be enforced
      Returns:
      true when the setting actually changed
      Since:
      0.1.0
    • contains

      @Contract(pure=true) boolean contains(UUID uuid)
      Checks whether an identity is listed, regardless of whether the whitelist is enforced.
      Parameters:
      uuid - the player identity
      Returns:
      true when the identity is on the list
      Since:
      0.1.0
    • allows

      @Contract(pure=true) default boolean allows(UUID uuid)
      Checks whether an identity may connect as far as the whitelist is concerned.

      This is the question the login check asks, and the only one it asks. The whitelist is enforced for everyone once enabled: operators are not exempt, so an operator who is not listed is refused like anyone else.

      Parameters:
      uuid - the player identity
      Returns:
      true when the whitelist is not enforced, or the identity is listed
      Since:
      0.1.0
    • add

      boolean add(PlayerProfile profile)
      Adds a profile to the list.
      Parameters:
      profile - the profile to allow
      Returns:
      true when the identity was not already listed
      Since:
      0.1.0
    • add

      default boolean add(UUID uuid, String name)
      Adds an identity to the list.
      Parameters:
      uuid - the identity to allow
      name - the name to record for display
      Returns:
      true when the identity was not already listed
      Since:
      0.1.0
    • remove

      boolean remove(UUID uuid)
      Removes an identity from the list.
      Parameters:
      uuid - the identity to remove
      Returns:
      true when the identity was actually listed
      Since:
      0.1.0
    • entries

      @Contract(pure=true) Stream<PlayerProfile> entries()
      Gets the listed identities.
      Returns:
      the entries, ordered by name
      Since:
      0.1.0
    • totalEntries

      @Contract(pure=true) int totalEntries()
      Gets how many identities are listed.
      Returns:
      the number of entries
      Since:
      0.1.0