Interface VoiceRadioService


public interface VoiceRadioService
Service managing radio channels, frequency tuning, Roger Beep feedback, and radio transmission routing.
  • Method Details

    • init

      void init(@NotNull @NotNull de.maxhenkel.voicechat.api.VoicechatServerApi api)
      Initializes the radio service with the Simple Voice Chat server API.
      Parameters:
      api - the VoicechatServerApi instance
    • getChannels

      @NotNull @NotNull Collection<RadioChannel> getChannels()
      Returns all active radio frequency channels.
      Returns:
      collection of RadioChannels
    • getOrCreateChannel

      @NotNull @NotNull RadioChannel getOrCreateChannel(@NotNull @NotNull String name)
      Retrieves an existing radio channel by name, or creates a new one if it does not exist.
      Parameters:
      name - the channel name
      Returns:
      the RadioChannel
    • getChannel

      @Nullable @Nullable RadioChannel getChannel(@NotNull @NotNull String name)
      Retrieves a radio channel by name.
      Parameters:
      name - the channel name
      Returns:
      the RadioChannel, or null if not found
    • getChannelOfPlayer

      @Nullable @Nullable RadioChannel getChannelOfPlayer(@NotNull @NotNull UUID playerUuid)
      Retrieves the active radio channel a player is currently tuned into.
      Parameters:
      playerUuid - the player UUID
      Returns:
      the RadioChannel, or null if not on any radio
    • getAPI

      de.maxhenkel.voicechat.api.VoicechatServerApi getAPI()
      Gets the underlying VoicechatServerApi instance.
    • register

      void register(@NotNull @NotNull RadioChannel radioChannel)
      Registers a radio channel.
    • unregister

      void unregister(@NotNull @NotNull String name)
      Unregisters a radio channel by name.
    • isInChannel

      boolean isInChannel(@NotNull @NotNull UUID playerUuid)
      Checks whether a player is connected to any radio channel.
    • unregisterAll

      void unregisterAll()
      Unregisters all radio channels.
    • joinChannel

      boolean joinChannel(@NotNull @NotNull UUID playerUuid, @NotNull @NotNull String channelName)
      Tunes a player into a radio frequency channel.
      Parameters:
      playerUuid - the player UUID
      channelName - the channel name
      Returns:
      true if joined successfully
    • leaveChannel

      void leaveChannel(@NotNull @NotNull UUID playerUuid)
      Disconnects a player from their active radio frequency channel.
      Parameters:
      playerUuid - the player UUID
    • removeChannel

      default void removeChannel(@NotNull @NotNull String name)
      Deletes a radio channel by name.
      Parameters:
      name - the channel name
    • save

      void save()
      Saves all radio channels to disk.
    • load

      void load()
      Reloads saved radio channels from disk.
    • addTransmissionListener

      default void addTransmissionListener(@NotNull BiConsumer<String,UUID> listener)
      Registers a listener called whenever a player transmits on a radio channel.
      Parameters:
      listener - (channelName, senderUuid)
    • setPacketFilter

      default void setPacketFilter(@Nullable @Nullable VoiceRadioService.RadioPacketFilter filter)
      Sets a packet filter to control radio voice transmission between participants (e.g. range, packet loss).
      Parameters:
      filter - the packet filter
    • getPacketFilter

      @Nullable default @Nullable VoiceRadioService.RadioPacketFilter getPacketFilter()
      Retrieves the current radio packet filter.
    • addAudioTransmissionListener

      default void addAudioTransmissionListener(@NotNull @NotNull VoiceRadioService.RadioAudioTransmissionListener listener)
      Registers a listener called whenever radio voice audio is transmitted, providing the processed Opus audio.
      Parameters:
      listener - (channelName, senderUuid, opusData)
    • isChannelActive

      default boolean isChannelActive(@NotNull @NotNull String channelName)
      Checks whether a radio channel is currently receiving active voice transmission.
      Parameters:
      channelName - the channel name
      Returns:
      true if currently transmitting
    • startRecording

      @Nullable VoiceRecording startRecording(@NotNull @NotNull String channelName)
      Starts a voice recording session capturing all transmissions on a radio channel.
      Parameters:
      channelName - the channel name
      Returns:
      the started VoiceRecording
    • stopRecording

      @Nullable VoiceRecording stopRecording(@NotNull @NotNull String channelName)
      Stops the active voice recording session on a radio channel.
      Parameters:
      channelName - the channel name
      Returns:
      the finished VoiceRecording, or null if not recording
    • isRecording

      boolean isRecording(@NotNull @NotNull String channelName)
      Checks whether a radio channel is currently being recorded.
      Parameters:
      channelName - the channel name
      Returns:
      true if actively recording
    • getActiveRecording

      @Nullable VoiceRecording getActiveRecording(@NotNull @NotNull String channelName)
      Gets the active recording session for a radio channel, if any.
      Parameters:
      channelName - the channel name
      Returns:
      active VoiceRecording, or null
    • playRecordingToRadio

      void playRecordingToRadio(@NotNull @NotNull String channelName, @NotNull VoiceRecording recording)
      Broadcasts a voice recording across a radio channel to all tuned listeners and external systems.
      Parameters:
      channelName - the channel name
      recording - the recording to play
    • stopRadioPlayback

      void stopRadioPlayback(@NotNull @NotNull String channelName)
      Stops any ongoing recording playback on a radio channel.
      Parameters:
      channelName - the channel name
    • isRadioPlaying

      boolean isRadioPlaying(@NotNull @NotNull String channelName)
      Checks whether a radio channel is currently playing back a recording.
      Parameters:
      channelName - the channel name
      Returns:
      true if actively playing