Contents
- Description
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- getPlayerId()
- isSpeaking()
- setSpeaking(boolean)
- isSilenced()
- setSilenced(boolean)
- isRoutingDisabled()
- setRoutingDisabled(boolean)
- incrementConsecutiveErrors()
- resetConsecutiveErrors()
- getConsecutiveErrors()
- checkRateLimit(int, int)
- shouldLogRateLimit()
- getLastPacketTime()
- getTokenBucket()
- getTotalPacketsReceived()
- getTotalPacketsRateLimited()
- getSpeakingStateChanges()
- getStatsString()
Class VoicePlayerState
java.lang.Object
com.hypixel.hytale.server.core.modules.voice.VoicePlayerState
Per-player voice state for rate limiting and tracking.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckRateLimit(int maxPacketsPerSecond, int burstCapacity) Checks if a voice packet should be allowed based on token bucket rate limiting.intGets the current consecutive error count.longintReturns a summary string of statistics for debugging.doublelonglongintIncrements the consecutive error counter and returns the new count.booleanWhether voice routing has been disabled for this player due to consecutive errors.booleanbooleanvoidResets the consecutive error counter (called on successful routing).voidsetRoutingDisabled(boolean disabled) Sets whether voice routing is disabled for this player.voidsetSilenced(boolean silenced) voidsetSpeaking(boolean speaking) booleanChecks if rate limiting should be logged (throttled to once per 10 seconds).
-
Constructor Details
-
VoicePlayerState
-
-
Method Details
-
getPlayerId
-
isSpeaking
public boolean isSpeaking() -
setSpeaking
public void setSpeaking(boolean speaking) -
isSilenced
public boolean isSilenced() -
setSilenced
public void setSilenced(boolean silenced) -
isRoutingDisabled
public boolean isRoutingDisabled()Whether voice routing has been disabled for this player due to consecutive errors. -
setRoutingDisabled
public void setRoutingDisabled(boolean disabled) Sets whether voice routing is disabled for this player. -
incrementConsecutiveErrors
public int incrementConsecutiveErrors()Increments the consecutive error counter and returns the new count. -
resetConsecutiveErrors
public void resetConsecutiveErrors()Resets the consecutive error counter (called on successful routing). -
getConsecutiveErrors
public int getConsecutiveErrors()Gets the current consecutive error count. -
checkRateLimit
public boolean checkRateLimit(int maxPacketsPerSecond, int burstCapacity) Checks if a voice packet should be allowed based on token bucket rate limiting. Returns true if allowed, false if rate limited. Synchronized to ensure atomic compound operations across threads.- Parameters:
maxPacketsPerSecond- The sustained rate limit (tokens added per second)burstCapacity- The maximum burst allowance (max tokens in bucket)
-
shouldLogRateLimit
public boolean shouldLogRateLimit()Checks if rate limiting should be logged (throttled to once per 10 seconds). Returns true if a log message should be emitted. -
getLastPacketTime
public long getLastPacketTime() -
getTokenBucket
public double getTokenBucket() -
getTotalPacketsReceived
public long getTotalPacketsReceived() -
getTotalPacketsRateLimited
public long getTotalPacketsRateLimited() -
getSpeakingStateChanges
public int getSpeakingStateChanges() -
getStatsString
Returns a summary string of statistics for debugging.
-