示例#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.");
 }
示例#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.");
  }
}