/**
   * Creates control server, connect it to the environment and returns the instance.
   *
   * @return StoryControlServer instance
   * @throws PogamutException
   */
  public static ControlServer createServer() throws PogamutException {
    UT2004ServerModule module = new TestControlServerModule();
    UT2004ServerFactory factory = new UT2004ServerFactory(module);

    IAgentId agentID = new AgentId("TestControlServer");
    ControlServer server =
        (ControlServer)
            factory.newAgent(
                new UT2004AgentParameters()
                    .setAgentId(agentID)
                    .setWorldAddress(new SocketConnectionAddress("127.0.0.1", 3001)));
    server.start();

    return server;
  }
  /**
   * This method is called when the server is started either from IDE or from command line. It
   * connects the server to the game.
   *
   * @param args
   */
  public static void main(String args[]) throws PogamutException {
    //        UT2004ServerModule module = new StoryControlServerModule();
    //        UT2004ServerFactory factory = new UT2004ServerFactory(module);
    //
    //        IAgentId agentID = new AgentId("PogamutObserver");
    //        StoryControlServer server = (StoryControlServer) factory.newAgent(new
    // UT2004AgentParameters().setAgentId(agentID).setWorldAddress(new
    // SocketConnectionAddress("127.0.0.1", 3001)));

    //        server.start();
    //        server.initialize();
    ControlServer server = createServer();
    System.out.println(server.getAgents().size());
    System.out.println(server.getPlayers().size());

    for (Player p : server.getPlayers()) {
      System.out.println(p.getName() + " " + p.getId());
    }
    // server.kick("");
    // server.stop();

    server.startTraceData();
  }