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

@ -206,54 +206,52 @@ public class MACommands implements CommandExecutor
* Player spectate * Player spectate
*/ */
if (base.equals("spectate") || base.equals("spec")) if (base.equals("spectate") || base.equals("spec"))
{ {
if (!player || !MobArena.has(p, "mobarena.use.spectate")) if (!player || !MobArena.has(p, "mobarena.use.spectate"))
{ {
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();
if (!am.enabled || arenas.size() < 1)
{
MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_NOT_ENABLED));
return true;
}
boolean error; boolean error;
Arena arena = null; Arena arena;
if (!arg1.isEmpty()) if (!arg1.isEmpty())
{
arena = am.getArenaWithName(arg1); arena = am.getArenaWithName(arg1);
else if (arenas.size() == 1)
if (!am.enabled) arena = arenas.get(0);
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;
}
else else
{ arena = null;
arena = am.arenas.get(0);
if (arenas.size() > 1 && arg1.isEmpty())
if (!am.enabled) error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARG_NEEDED));
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_NOT_ENABLED)); else if (arena == null)
else if (am.arenaMap.containsKey(p)) error = MAUtils.tellPlayer(p, MAMessages.get(Msg.ARENA_DOES_NOT_EXIST));
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_ALREADY_PLAYING)); else if (am.arenaMap.containsKey(p) && am.arenaMap.get(p).livePlayers.contains(p))
else if (am.arenas.size() > 1) error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_IN_OTHER_ARENA));
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARG_NEEDED)); else if (!arena.enabled)
else if (arena == null) error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARENA_NOT_ENABLED));
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.ARENA_DOES_NOT_EXIST)); else if (!arena.setup || arena.edit)
else if (arena.emptyInvSpec && !MAUtils.hasEmptyInventory(p)) error = MAUtils.tellPlayer(p, MAMessages.get(Msg.JOIN_ARENA_NOT_SETUP));
error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_EMPTY_INV)); else if (arena.livePlayers.contains(p))
else error = false; error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_ALREADY_PLAYING));
else if (arena.emptyInvSpec && !MAUtils.hasEmptyInventory(p))
if (error) error = MAUtils.tellPlayer(p, MAMessages.get(Msg.SPEC_EMPTY_INV));
return true; else error = false;
}
// If there was an error, don't join.
if (error)
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;
} }