OpenAudioMc + WorldGuard
You can use WorldGuard to create regions that can be used to play music in. This is useful if you want to play music in a specific area, setup shows or create an ambient music system. This article will go over all our region commands and how to use them.
Please note that this feature obliviously requires WorldGuard to be installed on your server.
Adding music to a region or area
To create a region you need to use the /oa region create <regionName> <media>
command.
This will link a region to a specific media file. This means that when a player enters the region, the media will start playing and when they leave it will stop.
The region name has to be the same as the WorldGuard region name. If you want to create a region called spawn
you need to have a WorldGuard region called spawn
as well.
By default, overlapping regions will stack. This means that if you have 2 regions on one location, and both have music, both will play at the same time. You can enable priority support within the OpenAudioMc config, at which point the region with the highest priority will play.
(regions are stored per-world, and we support the __global__
region name to target an entire world with the lowest priority)
(the create command also accepts an optional third argument to set the volume while its being created)
An example of a region command would be: /oa region create spawn files:spawn-music.mp3
.
Removing music from a region or area
To remove music from a region you need to use the /oa region delete <regionName>
command.
This will remove the region from the region list and stop any music that is playing in that region. Note that the actual WorldGuard region will not be deleted.
Editing a region configuration
Regions have a few properties that can be edited. These properties are:
- Volume: The volume at which the music will play. This allows you to mix multiple regions together or configure a soft ambient music system.
- Fade time: The time (in milliseconds) it takes for the music to fade in or out. This allows you to create smooth transitions between regions.
To edit a region you need to use the /oa region edit <property> <regionName> <value>
command.
An example of an edit command would be: /oa region edit volume spawn 50
or /oa region edit fade spawn 5
.
You can also use a GUI to edit regions, this can be done by using the /oa region gui
command.
Setting up temp/show regions
You can use regions to create temporary regions that will synchronized play music for a specific amount of time. This is useful if you want to create a show or play music for a specific duration.
To create a temp region you need to use the /oa region temp <regionName> <media> <duration in seconds>
command, where the duration is the amount of time the music will play for.
Extra configuration
Regions are only initialized in memory when they are first called upon (either by an edit, or someone walking in one with the web client open). This means that the 'start' point from where its synchronized will never be the same across regions.
We do offer a configuration option for spigot instances, which (when enabled) will forcefully hydrate all regions on startup (sorted by world, timing will still not be equal between different worlds).
This may consume consume more memory on servers with an absurd amount of regions, and can be disabled (look for options.hydrate-regions-on-boot
) if you don't need it.
Running commands through console or other plugins
Regions are stored and manged per-world. This is fine under normal conditions, because the player can look at the player to find which world should be targeted when running commands.
This doesn't work when running commands through the console or other plugins, the plugin uses a value in the config to determine which world should be targeted. (look for fallback-world-name
).
If this isn't enough, then you can also manually specify a world to target in each command, by using the --world=worldName
modifier. Example: /oa region create spawn files:spawn-music.mp3 --world=world
.
Permissions
This permission is required to use the /oa region command
Default access level: op