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 Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
    static interface 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable de.maxhenkel.voicechat.api.audiochannel.LocationalAudioChannel
    getAudioChannel(@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.
    boolean
    isPlaying(@NotNull org.bukkit.block.Block block)
    Determines if a custom audio track is currently being broadcasted from the given block.
    void
    play(@NotNull org.bukkit.block.Block block, @NotNull String indetifier, @Nullable net.kyori.adventure.text.Component actionbarComponent)
    Starts audio playback at the specified block location.
    void
    registerPacketHandler(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull LavaPlayerManager.PacketConsumer consumer)
     
    void
    stopPlaying(@NotNull org.bukkit.block.Block block)
    Stops audio playback at the specified block and releases all associated resources.
    void
    Terminates all active audio sessions across the entire server.
    void
    unregisterPacketHandlers(@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 optional Component to 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:
      true if an active audio session exists at this location; false otherwise.
    • 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 LocationalAudioChannel and 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 LocationalAudioChannel being used for broadcast, or null if 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 Collection of ServerPlayers who received the initial broadcast, or null if no session is active.