Skip to content

Instantly share code, notes, and snippets.

@Double0negative
Created May 4, 2012 00:37
Show Gist options
  • Save Double0negative/2590721 to your computer and use it in GitHub Desktop.
Save Double0negative/2590721 to your computer and use it in GitHub Desktop.
addplayer
public boolean addPlayer(Player p){
p.sendMessage(gameID+" "+ SettingsManager.getInstance().getSpawnCount(gameID)+" "+activePlayers.size());
if(mode == GameMode.WAITING){
if(activePlayers.size() < SettingsManager.getInstance().getSpawnCount(gameID)){
activePlayers.add(p);
p.sendMessage("Joining Arena " + gameID);
boolean placed = false;
for(int a = 1; a<SettingsManager.getInstance().getSpawnCount(gameID); a++){
if(!spawns.get(a)){
p.teleport(SettingsManager.getInstance().getSpawnPoint(gameID, a));
placed = true;
spawns.put(a, true);
break;
}
}
if(!placed){
p.sendMessage(ChatColor.RED + "Game "+gameID+" Is Full!");
activePlayers.remove(p);
return false;
}
}
if(activePlayers.size() >= c.getInt("auto-start-players"))
countdown(c.getInt("auto-start-time"));
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment