Server in working state, can be merged with working branch.

This commit is contained in:
lieght
2025-09-28 20:31:26 +02:00
committed by Bas Antonius de Jong
parent a9e63b3fcc
commit c76b7a800e
7 changed files with 399 additions and 202 deletions

View File

@@ -33,7 +33,7 @@ public class LocalTicTacToe { // TODO: Implement runnable
private boolean isLocal;
private String gameId;
private long connectionId = -1;
private long clientId = -1;
private String serverId = null;
private boolean[] isAiPlayer = new boolean[2];
@@ -210,13 +210,13 @@ public class LocalTicTacToe { // TODO: Implement runnable
}
private void receiveMessageAction(NetworkEvents.ReceivedMessage receivedMessage) {
if (receivedMessage.ConnectionId() != this.connectionId) {
if (receivedMessage.clientId() != this.clientId) {
return;
}
try {
logger.info(
"Received message from {}: {}", this.connectionId, receivedMessage.message());
"Received message from {}: {}", this.clientId, receivedMessage.message());
this.receivedQueue.put(receivedMessage.message());
} catch (InterruptedException e) {
logger.error("Error waiting for received Message", e);
@@ -224,7 +224,7 @@ public class LocalTicTacToe { // TODO: Implement runnable
}
private void sendCommand(String... args) {
new EventFlow().addPostEvent(NetworkEvents.SendCommand.class, this.connectionId, args).asyncPostEvent();
new EventFlow().addPostEvent(NetworkEvents.SendCommand.class, this.clientId, args).asyncPostEvent();
}
// private void endListeners() {