commit 7cb065ee664920b457a6a91852d7841ce8d1e7be
parent 3a2ccb7f05e9323eac5223f389ba97735e8ade22
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date: Mon, 25 Nov 2019 19:20:15 +0100
Use a separate string for Main Menu
Diffstat:
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/servertask.java b/servertask.java
@@ -14,6 +14,7 @@ public class servertask implements Runnable {
private static String[][] chars = new String[3][2];
private static int roundAvg = 0;
private String lastMsg = "";
+ private String mainMenu = "";
private Lock lock = new ReentrantLock();
private int login(String m) {
@@ -138,9 +139,9 @@ public class servertask implements Runnable {
DataOutputStream outputStr = new DataOutputStream(
new BufferedOutputStream(connection.getOutputStream()));
- lastMsg = "Welcome to RT\nSelect one:\n1 Signup\n2 Login\nq Quit";
+ mainMenu = "Welcome to RT\nSelect one:\n1 Signup\n2 Login\nq Quit";
notifyClient(outputStr,
- lastMsg);
+ mainMenu);
String message = inputStr.readUTF();
int val = 0;
@@ -158,7 +159,7 @@ public class servertask implements Runnable {
"Registration Successful\n" +
"Please press 2 to login");
} else
- notifyClient(outputStr, "Invalid Input\nTry again\n" + lastMsg);
+ notifyClient(outputStr, "Invalid Input\nTry again\n" + mainMenu);
}
if (val == 2 && loggedin == 0) {
outputStr.writeUTF("Kindly enter your" +
@@ -174,7 +175,7 @@ public class servertask implements Runnable {
"Initializing game world...\n");
initGame();
lastMsg = "Please select a character " +
- "in 60 seconds :" + "\n" +
+ "in 60 seconds :" + "\n" +
"1 " + chars[0][0] + "\n" +
"2 " + chars[1][0] + "\n" +
"3 " + chars[2][0] + "\n" +
@@ -209,16 +210,17 @@ public class servertask implements Runnable {
} else
notifyClient(outputStr, "Login Failed\n" +
"Please try again\n" +
- "Welcome to RT\nSelect one:\n1 Signup\n2 Login\nq Quit");
+ mainMenu);
} else
notifyClient(outputStr, "Invalid format\n" +
"Please try again\n" +
- "Welcome to RT\nSelect one:\n1 Signup\n2 Login\nq Quit");
+ mainMenu);
}
} else
notifyClient(outputStr, "Invalid Input\n" +
"Please try again\n" +
- "Welcome to RT\nSelect one:\n1 Signup\n2 Login\nq Quit");
+ mainMenu);
+ loggedin = 0;
message = inputStr.readUTF();
}
server.Groups.remove(pgroup);