Ejemplo n.º 1
0
 public void execute(ClientConnection connection, String args) {
   int count = 0;
   for (ServerGame g : serverState.getCurrentGames()) {
     if (g != null) {
       connection.writelnToClient(g.getGameString());
       count++;
     }
   }
   connection.writelnToClient("");
   connection.writeToClientPrompt(count + " games displayed.");
 }
Ejemplo n.º 2
0
public class ListGamesCommand implements Command {
  private static ServerState serverState = ServerState.getInstance();

  public void execute(ClientConnection connection, String args) {
    int count = 0;
    for (ServerGame g : serverState.getCurrentGames()) {
      if (g != null) {
        connection.writelnToClient(g.getGameString());
        count++;
      }
    }
    connection.writelnToClient("");
    connection.writeToClientPrompt(count + " games displayed.");
  }
}