forked from IF-LK-2020/wordle
Kleine Bugs gefixt die mich getriggert haben
This commit is contained in:
@@ -70,7 +70,7 @@ public class WordleServer extends Server {
|
|||||||
} else if (m.equalsIgnoreCase("PASS") && !u.loggedIn()) {
|
} else if (m.equalsIgnoreCase("PASS") && !u.loggedIn()) {
|
||||||
m = pMessage.substring(5, pMessage.length());
|
m = pMessage.substring(5, pMessage.length());
|
||||||
u.setPassword(m);
|
u.setPassword(m);
|
||||||
if (u.getPassword() != null && u.getUsername() != null) {
|
if (u.loggedIn()) {
|
||||||
if (query.checkLogin(u.getUsername(), u.getPassword())) {
|
if (query.checkLogin(u.getUsername(), u.getPassword())) {
|
||||||
send(pClientIP, pClientPort, "+OK welcome");
|
send(pClientIP, pClientPort, "+OK welcome");
|
||||||
query.pullStats(u);
|
query.pullStats(u);
|
||||||
@@ -79,6 +79,10 @@ public class WordleServer extends Server {
|
|||||||
u.setUsername("");
|
u.setUsername("");
|
||||||
send(pClientIP, pClientPort, "-ERR login not valid");
|
send(pClientIP, pClientPort, "-ERR login not valid");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
u.setPassword("");
|
||||||
|
u.setUsername("");
|
||||||
|
send(pClientIP, pClientPort, "-ERR login not valid");
|
||||||
}
|
}
|
||||||
} else if (m.equalsIgnoreCase("WOTD")) {
|
} else if (m.equalsIgnoreCase("WOTD")) {
|
||||||
if (!isToday(u.getLastDayWOTDPlayed())) {
|
if (!isToday(u.getLastDayWOTDPlayed())) {
|
||||||
@@ -94,17 +98,21 @@ public class WordleServer extends Server {
|
|||||||
send(pClientIP, pClientPort, "-ERR game finished");
|
send(pClientIP, pClientPort, "-ERR game finished");
|
||||||
}
|
}
|
||||||
} else if (m.equalsIgnoreCase("PLAY")) {
|
} else if (m.equalsIgnoreCase("PLAY")) {
|
||||||
if (isToday(u.getLastDayWOTDPlayed())) {
|
if (u.loggedIn()) {
|
||||||
if (u.getGame().getGameStatus() != 1) {
|
if (isToday(u.getLastDayWOTDPlayed())) {
|
||||||
u.getGame().startGame(query.getWord(), 0);
|
if (u.getGame().getGameStatus() != 1) {
|
||||||
u.setState(2);
|
u.getGame().startGame(query.getWord(), 0);
|
||||||
send(pClientIP, pClientPort, "+OK Game ready");
|
u.setState(2);
|
||||||
} else if (u.getGame().getIsWOTD() == 0) {
|
send(pClientIP, pClientPort, "+OK Game ready");
|
||||||
u.setState(2);
|
} else if (u.getGame().getIsWOTD() == 0) {
|
||||||
send(pClientIP, pClientPort, "+OK Game continues");
|
u.setState(2);
|
||||||
|
send(pClientIP, pClientPort, "+OK Game continues");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
send(pClientIP, pClientPort, "-ERR wotd not finished");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
send(pClientIP, pClientPort, "-ERR wotd not finished");
|
send(pClientIP, pClientPort, "-ERR Not logged in");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
send(pClientIP, pClientPort, "-ERR Command not valid in this state");
|
send(pClientIP, pClientPort, "-ERR Command not valid in this state");
|
||||||
@@ -192,18 +200,22 @@ public class WordleServer extends Server {
|
|||||||
send(pClientIP, pClientPort, "won in 4 turn: " + u.getWonInTurnIndex(3));
|
send(pClientIP, pClientPort, "won in 4 turn: " + u.getWonInTurnIndex(3));
|
||||||
send(pClientIP, pClientPort, "won in 5 turn: " + u.getWonInTurnIndex(4));
|
send(pClientIP, pClientPort, "won in 5 turn: " + u.getWonInTurnIndex(4));
|
||||||
send(pClientIP, pClientPort, "won in 6 turn: " + u.getWonInTurnIndex(5));
|
send(pClientIP, pClientPort, "won in 6 turn: " + u.getWonInTurnIndex(5));
|
||||||
} else if (m.equalsIgnoreCase("PLAY")) {
|
} else if (m.equalsIgnoreCase("PLAY")) {
|
||||||
if (isToday(u.getLastDayWOTDPlayed())) {
|
if (u.loggedIn()) {
|
||||||
if (u.getGame().getGameStatus() != 1) {
|
if (isToday(u.getLastDayWOTDPlayed())) {
|
||||||
u.getGame().startGame(query.getWord(), 0);
|
if (u.getGame().getGameStatus() != 1) {
|
||||||
u.setState(2);
|
u.getGame().startGame(query.getWord(), 0);
|
||||||
send(pClientIP, pClientPort, "+OK Game ready");
|
u.setState(2);
|
||||||
} else if (u.getGame().getIsWOTD() == 0) {
|
send(pClientIP, pClientPort, "+OK Game ready");
|
||||||
u.setState(2);
|
} else if (u.getGame().getIsWOTD() == 0) {
|
||||||
send(pClientIP, pClientPort, "+OK Game continues");
|
u.setState(2);
|
||||||
|
send(pClientIP, pClientPort, "+OK Game continues");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
send(pClientIP, pClientPort, "-ERR wotd not finished");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
send(pClientIP, pClientPort, "-ERR wotd not finished");
|
send(pClientIP, pClientPort, "-ERR not logged in");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
send(pClientIP, pClientPort, "-ERR Command not valid in this state");
|
send(pClientIP, pClientPort, "-ERR Command not valid in this state");
|
||||||
|
|||||||
Reference in New Issue
Block a user