### Voicechat Server Starting Event Methods Source: https://voicechat.modrepo.de/index-all Methods for customizing the server-side voice chat socket implementation. ```APIDOC ## Voicechat Server Starting Event API ### Description Allows setting a custom socket implementation for voice chat traffic on the server. ### Methods - `setSocketImplementation(VoicechatSocket socket)`: Sets a custom implementation of the socket. ``` -------------------------------- ### Voice Chat Connection - Is Installed Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatConnection Checks if the player has a compatible version of the voice chat mod installed. ```APIDOC ## GET /voicechat/connection/installed ### Description Verifies if a player has a compatible version of the voice chat mod installed on their client. This is useful for determining which methods are applicable to a given player. ### Method GET ### Endpoint /voicechat/connection/installed ### Parameters #### Query Parameters - **playerId** (string) - Required - The unique identifier of the player. ### Response #### Success Response (200) - **isInstalled** (boolean) - True if the voice chat mod is installed and compatible, false otherwise. #### Response Example { "isInstalled": true } ``` -------------------------------- ### VoiceHostEvent API Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/events/VoiceHostEvent This section details the methods available for the VoiceHostEvent, including getting and setting the voice host. ```APIDOC ## VoiceHostEvent API ### Description This API allows for the retrieval and modification of the voice host associated with a voice chat. The voice host is crucial for clients connecting to the server. ### Methods #### getVoiceHost ##### Description Retrieves the current voice host string. ##### Method GET ##### Endpoint `/websites/voicechat_modrepo_de/api/voicehost` ##### Response * **Success Response (200)** * `voiceHost` (String) - The voice host string. ##### Response Example ```json { "voiceHost": "voice.example.com" } ``` #### setVoiceHost ##### Description Sets a new voice host for the voice chat. This change is propagated to the client for connection purposes. ##### Method POST ##### Endpoint `/websites/voicechat_modrepo_de/api/voicehost` ##### Parameters * **Request Body** * `voiceHost` (String) - Required - The new voice host string to set. ##### Request Example ```json { "voiceHost": "new.voice.server.net" } ``` ##### Response * **Success Response (200)** * Indicates successful update. ##### Response Example ```json { "message": "Voice host updated successfully." } ``` ``` -------------------------------- ### Get Server Configuration (Server API) Source: https://voicechat.modrepo.de/index-all Retrieves the server's configuration object. This allows access to various server-side settings related to voice chat. ```java getServerConfig() - Method in interface de.maxhenkel.voicechat.api.VoicechatServerApi ``` -------------------------------- ### Get Integer Configuration Value Source: https://voicechat.modrepo.de/index-all Retrieves an integer value from the configuration based on a given key. This method is part of the configuration access utility. ```java getInt(String, int) - Method in interface de.maxhenkel.voicechat.api.config.ConfigAccessor ``` -------------------------------- ### ClientReceiveSoundEvent API Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/events/ClientReceiveSoundEvent Details about the ClientReceiveSoundEvent, including methods for getting and setting audio data. ```APIDOC ## ClientReceiveSoundEvent ### Description This event is emitted before the sound is played on the client. It allows for overriding the audio data that will be played. ### Method Interface ### Endpoint N/A (Client-side event) ### Parameters N/A ### Request Example N/A ### Response #### Success Response (Event Emission) - **UUID** `getId()` - Returns the ID of the sender. - **short[]** `getRawAudio()` - Returns the unencoded raw 16-bit PCM audio frame. Returns an empty array for the end of transmission. - **void** `setRawAudio(short[] rawAudio)` - Overrides the actual audio data that is played. This is ignored if `getRawAudio()` returns an empty array. #### Response Example ```json { "senderId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "audioData": [ 0, 100, -50, // ... more audio samples ] } ``` ### Error Handling N/A (Event-based, no standard HTTP errors) ``` -------------------------------- ### Get Client Configuration (Java) Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatClientApi Retrieves the client's configuration accessor. This method returns an object that allows interaction with the client-side settings. ```Java ConfigAccessor getClientConfig() ``` -------------------------------- ### Audio Player Control API Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/audiochannel/AudioPlayer This API provides methods to control the audio playback, including starting, stopping, and checking the current status of the audio player. ```APIDOC ## Audio Player Control API ### Description Provides methods to control and query the state of an audio player. ### Method N/A (Interface methods) ### Endpoint N/A (Interface methods) ### Parameters N/A ### Request Example N/A ### Response N/A --- ## `startPlaying` ### Description Starts playing or streaming the audio data. ### Method `void` ### Endpoint N/A ### Parameters None ### Request Example ```java audioPlayer.startPlaying(); ``` ### Response No explicit response object. --- ## `stopPlaying` ### Description Stops playing or streaming the audio data. ### Method `void` ### Endpoint N/A ### Parameters None ### Request Example ```java audioPlayer.stopPlaying(); ``` ### Response No explicit response object. --- ## `isStarted` ### Description Checks if the audio player has been started. ### Method `boolean` ### Endpoint N/A ### Parameters None ### Request Example ```java boolean started = audioPlayer.isStarted(); ``` ### Response - **started** (boolean) - True if the player has been started, false otherwise. ### Response Example ```json { "started": true } ``` --- ## `isPlaying` ### Description Checks if the audio is currently playing. ### Method `boolean` ### Endpoint N/A ### Parameters None ### Request Example ```java boolean playing = audioPlayer.isPlaying(); ``` ### Response - **playing** (boolean) - True if the audio is currently playing, false otherwise. ### Response Example ```json { "playing": true } ``` --- ## `isStopped` ### Description Checks if the audio player has been stopped. ### Method `boolean` ### Endpoint N/A ### Parameters None ### Request Example ```java boolean stopped = audioPlayer.isStopped(); ``` ### Response - **stopped** (boolean) - True if the player has been stopped, false otherwise. ### Response Example ```json { "stopped": false } ``` --- ## `setOnStopped` ### Description Sets a runnable to be executed when the player finishes playing. ### Method `void` ### Endpoint N/A ### Parameters - **onStopped** (Runnable) - The runnable to execute when playback stops. ### Request Example ```java audioPlayer.setOnStopped(() -> { System.out.println("Audio playback finished."); }); ``` ### Response No explicit response object. ``` -------------------------------- ### Get Position (Entity and Sound Events/Packets) Source: https://voicechat.modrepo.de/index-all Retrieves the positional data for entities, locational sound events, and sound packets. This is crucial for spatial audio and entity tracking. ```java getPosition() - Method in interface de.maxhenkel.voicechat.api.Entity getPosition() - Method in interface de.maxhenkel.voicechat.api.events.ClientReceiveSoundEvent.LocationalSound getPosition() - Method in interface de.maxhenkel.voicechat.api.events.OpenALSoundEvent getPosition() - Method in interface de.maxhenkel.voicechat.api.packets.LocationalSoundPacket ``` -------------------------------- ### Get Location (Audio Channels and Events) Source: https://voicechat.modrepo.de/index-all Retrieves the positional information of various entities, including locational audio channels and sound events. This is vital for 3D audio processing. ```java getLocation() - Method in interface de.maxhenkel.voicechat.api.audiochannel.ClientLocationalAudioChannel getLocation() - Method in interface de.maxhenkel.voicechat.api.audiochannel.LocationalAudioChannel getPosition() - Method in interface de.maxhenkel.voicechat.api.events.ClientReceiveSoundEvent.LocationalSound getPosition() - Method in interface de.maxhenkel.voicechat.api.events.OpenALSoundEvent getPosition() - Method in interface de.maxhenkel.voicechat.api.packets.LocationalSoundPacket ``` -------------------------------- ### Get Players In Range (Server API) Source: https://voicechat.modrepo.de/index-all Retrieves a list of players within a specified range of a given location on the server. Overloads allow filtering players based on a predicate. ```java getPlayersInRange(ServerLevel, Position, double) - Method in interface de.maxhenkel.voicechat.api.VoicechatServerApi getPlayersInRange(ServerLevel, Position, double, Predicate) - Method in interface de.maxhenkel.voicechat.api.VoicechatServerApi ``` -------------------------------- ### Get Raw Audio Data (Sound Events) Source: https://voicechat.modrepo.de/index-all Retrieves the unencoded raw audio data from client-side sound events. This data is typically processed before encoding for transmission or playback. ```java getRawAudio() - Method in interface de.maxhenkel.voicechat.api.events.ClientReceiveSoundEvent getRawAudio() - Method in interface de.maxhenkel.voicechat.api.events.ClientSoundEvent ``` -------------------------------- ### Get Custom Voice Chat Socket Implementation in Java Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/events/VoicechatServerStartingEvent The getSocketImplementation method retrieves the currently set custom socket implementation for voice chat traffic. If no custom implementation is set, it returns null, indicating that the default implementation will be used. This method returns a VoicechatSocket object or null. ```java @Nullable VoicechatSocket getSocketImplementation() ``` -------------------------------- ### Initialization and State Checks Source: https://voicechat.modrepo.de/index-all Methods for initializing the plugin and checking various states of the voice chat system, connections, and audio components. ```APIDOC ## VOICECHAT API METHODS ### initialize **Description**: Called after loading the plugin. **Method**: N/A (Callback) **Endpoint**: N/A ### isCancellable **Description**: Checks if an event is cancellable. **Method**: N/A **Endpoint**: N/A ### isCancelled **Description**: Checks if an event has been cancelled. **Method**: N/A **Endpoint**: N/A ### isClosed (AudioChannel) **Description**: Checks if an audio channel is closed. **Method**: N/A **Endpoint**: N/A ### isClosed (ClientVoicechatSocket) **Description**: Checks if the client voice chat socket is closed. **Method**: N/A **Endpoint**: N/A ### isClosed (OpusDecoder) **Description**: Checks if the Opus decoder is closed. **Method**: N/A **Endpoint**: N/A ### isClosed (OpusEncoder) **Description**: Checks if the Opus encoder is closed. **Method**: N/A **Endpoint**: N/A ### isClosed (VoicechatSocket) **Description**: Checks if the voice chat socket is closed. **Method**: N/A **Endpoint**: N/A ### isConnected (ClientVoicechatConnectionEvent) **Description**: Checks if a client voice chat connection event indicates a connected state. **Method**: N/A **Endpoint**: N/A ### isConnected (VoicechatConnection) **Description**: Checks if a voice chat connection is active. Note: This might not represent the actual state, as other plugins can fake connection states. **Method**: N/A **Endpoint**: N/A ### isDisabled (MicrophoneMuteEvent) **Description**: Checks if the microphone is disabled due to a mute event. **Method**: N/A **Endpoint**: N/A ### isDisabled (PlayerStateChangedEvent) **Description**: Checks if a player's state indicates they are disabled. **Method**: N/A **Endpoint**: N/A ### isDisabled (VoicechatDisableEvent) **Description**: Checks if voice chat is disabled via a disable event. **Method**: N/A **Endpoint**: N/A ### isDisabled (VoicechatClientApi) **Description**: Checks if voice chat is disabled for the client. Equivalent to calling `isDisabled(UUID)` with `null`. **Method**: N/A **Endpoint**: N/A ### isDisabled (VoicechatConnection) **Description**: Checks if voice chat is disabled for a specific connection. Note: Returns the state at the time of fetching the connection object. **Method**: N/A **Endpoint**: N/A ### isDisabled(UUID) (VoicechatClientApi) **Description**: Checks if voice chat is disabled for a specific player identified by UUID. **Method**: N/A **Endpoint**: N/A ### isDisconnected (PlayerStateChangedEvent) **Description**: Checks if a player's state indicates they are disconnected. **Method**: N/A **Endpoint**: N/A ### isDisconnected (VoicechatClientApi) **Description**: Checks if a player is disconnected from voice chat. Equivalent to calling `isDisconnected(UUID)` with `null`. **Method**: N/A **Endpoint**: N/A ### isDisconnected(UUID) (VoicechatClientApi) **Description**: Checks if a specific player identified by UUID is disconnected from voice chat. **Method**: N/A **Endpoint**: N/A ### isHidden (Group) **Description**: Checks if a group is hidden. **Method**: N/A **Endpoint**: N/A ### isInGroup (VoicechatConnection) **Description**: Checks if a player is in a group. Note: Returns the state at the time of fetching the connection object. **Method**: N/A **Endpoint**: N/A ### isInstalled (VoicechatConnection) **Description**: Checks if voice chat is installed for a connection. **Method**: N/A **Endpoint**: N/A ### isMuted (VoicechatClientApi) **Description**: Checks if the user is muted in voice chat. **Method**: N/A **Endpoint**: N/A ### ISOLATED (Group.Type) **Description**: Static variable indicating an isolated group type, where players can only hear others within the same group. **Method**: N/A **Endpoint**: N/A ### isPersistent (Group) **Description**: Checks if a group is persistent. **Method**: N/A **Endpoint**: N/A ### isPlaying (AudioPlayer) **Description**: Checks if an audio player is currently playing audio. **Method**: N/A **Endpoint**: N/A ### isPushToTalkKeyPressed (VoicechatClientApi) **Description**: Returns true if the push-to-talk key is currently pressed, even if voice activation is also enabled. **Method**: N/A **Endpoint**: N/A ### isStarted (AudioPlayer) **Description**: Checks if an audio player has started. **Method**: N/A **Endpoint**: N/A ### isStopped (AudioPlayer) **Description**: Checks if an audio player has stopped. **Method**: N/A **Endpoint**: N/A ### isTalking (VoicechatClientApi) **Description**: Checks if the user is currently talking. Equivalent to calling `isTalking(UUID)` with `null`. **Method**: N/A **Endpoint**: N/A ### isTalking(UUID) (VoicechatClientApi) **Description**: Checks if a specific player identified by UUID is currently talking. **Method**: N/A **Endpoint**: N/A ### isWhispering (ClientEntityAudioChannel) **Description**: Checks if a client entity audio channel is in whispering mode. **Method**: N/A **Endpoint**: N/A ### isWhispering (EntityAudioChannel) **Description**: Checks if an entity audio channel is in whispering mode. **Method**: N/A **Endpoint**: N/A ### isWhispering (AudioSender) **Description**: Checks if an audio sender is in whispering mode. **Method**: N/A **Endpoint**: N/A ### isWhispering (ClientReceiveSoundEvent.EntitySound) **Description**: Checks if an entity sound in a client receive sound event is whispering. **Method**: N/A **Endpoint**: N/A ### isWhispering (ClientSoundEvent) **Description**: Checks if a client sound event is related to whispering. **Method**: N/A **Endpoint**: N/A ### isWhispering (EntitySoundPacket) **Description**: Checks if an entity sound packet is related to whispering. **Method**: N/A **Endpoint**: N/A ### isWhispering (MicrophonePacket) **Description**: Checks if a microphone packet is related to whispering. **Method**: N/A **Endpoint**: N/A ### isWhispering (VoicechatClientApi) **Description**: Checks if the user is whispering. Equivalent to calling `isWhispering(UUID)` with `null`. **Method**: N/A **Endpoint**: N/A ### isWhispering(UUID) (VoicechatClientApi) **Description**: Checks if a specific player identified by UUID is whispering. **Method**: N/A **Endpoint**: N/A ### isWhisperKeyPressed (VoicechatClientApi) **Description**: Checks if the whisper key is currently pressed. **Method**: N/A **Endpoint**: N/A ``` -------------------------------- ### Get Local Port (Voicechat Socket) Source: https://voicechat.modrepo.de/index-all Retrieves the local port number used by the voicechat socket. This is relevant for network communication setup. ```java getLocalPort() - Method in interface de.maxhenkel.voicechat.api.VoicechatSocket ``` -------------------------------- ### Java Mp3Encoder.encode Method Example Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/mp3/Mp3Encoder Demonstrates the usage of the `encode` method within the Mp3Encoder interface. This method takes an array of short PCM samples and writes the encoded MP3 data to an output stream. Proper error handling for IOException is recommended. ```java /** * Encodes the given PCM samples and writes it to the provided output stream. * @param samples the PCM samples to encode * @throws IOException if an I/O error occurs */ void encode(short[] samples) throws IOException; ``` -------------------------------- ### Server Player Creation from Object Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatApi Creates a server player object from a given server player object. ```APIDOC ## POST /voicechat/server_player/from_object ### Description Creates a server player object from an actual server player object. ### Method POST ### Endpoint /voicechat/server_player/from_object ### Parameters #### Request Body - **serverPlayerObject** (Object) - Required - The server player implementation object. ### Request Example ```json { "serverPlayerObject": "actual_server_player_representation" } ``` ### Response #### Success Response (200) - **playerId** (string) - A unique identifier for the created server player object. #### Response Example ```json { "playerId": "server-player-7g8h9i" } ``` ``` -------------------------------- ### Get Volume Categories Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatServerApi Retrieves a collection of all currently registered volume categories. ```APIDOC ## GET /websites/voicechat_modrepo_de/getVolumeCategories ### Description Retrieves all registered volume categories. ### Method GET ### Endpoint /websites/voicechat_modrepo_de/getVolumeCategories ### Response #### Success Response (200) - **categories** (Collection) - A collection of registered volume categories. Each VolumeCategory object would typically contain details like category ID, name, and icon information. #### Response Example ```json { "categories": [ { "id": "cat1", "name": "General Chat", "iconUrl": "http://example.com/icons/general.png" }, { "id": "cat2", "name": "Party Chat", "iconUrl": "http://example.com/icons/party.png" } ] } ``` ``` -------------------------------- ### Player Audio Listener Builder Methods Source: https://voicechat.modrepo.de/index-all Methods for building and configuring a PlayerAudioListener object. ```APIDOC ## Player Audio Listener Builder API ### Description Methods for setting the player associated with an audio listener. Requires either a `ServerPlayer` object or a player's UUID. ### Methods - `setPlayer(ServerPlayer player)`: Sets the player using a `ServerPlayer` object. - `setPlayer(UUID playerUuid)`: Sets the player using the player's UUID. ``` -------------------------------- ### Player Interface Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/Player Documentation for the Player interface, including its methods and inheritance. ```APIDOC ## Player Interface ### Description Represents a player entity in the system, extending the base Entity interface. ### Method Summary #### Instance Methods - `Object getPlayer()` - Returns the actual player object. ### Methods Inherited from Entity - `getEntity()` - `getPosition()` - `getUuid()` ``` -------------------------------- ### Client Voicechat Initialization Event Methods Source: https://voicechat.modrepo.de/index-all Methods for customizing the client-side voice chat socket implementation. ```APIDOC ## Client Voicechat Initialization Event API ### Description Provides a way to set a custom socket implementation for client-side voice chat traffic. ### Methods - `setSocketImplementation(ClientVoicechatSocket socket)`: Sets a custom implementation of the socket. ``` -------------------------------- ### Voice Chat Connection - Get Player Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatConnection Retrieves the ServerPlayer object associated with the voice chat connection. ```APIDOC ## GET /voicechat/connection/player ### Description Fetches the ServerPlayer object corresponding to the given player's voice chat connection. This object provides detailed information about the player on the server. ### Method GET ### Endpoint /voicechat/connection/player ### Parameters #### Query Parameters - **playerId** (string) - Required - The unique identifier of the player. ### Response #### Success Response (200) - **player** (ServerPlayer) - The ServerPlayer object. #### Response Example { "player": { "uuid": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "name": "PlayerName", "online": true } } ``` -------------------------------- ### SoundPacket Interface Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/packets/SoundPacket Documentation for the SoundPacket interface, including its methods and nested builder class. ```APIDOC ## Interface SoundPacket ```java public interface SoundPacket extends Packet, ConvertablePacket ``` ### Description Represents a packet containing sound data. ### Nested Class Summary #### Nested Class - **SoundPacket.Builder,P extends SoundPacket>** - A builder to build a sound packet. ### Method Summary #### Instance Methods - **getCategory** () : `String` - Returns the category ID of the sound packet. - **getChannelId** () : `UUID` - Returns the channel ID of the sound packet. - **getOpusEncodedData** () : `byte[]` - Returns the opus encoded audio data. - **getSender** () : `UUID` - Returns the sender of this packet. - **getSequenceNumber** () : `long` - Returns the sequence number of the packet. ### Methods inherited from interface de.maxhenkel.voicechat.api.packets.ConvertablePacket - `entitySoundPacketBuilder` - `locationalSoundPacketBuilder` - `staticSoundPacketBuilder` - `toEntitySoundPacket` - `toLocationalSoundPacket` - `toStaticSoundPacket` ### Method Details #### getChannelId ```java UUID getChannelId() ``` Returns: the channel ID of the sound packet #### getSender ```java UUID getSender() ``` Returns: the sender of this packet - doesn't necessarily need to be a players UUID #### getOpusEncodedData ```java byte[] getOpusEncodedData() ``` Returns: the opus encoded audio data #### getSequenceNumber ```java long getSequenceNumber() ``` Returns: the sequence number of the packet #### getCategory ```java @Nullable String getCategory() ``` Returns: the category ID of the sound packet ``` -------------------------------- ### OpenALContextEvents - OpenAL Device Handling Source: https://voicechat.modrepo.de/index-all Methods for retrieving the audio device from OpenAL context creation and destruction events. ```APIDOC ## GET /openalcontextevents/device ### Description Gets the audio device associated with the OpenAL context event. ### Method GET ### Endpoint /openalcontextevents/device ### Parameters None ### Request Example None ### Response #### Success Response (200) - **device** (Object) - The audio device object. #### Response Example ```json { "device": { /* ... device details ... */ } } ``` ``` -------------------------------- ### Voicechat Disable Event Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/events/VoicechatDisableEvent This event is emitted on the client when the voice chat is getting enabled/disabled. It extends the ClientEvent interface. ```APIDOC ## Voicechat Disable Event ### Description This event is emitted on the client when the voice chat is getting enabled/disabled. ### Method N/A (Event) ### Endpoint N/A (Event) ### Parameters N/A (Event) ### Request Example N/A (Event) ### Response #### Event Details - **isDisabled** () : boolean - Returns true if the voice chat is disabled. ### Response Example ```json { "isDisabled": true } ``` ### Methods inherited from interface de.maxhenkel.voicechat.api.events.ClientEvent - `getVoicechat` ### Methods inherited from interface de.maxhenkel.voicechat.api.events.Event - `cancel` - `isCancellable` - `isCancelled` ``` -------------------------------- ### Get Sender (Sound Packet) Source: https://voicechat.modrepo.de/index-all Retrieves the sender information from a sound packet. This helps in identifying the source of the audio data. ```java getSender() - Method in interface de.maxhenkel.voicechat.api.packets.SoundPacket ``` -------------------------------- ### Static Sound Packet Builder Source: https://voicechat.modrepo.de/index-all A builder interface for creating static sound packets. ```APIDOC ## Static Sound Packet Builder API ### Description Provides a builder pattern for constructing `StaticSoundPacket` objects, which are non-directional. ### Interface `StaticSoundPacket.Builder` ### Note Ensure `SoundPacket.Builder.channelId(UUID)` is set to prevent channel conflicts. ``` -------------------------------- ### Server Level Creation from Object Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatApi Creates a server level object from a given server level object. ```APIDOC ## POST /voicechat/server_level/from_object ### Description Creates a server level object from an actual server level object. ### Method POST ### Endpoint /voicechat/server_level/from_object ### Parameters #### Request Body - **serverLevelObject** (Object) - Required - The server level implementation object. ### Request Example ```json { "serverLevelObject": "actual_server_level_representation" } ``` ### Response #### Success Response (200) - **levelId** (string) - A unique identifier for the created server level object. #### Response Example ```json { "levelId": "server-level-4d5e6f" } ``` ``` -------------------------------- ### Get Secret (Server API - Deprecated) Source: https://voicechat.modrepo.de/index-all Retrieves a secret associated with a UUID. This method is deprecated and will always return null. ```java getSecret(UUID) - Method in interface de.maxhenkel.voicechat.api.VoicechatServerApi ``` -------------------------------- ### Get Player (Voicechat Connection) Source: https://voicechat.modrepo.de/index-all Retrieves the player associated with a voice chat connection. This method is part of the connection interface. ```java getPlayer() - Method in interface de.maxhenkel.voicechat.api.VoicechatConnection ``` -------------------------------- ### ClientAudioChannel Methods Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/audiochannel/ClientAudioChannel This section details the methods for interacting with a client audio channel, such as playing audio data and managing its category. ```APIDOC ## ClientAudioChannel Interface ### Description Represents an audio channel on the client side, allowing for playback of audio data and management of channel categories. ### Methods #### `getId()` ##### Description Returns the unique identifier of the audio channel. ##### Method GET ##### Endpoint `/websites/voicechat_modrepo_de/ClientAudioChannel/{channelId}` (Conceptual - Actual endpoint may vary) ##### Response * **`UUID`** - The unique ID of the channel. ##### Response Example ```json { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` #### `play(short[] rawAudio)` ##### Description Plays the provided raw audio data on this audio channel. ##### Method POST ##### Endpoint `/websites/voicechat_modrepo_de/ClientAudioChannel/{channelId}/play` (Conceptual - Actual endpoint may vary) ##### Parameters * **Path Parameters** * **channelId** (UUID) - Required - The ID of the audio channel to play audio on. * **Request Body** * **rawAudio** (short[]) - Required - The raw 16-bit PCM audio frame to play. ##### Request Example ```json { "rawAudio": [32767, -32768, 0, 10000, -5000] } ``` ##### Response * **Success Response (204)** - No Content - Indicates successful playback. #### `getCategory()` ##### Description Retrieves the category ID associated with the audio channel. ##### Method GET ##### Endpoint `/websites/voicechat_modrepo_de/ClientAudioChannel/{channelId}/category` (Conceptual - Actual endpoint may vary) ##### Response * **`String`** - The category ID of the audio channel. Can be null. ##### Response Example ```json { "category": "ambient_sounds" } ``` #### `setCategory(String category)` ##### Description Sets the category for the audio channel. Ensure the category is registered before use. ##### Method PUT ##### Endpoint `/websites/voicechat_modrepo_de/ClientAudioChannel/{channelId}/category` (Conceptual - Actual endpoint may vary) ##### Parameters * **Path Parameters** * **channelId** (UUID) - Required - The ID of the audio channel to set the category for. * **Request Body** * **category** (String) - Optional - The category ID to assign to the audio channel. Can be null. ##### Request Example ```json { "category": "dialogue" } ``` ##### Response * **Success Response (204)** - No Content - Indicates successful category update. ``` -------------------------------- ### MP3 Decoder Creation Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatApi Provides a method to create an MP3 decoder. Note: This is not available for Bukkit and will always return null. ```APIDOC ## POST /voicechat/mp3/decoder ### Description Creates a new MP3 decoder. This method is not available for Bukkit and will always return null. ### Method POST ### Endpoint /voicechat/mp3/decoder ### Parameters #### Request Body - **inputStream** (InputStream) - Required - The input stream to read the MP3 from. ### Request Example ```json { "inputStream": "stream_id_456" } ``` ### Response #### Success Response (200) - **decoderId** (string or null) - A unique identifier for the MP3 decoder, or null if not available. #### Response Example ```json { "decoderId": null } ``` ``` -------------------------------- ### Get All Groups (Server API) Source: https://voicechat.modrepo.de/index-all Retrieves a collection of all available groups managed by the server. This method is part of the server-side API. ```java getGroups() - Method in interface de.maxhenkel.voicechat.api.VoicechatServerApi ``` -------------------------------- ### Get Voicechat Client API Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/events/ClientEvent Retrieves the voice chat client API, allowing access to voice chat functionalities. ```APIDOC ## GET /voicechat/client ### Description Retrieves the voice chat client API instance. ### Method GET ### Endpoint /voicechat/client ### Parameters None ### Request Body None ### Response #### Success Response (200) - **voicechatClientApi** (VoicechatClientApi) - The voice chat client API object. #### Response Example ```json { "voicechatClientApi": { "someApiMethod1": "...", "someApiMethod2": "..." } } ``` ``` -------------------------------- ### Audio Player Methods Source: https://voicechat.modrepo.de/index-all Methods for controlling the playback of audio. ```APIDOC ## Audio Player API ### Description Controls the playback and streaming of audio. ### Methods - `startPlaying()`: Begins playing or streaming the audio. - `stopPlaying()`: Stops the playback or streaming of audio. ``` -------------------------------- ### Get Receiver Connection (Packet Event) Source: https://voicechat.modrepo.de/index-all Retrieves the connection object of the receiver for a packet event. This is useful for understanding the communication flow. ```java getReceiverConnection() - Method in interface de.maxhenkel.voicechat.api.events.PacketEvent ``` -------------------------------- ### Get Plugin ID (Voicechat Plugin) Source: https://voicechat.modrepo.de/index-all Retrieves the unique identifier for a voice chat plugin. This is essential for plugin management and identification. ```java getPluginId() - Method in interface de.maxhenkel.voicechat.api.VoicechatPlugin ``` -------------------------------- ### ConfigAccessor Methods Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/config/ConfigAccessor This section details the methods available for accessing configuration values through the ConfigAccessor interface. ```APIDOC ## GET /config ### Description Retrieves configuration values from the system. ### Method GET ### Endpoint /config ### Parameters #### Query Parameters - **key** (String) - Required - The key of the configuration value to retrieve. - **def** (String/boolean/int/double) - Optional - The default value to return if the key is not found. ### Response #### Success Response (200) - **value** (String/boolean/int/double) - The retrieved configuration value. #### Response Example ```json { "value": "example_value" } ``` ## GET /config/hasKey ### Description Checks if a configuration key exists. ### Method GET ### Endpoint /config/hasKey ### Parameters #### Query Parameters - **key** (String) - Required - The key to check for. ### Response #### Success Response (200) - **exists** (boolean) - True if the key exists, false otherwise. #### Response Example ```json { "exists": true } ``` ## GET /config/getString ### Description Gets the string value of a given configuration key. ### Method GET ### Endpoint /config/getString ### Parameters #### Query Parameters - **key** (String) - Required - The key of the configuration value. - **def** (String) - Optional - The default string value to return if the key is not found. ### Response #### Success Response (200) - **value** (String) - The string value of the configuration key. #### Response Example ```json { "value": "example_string" } ``` ## GET /config/getBoolean ### Description Gets the boolean value of a given configuration key. ### Method GET ### Endpoint /config/getBoolean ### Parameters #### Query Parameters - **key** (String) - Required - The key of the configuration value. - **def** (boolean) - Optional - The default boolean value to return if the key is not found. ### Response #### Success Response (200) - **value** (boolean) - The boolean value of the configuration key. #### Response Example ```json { "value": true } ``` ## GET /config/getInt ### Description Gets the integer value of a given configuration key. ### Method GET ### Endpoint /config/getInt ### Parameters #### Query Parameters - **key** (String) - Required - The key of the configuration value. - **def** (int) - Optional - The default integer value to return if the key is not found. ### Response #### Success Response (200) - **value** (int) - The integer value of the configuration key. #### Response Example ```json { "value": 123 } ``` ## GET /config/getDouble ### Description Gets the double value of a given configuration key. ### Method GET ### Endpoint /config/getDouble ### Parameters #### Query Parameters - **key** (String) - Required - The key of the configuration value. - **def** (double) - Optional - The default double value to return if the key is not found. ### Response #### Success Response (200) - **value** (double) - The double value of the configuration key. #### Response Example ```json { "value": 123.45 } ``` ``` -------------------------------- ### Get Server Config Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatServerApi Provides access to a read-only configuration accessor for the mod's server configuration. ```APIDOC ## GET /websites/voicechat_modrepo_de/getServerConfig ### Description Returns a read-only config accessor for the mod's server config. ### Method GET ### Endpoint /websites/voicechat_modrepo_de/getServerConfig ### Response #### Success Response (200) - **configAccessor** (ConfigAccessor) - An object providing read-only access to server configuration settings. #### Response Example ```json { "configAccessor": { "maxPlayers": 32, "voiceChatEnabled": true, "serverName": "My Voice Server" } } ``` ``` -------------------------------- ### VoicechatApi - General Methods Source: https://voicechat.modrepo.de/index-all Provides access to general voice chat functionalities like audio conversion. ```APIDOC ## GET /voicechatapi ### Description Retrieves an instance of the audio converter for voice chat operations. ### Method GET ### Endpoint /voicechatapi ### Parameters None ### Request Example None ### Response #### Success Response (200) - **audioConverter** (Object) - An object representing the audio converter. #### Response Example ```json { "audioConverter": { /* ... audio converter details ... */ } } ``` ``` -------------------------------- ### Voice Chat Connection - Set Connected Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatConnection Sets the connection status for a player. This method is intended for players who do not have the voice chat mod installed. ```APIDOC ## POST /voicechat/connection/set_connected ### Description Manually sets the voice chat connection status for a player. This function is designed for players who do not have the voice chat mod installed on their client. The player's disconnected state will reset if their actual connection status changes or if they reconnect. ### Method POST ### Endpoint /voicechat/connection/set_connected ### Parameters #### Request Body - **playerId** (string) - Required - The unique identifier of the player. - **connected** (boolean) - Required - The desired connection status (true for connected, false for disconnected). ### Request Example { "playerId": "player_id_789", "connected": false } ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example { "status": "success" } ``` -------------------------------- ### ServerPlayer Interface Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/ServerPlayer Provides access to server-specific player information. ```APIDOC ## ServerPlayer Interface ### Description This interface represents a player on the server, extending the general Player interface with server-specific functionalities. ### Methods #### getServerLevel ```java ServerLevel getServerLevel() ``` ##### Description Returns the server level (world) the player is currently in. ##### Returns - `ServerLevel`: The level of the player. ### Inherited Methods #### From interface de.maxhenkel.voicechat.api.Entity - `getEntity()` - `getPosition()` - `getUuid()` #### From interface de.maxhenkel.voicechat.api.Player - `getPlayer()` ``` -------------------------------- ### Get Name Translation Key (Volume Category) Source: https://voicechat.modrepo.de/index-all Retrieves the translation key for the name of a volume category. This is used for internationalization and localization of names. ```java getNameTranslationKey() - Method in interface de.maxhenkel.voicechat.api.VolumeCategory ``` -------------------------------- ### Audio Listener API Source: https://voicechat.modrepo.de/overview-tree Documentation for managing audio listeners, specifically focusing on the builder pattern for `PlayerAudioListener`. ```APIDOC ## Player Audio Listener ### Description This API provides a way to build and configure a player's audio listener, which affects how they perceive sounds in the game world. ### Endpoint N/A (This is a class-based API, not an HTTP endpoint) ### Class * `de.maxhenkel.voicechat.api.audiolistener.PlayerAudioListener.Builder` ### Usage Use the `PlayerAudioListener.Builder` to construct a `PlayerAudioListener` instance with desired properties. ### Request Example ```java // Example of building a PlayerAudioListener PlayerAudioListener audioListener = PlayerAudioListener.builder() .withFalloff(...) .withFalloffDistance(...) .withHidden(true/false) .build(); ``` ### Response N/A (This is a data structure for configuring audio perception) ``` -------------------------------- ### MP3 Encoder Creation Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatApi Provides a method to create an MP3 encoder. Note: This is not available for Bukkit and will always return null. ```APIDOC ## POST /voicechat/mp3/encoder ### Description Creates a new MP3 encoder. This method is not available for Bukkit and will always return null. ### Method POST ### Endpoint /voicechat/mp3/encoder ### Parameters #### Request Body - **audioFormat** (AudioFormat) - Required - The audio format. - **bitrate** (int) - Required - The bitrate in kbps. - **quality** (int) - Required - The quality from 0 (highest) to 9 (lowest). - **outputStream** (OutputStream) - Required - The output stream to write the MP3 to. ### Request Example ```json { "audioFormat": "44100-16-2", "bitrate": 128, "quality": 5, "outputStream": "stream_id_123" } ``` ### Response #### Success Response (200) - **encoderId** (string or null) - A unique identifier for the MP3 encoder, or null if not available. #### Response Example ```json { "encoderId": null } ``` ``` -------------------------------- ### Get Group Information (Java) Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatClientApi Retrieves information about the player's current group. This method returns a Group object. ```Java Group getGroup() ``` -------------------------------- ### VoicechatApi - Core Methods Source: https://voicechat.modrepo.de/index-all Core methods for interacting with the Simple Voice Chat API, including audio encoding and position creation. ```APIDOC ## POST /api/voicechat/encodeMp3 ### Description Encodes PCM audio samples into MP3 format and writes to an OutputStream. Note: This method is not available for Bukkit and will always return null. ### Method POST ### Endpoint /api/voicechat/encodeMp3 ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **audioFormat** (AudioFormat) - Required - The audio format of the input samples. - **sampleRate** (int) - Required - The sample rate of the audio. - **channels** (int) - Required - The number of audio channels. - **outputStream** (OutputStream) - Required - The stream to write the encoded MP3 data to. ### Request Example ```json { "audioFormat": "PCM", "sampleRate": 44100, "channels": 2, "outputStream": "" } ``` ### Response #### Success Response (200) - **null** (null) - This method always returns null when called on Bukkit. #### Response Example ```json null ``` ## POST /api/voicechat/createPosition ### Description Creates a new position object with the given coordinates. ### Method POST ### Endpoint /api/voicechat/createPosition ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **x** (double) - Required - The x-coordinate. - **y** (double) - Required - The y-coordinate. - **z** (double) - Required - The z-coordinate. ### Request Example ```json { "x": 10.5, "y": 20.0, "z": -5.2 } ``` ### Response #### Success Response (200) - **Position** (object) - The created position object. #### Response Example ```json { "x": 10.5, "y": 20.0, "z": -5.2 } ``` ``` -------------------------------- ### Get Sequence Number (Sound Packet) Source: https://voicechat.modrepo.de/index-all Retrieves the sequence number of a sound packet. This is important for ordering and detecting lost packets in network communication. ```java getSequenceNumber() - Method in interface de.maxhenkel.voicechat.api.packets.SoundPacket ``` -------------------------------- ### Get Packet (Event Interfaces) Source: https://voicechat.modrepo.de/index-all Retrieves the associated packet object within packet-related events. This allows inspection or modification of the event's data. ```java getPacket() - Method in interface de.maxhenkel.voicechat.api.events.PacketEvent getPacket() - Method in interface de.maxhenkel.voicechat.api.events.VoiceDistanceEvent ``` -------------------------------- ### Client Configuration and Volume Management Source: https://voicechat.modrepo.de/de/maxhenkel/voicechat/api/VoicechatClientApi Methods for accessing client configuration and managing volume categories. ```APIDOC ## GET /websites/voicechat_modrepo_de/api/client/config ### Description Retrieves the client's configuration. ### Method GET ### Endpoint /websites/voicechat_modrepo_de/api/client/config ### Response #### Success Response (200) - **ConfigAccessor** (object) - An object providing access to client configuration. #### Response Example ```json { "volumeSettings": {"master": 0.8, "music": 0.5} } ``` ## POST /websites/voicechat_modrepo_de/api/client/volume/register ### Description Registers a volume category for the client. ### Method POST ### Endpoint /websites/voicechat_modrepo_de/api/client/volume/register ### Parameters #### Request Body - **category** (VolumeCategory) - Required - The volume category to register. ### Request Example ```json { "category": {"id": "custom_sounds", "defaultVolume": 0.7} } ``` ## DELETE /websites/voicechat_modrepo_de/api/client/volume/unregister ### Description Unregisters a volume category from the client. ### Method DELETE ### Endpoint /websites/voicechat_modrepo_de/api/client/volume/unregister ### Parameters #### Query Parameters - **categoryId** (String) - Required - The ID of the volume category to unregister. ### Request Example ```json { "categoryId": "custom_sounds" } ``` ``` -------------------------------- ### Get Opus Encoded Data (Packets) Source: https://voicechat.modrepo.de/index-all Retrieves the Opus-encoded audio data from microphone or sound packets. This is the compressed audio format used for transmission. ```java getOpusEncodedData() - Method in interface de.maxhenkel.voicechat.api.packets.MicrophonePacket getOpusEncodedData() - Method in interface de.maxhenkel.voicechat.api.packets.SoundPacket ``` -------------------------------- ### Sound Packet Builder Source: https://voicechat.modrepo.de/index-all A builder interface for creating sound packets. ```APIDOC ## Sound Packet Builder API ### Description Provides a builder pattern for constructing `SoundPacket` objects. ### Interface `SoundPacket.Builder` ``` -------------------------------- ### Get Name (Group and Volume Category) Source: https://voicechat.modrepo.de/index-all Retrieves the human-readable name for a group or a volume category. This is often used for display purposes in the user interface. ```java getName() - Method in interface de.maxhenkel.voicechat.api.Group getName() - Method in interface de.maxhenkel.voicechat.api.VolumeCategory ```