if (playerId != Player.PLAYER_NONE) { Player player = game.getPlayer(playerId); int teamId = player.getTeam();  if (teamId != Player.TEAM_NONE) { Enumeration teams = game.getTeams(); while (teams.hasMoreElements()) { Team team = (Team) teams.nextElement(); if (team.getId() == teamId) { Enumeration players = team.getPlayers(); while (players.hasMoreElements()) { Player teamPlayer = (Player) players.nextElement(); if (teamPlayer.getId() != player.getId()) { send(teamPlayer.getId(), new Packet(Packet.COMMAND_DEPLOY_MINEFIELDS, minefields)); } teamPlayer.addMinefields(minefields); } break; } } } else { player.addMinefields(minefields); }
Player player = game.getPlayer( playerId ); if ( null != player ) { int teamId = player.getTeam();  if (teamId != Player.TEAM_NONE) { Enumeration teams = game.getTeams(); while (teams.hasMoreElements()) { Team team = (Team) teams.nextElement(); if (team.getId() == teamId) { Enumeration players = team.getPlayers(); while (players.hasMoreElements()) { Player teamPlayer = (Player) players.nextElement(); if (teamPlayer.getId() != player.getId()) { send(teamPlayer.getId(), new Packet(Packet.COMMAND_DEPLOY_MINEFIELDS, minefields)); } teamPlayer.addMinefields(minefields); } break; } } } else { player.addMinefields(minefields); }
    private void processDeployMinefields(Vector minefields) {    	int playerId = Player.PLAYER_NONE;    	for (int i = 0; i < minefields.size(); i++) {    		Minefield mf = (Minefield) minefields.elementAt(i);    		playerId = mf.getPlayerId();    		    		game.addMinefield(mf);    		if (mf.getType() == Minefield.TYPE_VIBRABOMB) {    			game.addVibrabomb(mf);    		}    	}    	    	if (playerId != Player.PLAYER_NONE) {	    	Player player = game.getPlayer(playerId);	    	int teamId = player.getTeam();	    		    	if (teamId != Player.TEAM_NONE) {		    	Enumeration teams = game.getTeams();		    	while (teams.hasMoreElements()) {		    		Team team = (Team) teams.nextElement();		    		if (team.getId() == teamId) {		    			Enumeration players = team.getPlayers();		    			while (players.hasMoreElements()) {		    				Player teamPlayer = (Player) players.nextElement();		    				if (teamPlayer.getId() != player.getId()) {		    					send(teamPlayer.getId(), new Packet(Packet.COMMAND_DEPLOY_MINEFIELDS, minefields));		    				}		    				teamPlayer.addMinefields(minefields);		    			}		    			break;		    		}		    	}		    } else {		    	player.addMinefields(minefields);		    }    	}    }