We don't have an "onConnected" event, adding that now.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package com.github.manevolent.ts3j.event;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ConnectedEvent extends BaseEvent {
|
||||
public ConnectedEvent(Map<String, String> map) {
|
||||
super(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fire(TS3Listener listener) {
|
||||
listener.onConnected(this);
|
||||
}
|
||||
}
|
||||
@@ -53,4 +53,5 @@ public interface TS3Listener {
|
||||
default void onClientPoke(ClientPokeEvent e) {}
|
||||
default void onClientComposing(ClientChatComposingEvent e) {}
|
||||
default void onPermissionList(PermissionListEvent e) {}
|
||||
default void onConnected(ConnectedEvent e) {}
|
||||
}
|
||||
|
||||
+8
@@ -2,8 +2,16 @@ package com.github.manevolent.ts3j.protocol.packet.handler.client;
|
||||
|
||||
import com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class LocalClientHandlerConnected extends LocalClientHandlerFull {
|
||||
public LocalClientHandlerConnected(LocalTeamspeakClientSocket client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAssigned() throws IOException, TimeoutException {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -188,6 +188,8 @@ public abstract class AbstractTeamspeakClientSocket
|
||||
|
||||
if (state == ClientConnectionState.DISCONNECTED && !initialState)
|
||||
onDisconnect();
|
||||
else if (state == ClientConnectionState.CONNECTED && !initialState)
|
||||
onConnect();
|
||||
|
||||
Ts3Debugging.debug("State changed: " + state.name());
|
||||
}
|
||||
@@ -214,6 +216,10 @@ public abstract class AbstractTeamspeakClientSocket
|
||||
}
|
||||
}
|
||||
|
||||
protected void onConnect() {
|
||||
|
||||
}
|
||||
|
||||
protected void onDisconnect() {
|
||||
clientId = -1;
|
||||
|
||||
|
||||
+10
-2
@@ -70,8 +70,8 @@ public class LocalTeamspeakClientSocket
|
||||
@Override
|
||||
public void process(AbstractTeamspeakClientSocket client, SingleCommand singleCommand)
|
||||
throws CommandProcessException {
|
||||
ChannelListEvent channelListEvent = new ChannelListEvent(singleCommand.toMap());
|
||||
for (TS3Listener listener : listeners) listener.onChannelList(channelListEvent);
|
||||
final ChannelListEvent channelListEvent = new ChannelListEvent(singleCommand.toMap());
|
||||
commandExecutionService.submit(() -> listeners.forEach(e -> e.onChannelList(channelListEvent)));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -273,6 +273,14 @@ public class LocalTeamspeakClientSocket
|
||||
super.setIdentity(identity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConnect() {
|
||||
super.onConnect();
|
||||
|
||||
final ConnectedEvent connectedEvent = new ConnectedEvent(Collections.emptyMap());
|
||||
commandExecutionService.submit(() -> listeners.forEach(e -> e.onConnected(connectedEvent)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDisconnect() {
|
||||
super.onDisconnect();
|
||||
|
||||
Reference in New Issue
Block a user