info und saveGame funkt

This commit is contained in:
Asecave 2022-03-25 20:19:29 +01:00
parent 37736dbfad
commit 84a81bf2b4
1 changed files with 22 additions and 5 deletions

View File

@ -1,6 +1,5 @@
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Iterator;
public class Game {
@ -207,6 +206,21 @@ public class Game {
} else if (msg.startsWith("info")) {
if (msg.length() == 4) {
send("+OK");
for (int i = 0; i < words.length; i++) {
if (words[i] == null) {
break;
}
send(words[i] + " " + generateCode(words[i]));
}
send(".");
} else if (msg.length() == 6) {
} else {
sendUniversalError();
}
} else if (msg.startsWith("exit")) {
if (user != null) {
@ -270,10 +284,13 @@ public class Game {
databaseConnector.executeStatement("SELECT * FROM Spielstand WHERE Username = '" + user.getName() + "'");
QueryResult result = databaseConnector.getCurrentQueryResult();
if (result != null && result.getData().length > 0) {
for (int i = 0; i < result.getData().length; i++) {
boolean foundEnd = false;
for (int i = 0; i < 5; i++) {
if (!result.getData()[0][i].equals("null")) {
words[i] = result.getData()[0][i];
if (result.getData()[0][i] == null) {
count = i - 1;
} else if (!foundEnd) {
count = i;
foundEnd = true;
}
}
send("+OK game running");