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 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
    • registerVirtualSpeaker

      void registerVirtualSpeaker(int x, int y, int z, @NotNull @NotNull String world, @NotNull @NotNull String media, SpeakerType speakerType, int radius, ExtraSpeakerOptions... extraOptions) throws InvalidThreadException, InvalidLocationException
      Register a virtual speaker at a location. This is a location that will play sound as if there's a speaker there, but there isn't.
      Parameters:
      x - x
      y - y
      z - z
      world - world
      media - The media source
      speakerType - speaker type
      radius - radius
      extraOptions - extra options (redstone requirement, loop, etc)
      Throws:
      InvalidThreadException - if called from the main thread. This is to prevent blocking the main thread with the underlying Sqlite database
      InvalidLocationException - if the location is not valid (this location is already occupied by a real or virtual speaker)
      Since:
      6.10.8
    • unregisterVirtualSpeaker

      void unregisterVirtualSpeaker(@NotNull @NotNull BasicSpeaker speaker) throws InvalidSpeakerException, InvalidThreadException
      Unregister a virtual speaker (which has been registered by the api)
      Parameters:
      speaker - speaker
      Throws:
      InvalidSpeakerException - if the speaker is not valid (already unregistered, or not registered by the api)
      InvalidThreadException - if called from the main thread.
      Since:
      6.10.8
    • 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