Personally, I would create a new class that will act as a group of players. This will allow you to control the entire group rather than each Player individually. This is a quick example of what I mean.
Code:
import java.util.ArrayList;
public class AssaultTeam {
/**
* Contains the Players that are on the team. (Limited to four)
*/
private ArrayList<Player> members = new ArrayList<Player>();
/**
* Adds a Member to the team.
* @param p The member to add to the team.
*/
public void addMember(Player p) {
//The team is full, so don't add.
if(members.size() >= 4)
return;
//Add the Player to the team.
members.add(p);
}
/**
* removes a Member from the team.
* @param p The member to remove from the team.
*/
public void removeMember(Player p) {
//Player is not on the team, so don't remove.
if(!members.contains(p))
return;
//Remove the player.
members.remove(p);
}
/**
* Launches the team into the game.
*/
public void launchTeam() {
//Loops through the players and prepares them for the game to start.
for(Player p : members) {
/*
* All code for launching the team should go here. For example
* p.teleportToX = 3333;
* p.teleportToY = 3333;
* p.replenishHealth();
* p.replenishPrayer();
*/
}
}
}
When starting a game, you could do something like this.
Code:
public static void newGame(Player[] members) {
AssaultTeam team = new AssaultTeam();
team.addMember(members[0]);
team.addMember(members[1]);
team.addMember(members[2]);
team.addMember(members[3]);
team.launch();
}