Package net.dv8tion.jda.api.audio.hooks
Class ListenerProxy
java.lang.Object
net.dv8tion.jda.api.audio.hooks.ListenerProxy
- All Implemented Interfaces:
ConnectionListener
Internal implementation of
ConnectionListener, to handle possible exceptions thrown by user code.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonPing(long ping) Called when JDA send a heartbeat packet to Discord and Discord sends an acknowledgement.voidonStatusChange(ConnectionStatus status) Called when the status of the audio channel changes.voidonUserSpeakingModeUpdate(UserSnowflake user, EnumSet<SpeakingMode> modes) This method is used to listen for users changing their speaking mode.voidsetListener(ConnectionListener listener) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.dv8tion.jda.api.audio.hooks.ConnectionListener
onUserSpeakingModeUpdate
-
Constructor Details
-
ListenerProxy
public ListenerProxy()
-
-
Method Details
-
onPing
public void onPing(long ping) Description copied from interface:ConnectionListenerCalled when JDA send a heartbeat packet to Discord and Discord sends an acknowledgement. The time difference between sending and receiving the acknowledgement is calculated as the ping.- Specified by:
onPingin interfaceConnectionListener- Parameters:
ping- The time, in milliseconds, for round-trip packet travel to discord.
-
onStatusChange
Description copied from interface:ConnectionListenerCalled when the status of the audio channel changes. Used to track the connection state of the audio connection for easy debug and status display for clients.- Specified by:
onStatusChangein interfaceConnectionListener- Parameters:
status- The newConnectionStatusof the audio connection.
-
onUserSpeakingModeUpdate
public void onUserSpeakingModeUpdate(@Nonnull UserSnowflake user, @Nonnull EnumSet<SpeakingMode> modes) Description copied from interface:ConnectionListenerThis method is used to listen for users changing their speaking mode.Whenever a user joins a voice channel, this is fired once to define the initial speaking modes.
To detect when a user is speaking, a
AudioReceiveHandlershould be used instead.This method works independently of the user cache. The provided user might not be cached.
- Specified by:
onUserSpeakingModeUpdatein interfaceConnectionListener- Parameters:
user- The user who changed their speaking modemodes- The new speaking modes of the user
-
setListener
-
getListener
-