v0.92.2 Bugfixes and a couple of extras.

This commit is contained in:
Garbage Mule 2011-07-08 19:22:35 +02:00
parent d8aec7ef99
commit 8c157af7bc
3 changed files with 35 additions and 37 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: MobArena name: MobArena
main: com.garbagemule.MobArena.MobArena main: com.garbagemule.MobArena.MobArena
version: 0.92.1 version: 0.92.2
softdepend: [MultiVerse,XcraftGate] softdepend: [MultiVerse,XcraftGate]
commands: commands:
ma: ma:

View File

@ -212,48 +212,46 @@ public class MACommands implements CommandExecutor
MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_NO_ACCESS)); MAUtils.tellPlayer(sender, MAMessages.get(Msg.MISC_NO_ACCESS));
return true; return true;
} }
List<Arena> arenas = am.getEnabledArenas();
boolean error; if (!am.enabled || arenas.size() < 1)
Arena arena = null;
if (!arg1.isEmpty())
{ {
arena = am.getArenaWithName(arg1); MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_NOT_ENABLED));
if (!am.enabled)
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_NOT_ENABLED));
else if (am.arenaMap.containsKey(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_ALREADY_PLAYING));
else if (arena == null)
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.ARENA_DOES_NOT_EXIST));
else if (arena.emptyInvSpec && !MAUtils.hasEmptyInventory(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_EMPTY_INV));
else error = false;
if (error)
return true; return true;
} }
else
{
arena = am.arenas.get(0);
if (!am.enabled) boolean error;
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_NOT_ENABLED)); Arena arena;
else if (am.arenaMap.containsKey(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_ALREADY_PLAYING)); if (!arg1.isEmpty())
else if (am.arenas.size() > 1) arena = am.getArenaWithName(arg1);
else if (arenas.size() == 1)
arena = arenas.get(0);
else
arena = null;
if (arenas.size() > 1 && arg1.isEmpty())
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARG_NEEDED)); error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARG_NEEDED));
else if (arena == null) else if (arena == null)
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.ARENA_DOES_NOT_EXIST)); error = MAUtils.tellPlayer(p, MAMessages.get(Msg.ARENA_DOES_NOT_EXIST));
else if (am.arenaMap.containsKey(p) && am.arenaMap.get(p).livePlayers.contains(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_IN_OTHER_ARENA));
else if (!arena.enabled)
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARENA_NOT_ENABLED));
else if (!arena.setup || arena.edit)
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARENA_NOT_SETUP));
else if (arena.livePlayers.contains(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_ALREADY_PLAYING));
else if (arena.emptyInvSpec && !MAUtils.hasEmptyInventory(p)) else if (arena.emptyInvSpec && !MAUtils.hasEmptyInventory(p))
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_EMPTY_INV)); error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_EMPTY_INV));
else error = false; else error = false;
// If there was an error, don't join.
if (error) if (error)
return true; return true;
}
am.arenaMap.put(p,arena);
arena.playerSpec(p, p.getLocation()); arena.playerSpec(p, p.getLocation());
MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_PLAYER_SPECTATE)); MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_PLAYER_SPECTATE));
return true; return true;
} }