diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 33db1d7..d411f10 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,9 +6,9 @@
-
+
diff --git a/src/main/java/org/toop/UI/GameSelectorWindow.form b/src/main/java/org/toop/UI/GameSelectorWindow.form
index 57610aa..098f37b 100644
--- a/src/main/java/org/toop/UI/GameSelectorWindow.form
+++ b/src/main/java/org/toop/UI/GameSelectorWindow.form
@@ -1,6 +1,6 @@
-
+
@@ -42,7 +42,7 @@
-
+
@@ -52,62 +52,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -116,6 +68,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/org/toop/UI/GameSelectorWindow.java b/src/main/java/org/toop/UI/GameSelectorWindow.java
index 3b8f336..8868573 100644
--- a/src/main/java/org/toop/UI/GameSelectorWindow.java
+++ b/src/main/java/org/toop/UI/GameSelectorWindow.java
@@ -4,7 +4,6 @@ import org.toop.eventbus.GlobalEventBus;
import javax.swing.*;
import java.awt.event.ActionEvent;
-import java.awt.*;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
@@ -13,6 +12,7 @@ import java.util.concurrent.ExecutionException;
public class GameSelectorWindow extends JFrame {
private JPanel mainMenu;
private JTextField nameTextField;
+ private JTextField name2TextField;
private JTextField ipTextField;
private JTextField portTextField;
private JButton connectButton;
@@ -40,7 +40,8 @@ public class GameSelectorWindow extends JFrame {
private void init() {
connectButton.addActionListener((ActionEvent e) -> {
if( !nameTextField.getText().isEmpty() &&
- !ipTextField.getText().isEmpty() &&
+ !name2TextField.getText().isEmpty() &&
+ !ipTextField.getText().isEmpty() &&
!portTextField.getText().isEmpty()) {
CompletableFuture serverIdFuture = new CompletableFuture<>();
@@ -73,7 +74,7 @@ public class GameSelectorWindow extends JFrame {
GlobalEventBus.post(new Events.ServerEvents.CreateTicTacToeGameRequest( // TODO: Make this happen through commands send through the connection, instead of an event.
serverId,
nameTextField.getText(),
- "P",
+ name2TextField.getText(),
ticTacToeGame
));
String ticTacToeGameId;
@@ -91,7 +92,7 @@ public class GameSelectorWindow extends JFrame {
frame.add(ttt.getTTTPanel());
frame.revalidate();
frame.repaint();
- }else{
+ } else {
fillAllFields.setVisible(true);
}
});
diff --git a/src/main/java/org/toop/server/backend/TcpServer.java b/src/main/java/org/toop/server/backend/TcpServer.java
index 48484b8..a7f69a6 100644
--- a/src/main/java/org/toop/server/backend/TcpServer.java
+++ b/src/main/java/org/toop/server/backend/TcpServer.java
@@ -34,10 +34,10 @@ public class TcpServer implements Runnable {
protected final ExecutorService connectionExecutor = Executors.newCachedThreadPool();
// Shared queues for subclasses / consumers
- public final BlockingQueue receivedQueue = new LinkedBlockingQueue<>(); // unbounded; you may choose bounded
+ public final BlockingQueue receivedQueue = new LinkedBlockingQueue<>();
public final BlockingQueue sendQueue = new LinkedBlockingQueue<>();
- // (Optional) if you want to associate sockets -> player ids
+ // Association for sockets -> player ids
public final Map knownPlayers = new ConcurrentHashMap<>();
public final Map playersGames = new ConcurrentHashMap<>();
@@ -157,7 +157,7 @@ public class TcpServer implements Runnable {
}
};
- // Submit tasks - they will run on the shared connectionExecutor
+ // Input and Output mappings
connectionExecutor.submit(inputTask);
connectionExecutor.submit(outputTask);