java.lang.Object
com.winterhavenmc.library.messagebuilder.adapters.resources.configuration.BukkitWorldRepository
All Implemented Interfaces:
ConfigProvider<EnabledWorldsSetting>, WorldRepository

public final class BukkitWorldRepository extends Object implements WorldRepository
  • Method Details

    • create

      public static WorldRepository create(org.bukkit.plugin.Plugin plugin, WorldNameResolver worldNameResolver, SpawnLocationResolver spawnLocationResolver)
      Static factory method creates instance of WorldRepository
      Parameters:
      plugin - an instance of the plugin
      Returns:
      an WorldRepository
    • get

      public EnabledWorldsSetting get()
      Description copied from interface: WorldRepository
      Returns the current EnabledWorldsSetting.
      Specified by:
      get in interface ConfigProvider<EnabledWorldsSetting>
      Specified by:
      get in interface WorldRepository
      Returns:
      the current enabled worlds setting
    • enabledUids

      public List<UUID> enabledUids()
      Description copied from interface: WorldRepository
      Returns a list of world uuids that are enabled by the plugin config. Only world uuids that match a current server world are included in the list.
      Specified by:
      enabledUids in interface WorldRepository
      Returns:
      List of enabled world uuids
    • enabledNames

      public List<String> enabledNames()
      Description copied from interface: WorldRepository
      get collection of enabled world names from registry
      Specified by:
      enabledNames in interface WorldRepository
      Returns:
      a Collection of String containing enabled world names
    • aliasOrName

      public Optional<String> aliasOrName(UUID worldUid)
      Specified by:
      aliasOrName in interface WorldRepository
    • isEnabled

      public boolean isEnabled(UUID worldUID)
      Check if a world is enabled by bukkit world UID
      Specified by:
      isEnabled in interface WorldRepository
      Parameters:
      worldUID - Unique Identifier for world
      Returns:
      true if world is enabled, false if disabled
    • isEnabled

      public boolean isEnabled(String worldName)
      Check if a world is enabled by name
      Specified by:
      isEnabled in interface WorldRepository
      Parameters:
      worldName - name of world as string to check
      Returns:
      true if world is enabled, false if disabled
    • contains

      @Contract(pure=true) public boolean contains(UUID uuid)
      check if uuid is present in the registry
      Specified by:
      contains in interface WorldRepository
      Parameters:
      uuid - the uuid of a world
      Returns:
      boolean true if the world uuid is present in the registry, or false if not
    • spawnLocation

      public Optional<org.bukkit.Location> spawnLocation(UUID worldUid)
      Specified by:
      spawnLocation in interface WorldRepository