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 TypeMethodDescriptionbooleanChecks whether a listener can hear a speaker through any voice communication channel by UUID.booleancanHearProximity(@NotNull UUID speakerUuid, @NotNull UUID listenerUuid) Checks whether a listener can hear a speaker specifically in proximity voice chat by UUID.voidStops and clears all active sound channels.intReturns the count of currently active playing sound channels.Returns the set of UUIDs for all active playing sound channels.de.maxhenkel.voicechat.api.VoicechatServerApigetAPI()Gets the underlying VoicechatServerApi instance.de.maxhenkel.voicechat.api.opus.OpusDecodergetDecoder(@NotNull UUID uuid) Retrieves or creates a cached OpusDecoder for a player.doublegetEffectiveAttenuationDb(@NotNull UUID speakerUuid, @NotNull UUID listenerUuid) Calculates the effective acoustic attenuation (decibel loss) between two players by UUID.de.maxhenkel.voicechat.api.opus.OpusEncodergetEncoder(@NotNull UUID uuid) Retrieves or creates a cached OpusEncoder for a player.booleanisDebug()Checks whether global debug logging is enabled.booleanisPlayerConnected(@NotNull UUID uuid) Checks whether a player is connected to the voice chat server.voidplaySound(@NotNull VoiceSoundBuilder builder) Plays a positional or global sound configured viaVoiceSoundBuilder.voidsetDebug(boolean value) Sets global debug logging flag.booleanStops an active sound channel by its UUID.
-
Method Details
-
isDebug
boolean isDebug()Checks whether global debug logging is enabled.- Returns:
trueif 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
Plays a positional or global sound configured viaVoiceSoundBuilder.- Parameters:
builder- the sound configuration builder
-
getActiveSoundCount
int getActiveSoundCount()Returns the count of currently active playing sound channels.- Returns:
- active sound count
-
getActiveSoundIds
-
stopSound
Stops an active sound channel by its UUID.- Parameters:
soundId- the sound channel UUID- Returns:
trueif sound was found and stopped
-
clearAllSounds
void clearAllSounds()Stops and clears all active sound channels. -
isPlayerConnected
Checks whether a player is connected to the voice chat server.- Parameters:
uuid- the player UUID- Returns:
trueif connected
-
getDecoder
Retrieves or creates a cached OpusDecoder for a player.- Parameters:
uuid- the player UUID- Returns:
- the
OpusDecoder
-
getEncoder
Retrieves or creates a cached OpusEncoder for a player.- Parameters:
uuid- the player UUID- Returns:
- the
OpusEncoder
-
canHear
Checks whether a listener can hear a speaker through any voice communication channel by UUID.- Parameters:
speakerUuid- the speaking player UUIDlistenerUuid- the listening player UUID- Returns:
trueif the listener can hear the speaker
-
canHearProximity
Checks whether a listener can hear a speaker specifically in proximity voice chat by UUID.- Parameters:
speakerUuid- the speaking player UUIDlistenerUuid- the listening player UUID- Returns:
trueif 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 UUIDlistenerUuid- the listening player UUID- Returns:
- decibel loss in dB (>= 99.0 dB indicates sound is completely blocked)
-