Added: Specific Error Display

This commit is contained in:
rubenpirreram
2026-05-26 19:08:11 +02:00
parent 9083fd8df4
commit 55ce0c1d0a
27 changed files with 223 additions and 149 deletions
@@ -78,10 +78,12 @@ public class ClientLauncherTUI {
}
System.setProperty("java.rmi.server.hostname", myIP);
RMIClient client = new RMIClient(controller, IP, 1099, myIP);
if (client.connect(username, proposedNumPlayers)) {
ErrorType serverResponse=client.connect(username, proposedNumPlayers);
if (serverResponse==null) {
System.out.println("Succesfully connected to RMI server\n\n");
} else {
System.out.println("RMI connection refused\n\n");
controller.view.showError(serverResponse);
return;
}
controller.setClient(client);
@@ -92,10 +94,12 @@ public class ClientLauncherTUI {
} else if (networkType == 1) {
// Connect
TCPClient client = new TCPClient(controller, IP, 8080,8081);
if (client.connect(username, proposedNumPlayers)) {
ErrorType serverResponse=client.connect(username, proposedNumPlayers);
if (serverResponse==null) {
System.out.println("Succesfully connected to TCP server\n\n");
} else {
System.out.println("TCP connection refused\n\n");
controller.view.showError(serverResponse);
return;
}
controller.setClient(client);
@@ -154,7 +158,7 @@ public class ClientLauncherTUI {
System.out.println("Insert the required position:");
pos = scanner.nextInt();
} catch (Exception e) {
view.showError("ERROR: Invalid input(expected number)");
view.showMessage("ERROR: Invalid input(expected number)");
return;
}
}
@@ -178,7 +182,7 @@ public class ClientLauncherTUI {
}
else
{
view.showError("ERROR: Invalid input(action not valid)");
view.showMessage("ERROR: Invalid input(action not valid)");
}
}