Disconnected and leave events were not on the proper handlers

This commit is contained in:
Manevolent
2018-08-05 19:47:35 -04:00
parent a316b76d70
commit 3d09c5ef21
2 changed files with 9 additions and 15 deletions
@@ -90,11 +90,12 @@ public class LocalTeamspeakClientSocket
throw new RuntimeException(e); throw new RuntimeException(e);
} }
for (TS3Listener listener : listeners)
listener.onDisconnected(new DisconnectedEvent(command.toMap())); DisconnectedEvent e = new DisconnectedEvent(command.toMap());
commandExecutionService.submit(() -> listeners.forEach(e::fire));
} else { } else {
for (TS3Listener listener : listeners) ClientLeaveEvent e = new ClientLeaveEvent(command.toMap());
listener.onClientLeave(new ClientLeaveEvent(command.toMap())); commandExecutionService.submit(() -> listeners.forEach(e::fire));
} }
} }
}); });
@@ -13,6 +13,7 @@ import java.io.IOException;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.Base64; import java.util.Base64;
import java.util.Random;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@@ -142,17 +143,9 @@ public class ServerConnectionTest {
@Override @Override
public void onChannelSubscribed(ChannelSubscribedEvent e) { public void onChannelSubscribed(ChannelSubscribedEvent e) {
try { System.err.println("doing");
client.getChannelInfo(e.getChannelId()); client.setNickname("EEEE" + (new Random().nextInt(1000)));
} catch (IOException e1) { System.err.println("done");
e1.printStackTrace();
} catch (TimeoutException e1) {
e1.printStackTrace();
} catch (ExecutionException e1) {
e1.printStackTrace();
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} }
}); });