Compare commits

...

2 Commits

Author SHA1 Message Date
Asecave 92d4f15e75 fixed wrong game start message 2022-03-25 20:44:28 +01:00
Asecave a78fac1baf added info <n> 2022-03-25 20:43:58 +01:00
1 changed files with 18 additions and 3 deletions

View File

@ -148,8 +148,6 @@ public class Game {
String args = msg.substring(5);
System.out.println(wordle);
if (args.length() == 5) {
databaseConnector.executeStatement("SELECT word FROM words WHERE word LIKE '" + args + "'");
@ -217,6 +215,23 @@ public class Game {
send(".");
} else if (msg.length() == 6) {
String rawLine = msg.substring(5);
int line = -1;
try {
line = Integer.parseInt(rawLine) - 1;
} catch (NumberFormatException e) {
send("-ERR wrong argument.");
}
if (line >= 0 && line < 5) {
if (words[line] != null) {
send("+OK " + words[line] + " " + generateCode(words[line]));
} else {
send("-ERR game hasn't progressed to this line yet.");
}
} else {
send("-ERR couldn't parse line.");
}
} else {
sendUniversalError();
}
@ -283,7 +298,7 @@ public class Game {
databaseConnector.executeStatement("SELECT * FROM Spielstand WHERE Username = '" + user.getName() + "'");
QueryResult result = databaseConnector.getCurrentQueryResult();
if (result != null && result.getData().length > 0) {
if (result != null && result.getData().length > 0 && !result.getData()[0][0].equals("null")) {
boolean foundEnd = false;
for (int i = 0; i < 5; i++) {
if (!result.getData()[0][i].equals("null")) {