From c6fada2bfdff483c515f7abad17334ad81c9ec75 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 7 Jun 2012 19:39:08 -0400 Subject: [PATCH] v0.94.4.72 - picking "random" class doesnt assign until the arena begins now --- resources/plugin.yml | 2 +- src/com/garbagemule/MobArena/ArenaImpl.java | 6 ++++++ src/com/garbagemule/MobArena/ArenaListener.java | 2 +- .../garbagemule/MobArena/ClassLimitManager.java | 14 +++++++------- src/com/garbagemule/MobArena/framework/Arena.java | 2 ++ 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/resources/plugin.yml b/resources/plugin.yml index cffa65e..81970ed 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -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: diff --git a/src/com/garbagemule/MobArena/ArenaImpl.java b/src/com/garbagemule/MobArena/ArenaImpl.java index 359237b..6a06686 100644 --- a/src/com/garbagemule/MobArena/ArenaImpl.java +++ b/src/com/garbagemule/MobArena/ArenaImpl.java @@ -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) diff --git a/src/com/garbagemule/MobArena/ArenaListener.java b/src/com/garbagemule/MobArena/ArenaListener.java index c647f86..74112f6 100644 --- a/src/com/garbagemule/MobArena/ArenaListener.java +++ b/src/com/garbagemule/MobArena/ArenaListener.java @@ -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); } } diff --git a/src/com/garbagemule/MobArena/ClassLimitManager.java b/src/com/garbagemule/MobArena/ClassLimitManager.java index aace13b..07873c6 100644 --- a/src/com/garbagemule/MobArena/ClassLimitManager.java +++ b/src/com/garbagemule/MobArena/ClassLimitManager.java @@ -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; diff --git a/src/com/garbagemule/MobArena/framework/Arena.java b/src/com/garbagemule/MobArena/framework/Arena.java index 670fc68..2a73079 100644 --- a/src/com/garbagemule/MobArena/framework/Arena.java +++ b/src/com/garbagemule/MobArena/framework/Arena.java @@ -178,6 +178,8 @@ public interface Arena ////////////////////////////////////////////////////////////////////*/ public void assignClass(Player p, String className); + + public void addRandomPlayer(Player p); public void assignRandomClass(Player p);