Interface VoiceService


public interface VoiceService
Core service managing Simple Voice Chat API integration, sound playback channels, and per-player Opus codec instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canHear(@NotNull UUID speakerUuid, @NotNull UUID listenerUuid)
    Checks whether a listener can hear a speaker through any voice communication channel by UUID.
    boolean
    canHearProximity(@NotNull UUID speakerUuid, @NotNull UUID listenerUuid)
    Checks whether a listener can hear a speaker specifically in proximity voice chat by UUID.
    void
    Stops and clears all active sound channels.
    int
    Returns the count of currently active playing sound channels.
    Returns the set of UUIDs for all active playing sound channels.
    de.maxhenkel.voicechat.api.VoicechatServerApi
    Gets the underlying VoicechatServerApi instance.
    de.maxhenkel.voicechat.api.opus.OpusDecoder
    getDecoder(@NotNull UUID uuid)
    Retrieves or creates a cached OpusDecoder for a player.
    double
    getEffectiveAttenuationDb(@NotNull UUID speakerUuid, @NotNull UUID listenerUuid)
    Calculates the effective acoustic attenuation (decibel loss) between two players by UUID.
    de.maxhenkel.voicechat.api.opus.OpusEncoder
    getEncoder(@NotNull UUID uuid)
    Retrieves or creates a cached OpusEncoder for a player.
    boolean
    Checks whether global debug logging is enabled.
    boolean
    isPlayerConnected(@NotNull UUID uuid)
    Checks whether a player is connected to the voice chat server.
    void
    playSound(@NotNull VoiceSoundBuilder builder)
    Plays a positional or global sound configured via VoiceSoundBuilder.
    void
    setDebug(boolean value)
    Sets global debug logging flag.
    boolean
    stopSound(@NotNull UUID soundId)
    Stops an active sound channel by its UUID.
  • Method Details

    • isDebug

      boolean isDebug()
      Checks whether global debug logging is enabled.
      Returns:
      true if debug is active
    • setDebug

      void setDebug(boolean value)
      Sets global debug logging flag.
      Parameters:
      value - debug flag
    • getAPI

      de.maxhenkel.voicechat.api.VoicechatServerApi getAPI()
      Gets the underlying VoicechatServerApi instance.
      Returns:
      the active API instance
    • playSound

      void playSound(@NotNull @NotNull VoiceSoundBuilder builder)
      Plays a positional or global sound configured via VoiceSoundBuilder.
      Parameters:
      builder - the sound configuration builder
    • getActiveSoundCount

      int getActiveSoundCount()
      Returns the count of currently active playing sound channels.
      Returns:
      active sound count
    • getActiveSoundIds

      Set<UUID> getActiveSoundIds()
      Returns the set of UUIDs for all active playing sound channels.
      Returns:
      set of sound UUIDs
    • stopSound

      boolean stopSound(@NotNull @NotNull UUID soundId)
      Stops an active sound channel by its UUID.
      Parameters:
      soundId - the sound channel UUID
      Returns:
      true if sound was found and stopped
    • clearAllSounds

      void clearAllSounds()
      Stops and clears all active sound channels.
    • isPlayerConnected

      boolean isPlayerConnected(@NotNull @NotNull UUID uuid)
      Checks whether a player is connected to the voice chat server.
      Parameters:
      uuid - the player UUID
      Returns:
      true if connected
    • getDecoder

      de.maxhenkel.voicechat.api.opus.OpusDecoder getDecoder(@NotNull @NotNull UUID uuid)
      Retrieves or creates a cached OpusDecoder for a player.
      Parameters:
      uuid - the player UUID
      Returns:
      the OpusDecoder
    • getEncoder

      de.maxhenkel.voicechat.api.opus.OpusEncoder getEncoder(@NotNull @NotNull UUID uuid)
      Retrieves or creates a cached OpusEncoder for a player.
      Parameters:
      uuid - the player UUID
      Returns:
      the OpusEncoder
    • canHear

      boolean canHear(@NotNull @NotNull UUID speakerUuid, @NotNull @NotNull UUID listenerUuid)
      Checks whether a listener can hear a speaker through any voice communication channel by UUID.
      Parameters:
      speakerUuid - the speaking player UUID
      listenerUuid - the listening player UUID
      Returns:
      true if the listener can hear the speaker
    • canHearProximity

      boolean canHearProximity(@NotNull @NotNull UUID speakerUuid, @NotNull @NotNull UUID listenerUuid)
      Checks whether a listener can hear a speaker specifically in proximity voice chat by UUID.
      Parameters:
      speakerUuid - the speaking player UUID
      listenerUuid - the listening player UUID
      Returns:
      true if proximity audio is audible
    • getEffectiveAttenuationDb

      double getEffectiveAttenuationDb(@NotNull @NotNull UUID speakerUuid, @NotNull @NotNull UUID listenerUuid)
      Calculates the effective acoustic attenuation (decibel loss) between two players by UUID.
      Parameters:
      speakerUuid - the speaking player UUID
      listenerUuid - the listening player UUID
      Returns:
      decibel loss in dB (>= 99.0 dB indicates sound is completely blocked)