v0.94.4.72 - picking "random" class doesnt assign until the arena begins now

This commit is contained in:
Brian 2012-06-07 19:39:08 -04:00
parent 7e48ec7410
commit c6fada2bfd
5 changed files with 17 additions and 9 deletions

View File

@ -1,7 +1,7 @@
name: MobArena
author: garbagemule
main: com.garbagemule.MobArena.MobArena
version: 0.94.4.71
version: 0.94.4.72
softdepend: [Spout,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells,Vault]
commands:
ma:

View File

@ -431,6 +431,7 @@ public class ArenaImpl implements Arena
for (Player p : randoms) {
assignRandomClass(p);
}
randoms.clear();
// Then check if there are still players left.
if (arenaPlayers.isEmpty()) {
@ -978,6 +979,11 @@ public class ArenaImpl implements Arena
arenaPlayer.setArenaClass(arenaClass);
arenaClass.grantItems(p);
}
@Override
public void addRandomPlayer(Player p) {
randoms.add(p);
}
@Override
public void assignRandomClass(Player p)

View File

@ -820,7 +820,7 @@ public class ArenaListener
Messenger.tellPlayer(p, Msg.LOBBY_CLASS_PICKED, TextUtils.camelCase(className), arena.getClassLogo(className));
}
else {
arena.assignRandomClass(p);
arena.addRandomPlayer(p);
Messenger.tellPlayer(p, Msg.LOBBY_CLASS_RANDOM);
}
}

View File

@ -24,14 +24,14 @@ public class ClassLimitManager
public int getClassLimit(ArenaClass ac) {
if (classLimits.get(ac) != null)
return classLimits.get(ac).intValue();
return classLimits.get(ac);
else
return addNewClass(ac);
}
public int getClassInUse(ArenaClass ac) {
if (classesInUse.get(ac) != null)
return classesInUse.get(ac).intValue();
return classesInUse.get(ac);
else {
addNewClass(ac);
return 0;
@ -46,13 +46,13 @@ public class ClassLimitManager
private void initInUseMap() {
for (ArenaClass ac : plugin.getArenaMaster().getClasses().values()) {
classesInUse.put(ac, Integer.valueOf(0));
classesInUse.put(ac, 0);
}
}
private int addNewClass(ArenaClass ac) {
classLimits.put(ac, Integer.valueOf(-1));
classesInUse.put(ac, Integer.valueOf(0));
classLimits.put(ac, -1);
classesInUse.put(ac, 0);
limits.set(ac.getName(), -1);
return -1;
}
@ -66,9 +66,9 @@ public class ClassLimitManager
}
public boolean canPlayerJoinClass(ArenaClass ac) {
if (classLimits.get(ac).intValue() <= -1)
if (classLimits.get(ac) <= -1)
return true;
else if (classesInUse.get(ac).intValue() >= classLimits.get(ac).intValue())
else if (classesInUse.get(ac) >= classLimits.get(ac))
return false;
else
return true;

View File

@ -178,6 +178,8 @@ public interface Arena
////////////////////////////////////////////////////////////////////*/
public void assignClass(Player p, String className);
public void addRandomPlayer(Player p);
public void assignRandomClass(Player p);