Skip to content

WorldGuard Integration

Jon McPherson edited this page May 1, 2017 · 5 revisions

The WorldGuard region integration is the most powerful and useful feature in AudioConnect. Using custom region flags, you can define location based audio and control how it is played with region and track settings.

Region Flags

There are 2 new custom flags

These flags use property based values where properties are in the format <key>=<value> and separated by a colon ':'.


audio

The audio flag is used to define audio sources and settings on a region.

Flag Type: List of Properties (separated by a comma)
Flag Format: id=<audio-id>[:track=<track-id>][:time=<day-time>]

Properties:

key value required
id The identifier of an audio source to play true
track The identifier of an audio track to play on false
time When to play: day, night, morning, afternoon false

The id= can be omitted if all other properties are undefined so that only the audio-id is specified.

Example:

/region flag <region-id> audio music-1,music-3,id=midnight:time=night,id=crickets:track=background:time=night

  • Play music-1 and music-3 on the default track at any time of day
  • Play midnight on the default track at night
  • Play crickets on the background track at night

Notes:

The verbosity of this flag is not ideal because the command may exceed the size limit in-game. A future update will add plugin commands to simplify audio flag modification. But in the meantime, you can execute the command in-console instead to avoid this limit.


audio-delay

The audio-delay flag is used to set a constant or variable duration of time to delay before playing the next audio source.
This is useful for adding breaks in audio playback for a better listening experience.

Flag Type: Properties
Flag Format: time=<delay-time>[:track=<track-id>]

Properties:

key value required
time The time or range of time in seconds to delay true
track The identifier of an audio track to apply to false

The time= can be omitted if the track property is undefined so that only the delay-time is specified.

Example:

/region flag <region-id> audio-delay 20-60,time=30:track=background

  • Delay audio on the default track anywhere from 20 to 60 seconds
  • Delay audio on the background track 30 seconds

Region Priority

When multiple regions overlap, the regions with the highest priority override the audio flags of lower priority regions much like normal WorldGuard flags.
This is especially useful to control audio transitions between overlapping areas.

Same Priority

When multiple regions with the same priority overlap, the values of their audio flags are combined.

Example:
region-1 and region-2 are overlapping regions with the same priority.
region-1 has the audio flag value: music-1,music-3,id=music-4:time=night
region-2 has the audio flag value: id=music-2:time=day
The result value is: music-1,music-3,id=music-4:time=night,id=music-2:time=day

Notes:

The behavior for combining duplicate entries is undefined. What determines a "duplicate entry" is specific to the flag type.
With audio flags, the audio-id and track-id properties together are unique and cannot be duplicated.
With audio-delay flags, the track-id property is unique and cannot be duplicated.
So in the previous example, if region-1 instead had id=music-2:time:night, it is unknown whether the entry from region-1 or region-2 would be used because they both define 'music-2' on the default track. This means music-2 may play only at night or only at day.