Created
May 4, 2012 00:37
-
-
Save Double0negative/2590721 to your computer and use it in GitHub Desktop.
addplayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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