Added: Specific Error Display
This commit is contained in:
@@ -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)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user