API reference - SocketSVC Docs
SocketSVC Docs

API reference

Generated reference for SocketSVC's public Java APIs

這一頁還沒有翻譯,以下顯示英文原文。

These pages are generated from the Javadoc on the public API sources, so they always match the code in the repository. The prose guides explain how to use the APIs: Spatial audio API for servers and addons, and Proxy addon API for Velocity / BungeeCord relay addons.

Every release publishes these APIs as interface-only jars, served as Maven coordinates, so an addon names a version instead of vendoring a jar. Always compileOnly — SocketSVC supplies the classes at runtime, and shading them puts a second copy of the interfaces on the classpath.

build.gradle.kts
repositories {
    maven("https://socketsvc-updater.vercel.app/maven") {
        name = "SocketSVC"
        // Nothing else is published there, so no other lookup is slowed down by it.
        content { includeGroup("com.socketsvc") }
    }
}

Generated pages

Run pnpm gen:api in apps/docs after changing any public API source. Do not edit the files under content/docs/api by hand — they are overwritten.

Shared types

Speaker, position and audio-source types in com.socketsvc.api. They are shared by the Paper plugin and the server mods, so addon logic written against them ports between the two unchanged.

Included in both server-side API jars below; there is no separate coordinate for them.

TypeSummary
AudioPlayerOne-shot playback handle.
LocationalAudioChannelAn independent mono speaker.
MicrophoneAudioOne 20 ms slice of a player's microphone, handed to a MicrophoneTap.
MicrophoneTapA consumer of players' inbound microphone audio, registered through subscribeMicrophone.
MicrophoneTapHandleA live microphone subscription.
PcmSource48 kHz, mono, signed 16-bit PCM.
PcmSources—
SpatialPositionImmutable Bukkit world name and block coordinates; safe to use off the server thread.
SpatialSettingsLinear distance attenuation: full volume through fadeStart, silent at range.
VoiceClientStateWhether a player is running the SocketSVC client mod.
VoiceGroupInfoAn immutable snapshot of one voice group, as handed to addons and pushed to clients.
VoiceGroupTypeHow a group's audio relates to the ordinary proximity chat around it.
VoiceMuteInfoOne server-side voice mute, as addons and the console see it.

Paper plugin API

The entry point for Bukkit/Paper plugins. Obtain it from the Bukkit ServicesManager, compile against the API JAR with compileOnly, and never shade it.

compileOnly("com.socketsvc:socketsvc-server-paper-api:0.2.5")
TypeSummary
SocketSvcApiObtain with Bukkit ServicesManager.load(SocketSvcApi.class); use compileOnly, never shade this API.

Server mod API

The Fabric/NeoForge/Forge equivalent of the Paper API, identifying callers by mod id.

compileOnly("com.socketsvc:socketsvc-server-mod-api:0.2.5")
TypeSummary
SocketSvcModApiSpatial speaker API for Fabric/NeoForge/Forge server mods - the mod-side equivalent of the Paper plugin's SocketSvcApi, identifying callers by mod id instead of a Bukkit plugin.

Client API

Cross-mod client-side contract: query voice state and play sounds only the local player hears. Channels created here are local-only and never reach the voice connection.

compileOnly("com.socketsvc:socketsvc-client-api:0.2.5-mc26.3")

This is the one API jar built per Minecraft version — SocketSvcClientApi takes a net.minecraft Entity — so the version names the game version it was built against, and there is one for every supported version. Its classes carry Minecraft's official (Mojang) names, which is what NeoForge and Forge compile against; a Fabric mod on Yarn mappings needs a remap step.

TypeSummary
LocalAudioChannelA locally-rendered sound: only the local player hears it.
LocalEntityAudioChannelA LocalAudioChannel that follows a Minecraft entity, fading out past #getRange().
LocalPositionalAudioChannelA LocalAudioChannel fixed (or movable) at a point in the world, fading out past #getRange().
LocalStaticAudioChannelA LocalAudioChannel with no spatialization - plays at a flat volume regardless of camera position, e.g.
PcmSource48 kHz, mono, signed 16-bit PCM.
PcmSources—
SocketSvcClientApiCross-mod client-side contract: query voice state (mute/talking/connection) and render sounds that only the local player hears, positioned in 3D like a normal in-game sound.
SpatialDirectionWhich way a positional channel points, and how much quieter it is off-axis.
SpatialPositionImmutable in-world coordinates for a LocalPositionalAudioChannel, in the player's current world.
VoiceScreenA screen the server has published: where it is, what is on it, and where the playhead was.

Proxy API

Routing and observation for the Velocity / BungeeCord relay: which backend a player is relayed to, and what the relay is doing. The relay never decodes audio, so nothing about speakers, positions or volume lives here — that is the server-side spatial audio API.

compileOnly("com.socketsvc:socketsvc-proxy-api:0.2.5")
TypeSummary
ProxyBackendResolverChooses which backend voice listener a connecting player is relayed to, overriding the servers: map in the relay's own config.yml.
ProxyRelayListenerObserves the relay's connection lifecycle.
RelaySessionOne relayed voice connection, from the moment the relay has picked a backend until the connection closes.
SocketSvcProxyApiAddon API for the SocketSVC proxy relay plugin, on both Velocity and BungeeCord/Waterfall (the relay ships as one jar for both, and this is the same API on either).