Package com.craftmend.openaudiomc.api
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 TypeMethodDescriptionstatic WorldApi
Get an instance of the world api.@NotNull Collection<AudioRegion>
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 invalidvoid
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 threadvoid
unregisterRegion
(String worldName, String regionId) Unregister a region from the world
-
Method Details
-
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
- xy
- yz
- zworld
- world- Returns:
- regions
-
getSpeakerAt
Get a speaker at a location, or null if invalid- Parameters:
x
- xy
- yz
- zworld
- 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
- worldregionId
- idregionMedia
- the media to attach- Throws:
UnknownWorldException
- if the world is not loadedInvalidRegionException
- if the region is not foundInvalidThreadException
- 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
- worldregionId
- the region to targeregionMedia
- the media to attachduration
- the duration in seconds- Throws:
UnknownWorldException
- if the world is not loadedInvalidRegionException
- if the region is not foundInvalidThreadException
- if not called from the main thread- Since:
- 6.10.2
-
unregisterRegion
Unregister a region from the world- Parameters:
worldName
- worldregionId
- region id- Throws:
InvalidThreadException
- if not called from the main thread- Since:
- 6.10.2
-