mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Move case done
This commit is contained in:
@@ -50,6 +50,7 @@ public class TicTacToeServer extends TcpServer {
|
|||||||
this.command = null;
|
this.command = null;
|
||||||
this.arguments = null;
|
this.arguments = null;
|
||||||
this.isValidCommand = false;
|
this.isValidCommand = false;
|
||||||
|
this.returnMessage = TicTacToeServerMessage.ERR;
|
||||||
this.errorMessage = "The received command is empty";
|
this.errorMessage = "The received command is empty";
|
||||||
this.originalCommand = receivedCommand;
|
this.originalCommand = receivedCommand;
|
||||||
return;
|
return;
|
||||||
@@ -60,6 +61,7 @@ public class TicTacToeServer extends TcpServer {
|
|||||||
this.command = null;
|
this.command = null;
|
||||||
this.arguments = null;
|
this.arguments = null;
|
||||||
this.isValidCommand = false;
|
this.isValidCommand = false;
|
||||||
|
this.returnMessage = TicTacToeServerMessage.ERR;
|
||||||
this.errorMessage = "The received command is empty or couldn't be split";
|
this.errorMessage = "The received command is empty or couldn't be split";
|
||||||
this.originalCommand = receivedCommand;
|
this.originalCommand = receivedCommand;
|
||||||
return;
|
return;
|
||||||
@@ -69,8 +71,14 @@ public class TicTacToeServer extends TcpServer {
|
|||||||
switch (commandEnum) {
|
switch (commandEnum) {
|
||||||
case MOVE -> {
|
case MOVE -> {
|
||||||
if (segments.length == 2 && !segments[1].isEmpty()) {
|
if (segments.length == 2 && !segments[1].isEmpty()) {
|
||||||
ParsedCommand toReturn = new ParsedCommand(commandEnum, new ArrayList<Object>(1));
|
this.command = commandEnum;
|
||||||
toReturn.arguments.add(segments[1]);
|
this.arguments = new ArrayList<Object>();
|
||||||
|
this.arguments.add(segments[1]);
|
||||||
|
this.returnMessage = TicTacToeServerMessage.OK;
|
||||||
|
this.isValidCommand = true;
|
||||||
|
this.errorMessage = null;
|
||||||
|
this.originalCommand = receivedCommand;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case
|
case
|
||||||
|
|||||||
Reference in New Issue
Block a user