public String[][] playerNameAndIds() { String[][] ids = new String[getPlayers().size()][2]; int i = 0; for (Player p : getPlayers()) { ids[i++] = new String[] {p.getName(), p.getId().getStringId()}; } return ids; }
/** * 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(); }
public Player getPlayer(String id) { for (Player p : getPlayers()) { if (p.getId().getStringId().equals(id)) return p; } return null; }
public void playerIds() { for (Player p : getPlayers()) { System.out.println(p.getName() + "\t" + p.getId().getStringId()); } }