Interface WorldApi


public interface WorldApi
The WorldApi is a collection of methods to interact with features that is linked to worlds. This API is only available if the OpenAudioMc plugin on spigot, and is not available on the bungee side.
  • Method Summary

    Modifier and Type
    Method
    Description
    static WorldApi
    Get an instance of the world api.
    getRegionsAt(int x, int y, int z, @NotNull String world)
    Get all regions at a location
    @Nullable BasicSpeaker
    getSpeakerAt(int x, int y, int z, @NotNull String world)
    Get a speaker at a location, or null if invalid
    void
    registerRegion(String worldName, String regionId, RegionMediaOptions regionMedia)
    Register a region in a world.
    void
    registerTempRegion(String worldName, String regionId, RegionMediaOptions regionMedia, int duration)
    Register a temporary region in a world Important: - this will overwrite current temporary regions - this will throw an invalid region exception if the region is not found - this will throw an unknown world exception if the world is not loaded - this will throw an invalid region exception if the region already has permanent media - this will throw an invalid thread exception if not called from the main thread
    void
    unregisterRegion(String worldName, String regionId)
    Unregister a region from the world
  • Method Details

    • getInstance

      static WorldApi getInstance()
      Get an instance of the world api. May be null if the plugin is not loaded yet
      Returns:
      instance
    • getRegionsAt

      @NotNull @NotNull Collection<AudioRegion> getRegionsAt(int x, int y, int z, @NotNull @NotNull String world)
      Get all regions at a location
      Parameters:
      x - x
      y - y
      z - z
      world - world
      Returns:
      regions
    • getSpeakerAt

      @Nullable @Nullable BasicSpeaker getSpeakerAt(int x, int y, int z, @NotNull @NotNull String world)
      Get a speaker at a location, or null if invalid
      Parameters:
      x - x
      y - y
      z - z
      world - world
      Returns:
      speaker
    • registerRegion

      void registerRegion(String worldName, String regionId, RegionMediaOptions regionMedia) throws UnknownWorldException, InvalidThreadException, InvalidRegionException
      Register a region in a world. Important: - this will overwrite current temporary regions - this will throw an invalid region exception if the region is not found - this will throw an unknown world exception if the world is not loaded - this will throw an invalid region exception if the region already has permanent media - this will throw an invalid thread exception if not called from the main thread
      Parameters:
      worldName - world
      regionId - id
      regionMedia - the media to attach
      Throws:
      UnknownWorldException - if the world is not loaded
      InvalidRegionException - if the region is not found
      InvalidThreadException - if not called from the main thread
      Since:
      6.10.2
    • registerTempRegion

      void registerTempRegion(String worldName, String regionId, RegionMediaOptions regionMedia, int duration) throws UnknownWorldException, InvalidThreadException, InvalidRegionException
      Register a temporary region in a world Important: - this will overwrite current temporary regions - this will throw an invalid region exception if the region is not found - this will throw an unknown world exception if the world is not loaded - this will throw an invalid region exception if the region already has permanent media - this will throw an invalid thread exception if not called from the main thread
      Parameters:
      worldName - world
      regionId - the region to targe
      regionMedia - the media to attach
      duration - the duration in seconds
      Throws:
      UnknownWorldException - if the world is not loaded
      InvalidRegionException - if the region is not found
      InvalidThreadException - if not called from the main thread
      Since:
      6.10.2
    • unregisterRegion

      void unregisterRegion(String worldName, String regionId) throws InvalidThreadException
      Unregister a region from the world
      Parameters:
      worldName - world
      regionId - region id
      Throws:
      InvalidThreadException - if not called from the main thread
      Since:
      6.10.2