wordle/src/Game.java

78 lines
1.2 KiB
Java

public class Game {
// Instanzvariablen - ersetzen Sie das folgende Beispiel mit Ihren Variablen
WordleServer wordleServer;
User user;
static DatabaseConnector databaseConnector;// Datenbankverbindung aufstellen
private String ip;
private int port;
private String wordle;
private String[] words;
private int count;
private int phase;
public Game(WordleServer wordleServer, String pClientIP, int pClientPort) {
this.wordleServer = wordleServer;
this.ip = pClientIP;
this.port = pClientPort;
user = new User();
send("+OK Hello there");
}
public void processMessage(String msg) {
if (msg.equals("quit")) {
send("+OK bye");
wordleServer.closeConnection(ip, port);
}
switch (phase) {
case 0:
login();
break;
case 1:
play();
break;
case 2:
end();
break;
}
}
private void login() {
}
private void play() {
}
private void end() {
}
private void send(String msg) {
wordleServer.send(ip, port, msg);
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}