Exposed voice packets to the client
This commit is contained in:
@@ -26,6 +26,8 @@ package com.github.manevolent.ts3j.event;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import com.github.manevolent.ts3j.audio.Microphone;
|
||||
|
||||
public interface TS3Listener {
|
||||
|
||||
void onTextMessage(TextMessageEvent e);
|
||||
@@ -67,4 +69,5 @@ public interface TS3Listener {
|
||||
void onDisconnected(DisconnectedEvent e);
|
||||
|
||||
void onChannelSubscribed(ChannelSubscribedEvent e);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.github.manevolent.ts3j.event;
|
||||
|
||||
public interface TeamspeakListener {
|
||||
|
||||
void onTextMessage(TextMessageEvent e);
|
||||
|
||||
void onClientJoin(ClientJoinEvent e);
|
||||
|
||||
void onClientLeave(ClientLeaveEvent e);
|
||||
|
||||
void onServerEdit(ServerEditedEvent e);
|
||||
|
||||
void onChannelEdit(ChannelEditedEvent e);
|
||||
|
||||
void onChannelDescriptionChanged(ChannelDescriptionEditedEvent e);
|
||||
|
||||
void onClientMoved(ClientMovedEvent e);
|
||||
|
||||
void onChannelCreate(ChannelCreateEvent e);
|
||||
|
||||
void onChannelDeleted(ChannelDeletedEvent e);
|
||||
|
||||
void onChannelMoved(ChannelMovedEvent e);
|
||||
|
||||
void onChannelPasswordChanged(ChannelPasswordChangedEvent e);
|
||||
|
||||
void onPrivilegeKeyUsed(PrivilegeKeyUsedEvent e);
|
||||
|
||||
}
|
||||
+6
@@ -4,6 +4,7 @@ import com.github.manevolent.ts3j.command.CommandProcessException;
|
||||
import com.github.manevolent.ts3j.command.CommandProcessor;
|
||||
import com.github.manevolent.ts3j.command.MultiCommand;
|
||||
import com.github.manevolent.ts3j.protocol.Packet;
|
||||
import com.github.manevolent.ts3j.protocol.packet.PacketBody0Voice;
|
||||
import com.github.manevolent.ts3j.protocol.packet.PacketBody2Command;
|
||||
import com.github.manevolent.ts3j.protocol.packet.PacketBody3CommandLow;
|
||||
import com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket;
|
||||
@@ -11,6 +12,7 @@ import com.github.manevolent.ts3j.util.Ts3Debugging;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public abstract class LocalClientHandlerFull extends LocalClientHandler {
|
||||
protected LocalClientHandlerFull(LocalTeamspeakClientSocket client) {
|
||||
@@ -50,6 +52,10 @@ public abstract class LocalClientHandlerFull extends LocalClientHandler {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
||||
break;
|
||||
case VOICE:
|
||||
Consumer<PacketBody0Voice> handler = getClient().getVoiceHandler();
|
||||
if (handler != null) handler.accept((PacketBody0Voice) packet.getBody());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -69,6 +69,7 @@ public abstract class AbstractTeamspeakClientSocket
|
||||
|
||||
private CommandProcessor commandProcessor;
|
||||
|
||||
private Consumer<PacketBody0Voice> voiceHandler;
|
||||
private Consumer<Throwable> exceptionHandler = Throwable::printStackTrace;
|
||||
|
||||
private Identity identity = null;
|
||||
@@ -877,6 +878,14 @@ public abstract class AbstractTeamspeakClientSocket
|
||||
this.exceptionHandler = exceptionHandler;
|
||||
}
|
||||
|
||||
public Consumer<PacketBody0Voice> getVoiceHandler() {
|
||||
return voiceHandler;
|
||||
}
|
||||
|
||||
public void setVoiceHandler(Consumer<PacketBody0Voice> voiceHandler) {
|
||||
this.voiceHandler = voiceHandler;
|
||||
}
|
||||
|
||||
private class NetworkHandler implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user