Class VoiceRouter

java.lang.Object
com.hypixel.hytale.server.core.modules.voice.VoiceRouter

public class VoiceRouter extends Object
Routes voice frames to listeners. Player voice and plugin-emitted voice (entity-tracked, fixed-position, and non-spatial direct) share this path: proximity sources reach nearby same-world listeners via the world-partitioned player sets, while direct sources reach an explicit listener set with no distance falloff.
  • Constructor Details

    • VoiceRouter

      public VoiceRouter(@Nonnull VoiceModule voiceModule)
  • Method Details

    • updateSpeakerPositionCache

      public void updateSpeakerPositionCache(@Nonnull PlayerRef speaker, @Nonnull org.joml.Vector3d position, float eyeHeight, boolean isUnderwater, @Nonnull UUID worldId, int networkId, boolean isDead)
      Updates the position cache for a speaker (called from WorldThread). Also maintains the world-partitioned player sets for efficient cache routing.
    • removePlayerFromWorldSets

      public void removePlayerFromWorldSets(@Nonnull UUID playerId)
      Removes a player from world-partitioned tracking. Should be called when a player disconnects.
    • sendVoiceConfig

      public void sendVoiceConfig(@Nonnull PlayerRef player)
      Sends voice configuration to a player.
    • routeVoiceFromCache

      public void routeVoiceFromCache(@Nonnull PlayerRef speaker, @Nonnull VoiceData packet)
      Adapter for player voice: validates the inbound frame, resolves the speaker's cached position, and forwards it to proximity routing. Runs on a voice executor thread (not WorldThread) to avoid ~50ms tick latency.

      When a PlayerVoiceInterceptor is registered the frame runs through the chain first, which can rewrite metadata or audio, choose the audience, or drop it. Otherwise it routes by proximity directly.