private void handleServerVoiceChannel ( JsonNode jsonChannel ) { long channelId = jsonChannel . get ( "id" ) . asLong ( ) ; api . getServerVoiceChannelById ( channelId ) . map ( ServerVoiceChannelImpl . class :: cast ) . ifPresent ( channel -> { int oldBitrate = channel . getBitrate ( ) ; int newBitrate = jsonChannel . get ( "bitrate" ) . asInt ( ) ; if ( oldBitrate != newBitrate ) { channel . setBitrate ( newBitrate ) ; ServerVoiceChannelChangeBitrateEvent event = new ServerVoiceChannelChangeBitrateEventImpl ( channel , newBitrate , oldBitrate ) ; api . getEventDispatcher ( ) . dispatchServerVoiceChannelChangeBitrateEvent ( ( DispatchQueueSelector ) channel . getServer ( ) , channel . getServer ( ) , channel , event ) ; } int oldUserLimit = channel . getUserLimit ( ) . orElse ( 0 ) ; int newUserLimit = jsonChannel . get ( "user_limit" ) . asInt ( ) ; if ( oldUserLimit != newUserLimit ) { channel . setUserLimit ( newUserLimit ) ; ServerVoiceChannelChangeUserLimitEvent event = new ServerVoiceChannelChangeUserLimitEventImpl ( channel , newUserLimit , oldUserLimit ) ; api . getEventDispatcher ( ) . dispatchServerVoiceChannelChangeUserLimitEvent ( ( DispatchQueueSelector ) channel . getServer ( ) , channel . getServer ( ) , channel , event ) ; } } ) ; }
Handles a server voice channel update .