Package space.subkek.customdiscs.api
Interface LavaPlayerManager
public interface LavaPlayerManager
High-level manager for custom audio playback using LavaPlayer and the Simple Voice Chat API.
This manager coordinates audio loading, spatial channel creation, and player synchronization for jukebox-like behavior at specific world coordinates.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interface -
Method Summary
Modifier and TypeMethodDescription@Nullable de.maxhenkel.voicechat.api.audiochannel.LocationalAudioChannelgetAudioChannel(@NotNull org.bukkit.block.Block block) Retrieves the spatial audio channel associated with a specific block.@Nullable Collection<de.maxhenkel.voicechat.api.ServerPlayer> getPlayersInRangeAtStart(@NotNull org.bukkit.block.Block block) Retrieves the collection of players who were within the audible radius when the track was initially triggered.booleanisPlaying(@NotNull org.bukkit.block.Block block) Determines if a custom audio track is currently being broadcasted from the given block.voidplay(@NotNull org.bukkit.block.Block block, @NotNull String indetifier, @Nullable net.kyori.adventure.text.Component actionbarComponent) Starts audio playback at the specified block location.voidregisterPacketHandler(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull LavaPlayerManager.PacketConsumer consumer) voidstopPlaying(@NotNull org.bukkit.block.Block block) Stops audio playback at the specified block and releases all associated resources.voidTerminates all active audio sessions across the entire server.voidunregisterPacketHandlers(@NotNull org.bukkit.plugin.Plugin plugin)
-
Method Details
-
registerPacketHandler
void registerPacketHandler(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull LavaPlayerManager.PacketConsumer consumer) -
unregisterPacketHandlers
void unregisterPacketHandlers(@NotNull @NotNull org.bukkit.plugin.Plugin plugin) -
play
void play(@NotNull @NotNull org.bukkit.block.Block block, @NotNull @NotNull String indetifier, @Nullable @Nullable net.kyori.adventure.text.Component actionbarComponent) Starts audio playback at the specified block location.This method resolves the
sourceURL, initializes a spatial audio channel, and broadcasts the audio to eligible players.- Parameters:
block- The block (typically a jukebox) acting as the audio source.indetifier- The source identifier (URL, file path, or unique ID) used to load the audio.actionbarComponent- An optionalComponentto display to nearby players upon successful playback initialization.
-
isPlaying
boolean isPlaying(@NotNull @NotNull org.bukkit.block.Block block) Determines if a custom audio track is currently being broadcasted from the given block.- Parameters:
block- The block location to verify.- Returns:
trueif an active audio session exists at this location;falseotherwise.
-
stopPlaying
void stopPlaying(@NotNull @NotNull org.bukkit.block.Block block) Stops audio playback at the specified block and releases all associated resources.This includes closing the
LocationalAudioChanneland terminating the LavaPlayer track.- Parameters:
block- The block where playback should be terminated.
-
stopPlayingAll
void stopPlayingAll()Terminates all active audio sessions across the entire server.This is typically used during plugin disablement or administrative resets.
-
getAudioChannel
@Nullable @Nullable de.maxhenkel.voicechat.api.audiochannel.LocationalAudioChannel getAudioChannel(@NotNull @NotNull org.bukkit.block.Block block) Retrieves the spatial audio channel associated with a specific block.- Parameters:
block- The block where playback is occurring.- Returns:
- The
LocationalAudioChannelbeing used for broadcast, ornullif no audio is playing at this location.
-
getPlayersInRangeAtStart
@Nullable @Nullable Collection<de.maxhenkel.voicechat.api.ServerPlayer> getPlayersInRangeAtStart(@NotNull @NotNull org.bukkit.block.Block block) Retrieves the collection of players who were within the audible radius when the track was initially triggered.- Parameters:
block- The block where playback is occurring.- Returns:
- A
CollectionofServerPlayers who received the initial broadcast, ornullif no session is active.
-