[Megameknet-cvs] MegaMekNET/src/server/campaign/commands UnVoteCommand.java,1.1,1.2 CyclopsCommand.j
Status: Inactive
Brought to you by:
mcwizard
From: Immanuel S. <im...@us...> - 2005-04-09 09:48:24
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/src/server/campaign/commands Modified Files: UnVoteCommand.java CyclopsCommand.java Log Message: Cyclops changes and some minor corrections to the xml loading Index: CyclopsCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/CyclopsCommand.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CyclopsCommand.java 25 Mar 2005 19:52:54 -0000 1.2 --- CyclopsCommand.java 9 Apr 2005 09:47:44 -0000 1.3 *************** *** 16,23 **** import java.net.MalformedURLException; import java.net.URL; ! import common.House; ! import common.Planet; import server.campaign.CampaignMain; import server.cyclops.Cyclops; --- 16,25 ---- import java.net.MalformedURLException; import java.net.URL; ! import java.util.LinkedList; ! import java.util.List; import server.campaign.CampaignMain; import server.cyclops.Cyclops; + import common.House; + import common.Planet; *************** *** 41,44 **** --- 43,48 ---- return "Calls manually any cyclops command. Supported commands are:<br>" + " host#url - set the cyclops-host to 'url'.<br>" + + " player.writeFromList[#playerspercall] - Send all players to cyclops.<br>" + + " player.write#player - Send the player to cyclops.<br>" + " planet.initFromList - Send all planets to cyclops.<br>" + " planet.init#planet - Send the 'planet' to cyclops.<br>" + *************** *** 67,70 **** --- 71,90 ---- return; } + } else if (command.equals("player.writeFromList")) { + if (param.length > 1) { + int packagesize = Integer.parseInt(param[1]); + List all = new LinkedList(CampaignMain.cm.getAllPlayers().values()); + for (int i = 0; i < (all.size()+packagesize-1)/packagesize && report == null; ++i) { + List l = all.subList(i*packagesize, (i+1)*packagesize); + System.out.println("index "+(i*packagesize)+" to "+((i+1)*packagesize)); + report = Cyclops.player_writeFromList(l); + } + + } else + report = Cyclops.player_writeFromList(CampaignMain.cm.getAllPlayers().values()); + } else if (command.equals("player.write")) { + if (param.length < 2) + throw new IllegalUsageException(); + report = Cyclops.player_write(CampaignMain.cm.getPlayer(param[1])); } else if (command.equals("planet.initFromList")) { report = Cyclops.planet_initFromList(CampaignMain.cm.getData().getAllPlanets()); Index: UnVoteCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/UnVoteCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UnVoteCommand.java 13 Mar 2005 17:20:39 -0000 1.1 --- UnVoteCommand.java 9 Apr 2005 09:47:44 -0000 1.2 *************** *** 14,20 **** package server.campaign.commands; import java.util.Iterator; - import java.util.List; - import server.campaign.CampaignMain; import server.campaign.SPlayer; --- 14,19 ---- package server.campaign.commands; + import java.util.Collection; import java.util.Iterator; import server.campaign.CampaignMain; import server.campaign.SPlayer; *************** *** 39,43 **** SPlayer p = CampaignMain.cm.getPlayer(userName); String target = param[0]; ! List l = VoteManager.getInstance().getVotesFrom(p.getName()); Iterator it = l.iterator(); while (it.hasNext()){ --- 38,42 ---- SPlayer p = CampaignMain.cm.getPlayer(userName); String target = param[0]; ! Collection l = VoteManager.getInstance().getVotesFrom(p.getName()); Iterator it = l.iterator(); while (it.hasNext()){ |