From 7e48ec74104566550644dbc7c8835b10eb92aab4 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 6 Jun 2012 20:37:20 -0400 Subject: [PATCH] v0.94.4.71 redo - not allow joining other arenas from in lobby or arena, spectator is fine --- .../MobArena/commands/user/JoinCommand.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/com/garbagemule/MobArena/commands/user/JoinCommand.java b/src/com/garbagemule/MobArena/commands/user/JoinCommand.java index 1ecdc8b..ef55c45 100644 --- a/src/com/garbagemule/MobArena/commands/user/JoinCommand.java +++ b/src/com/garbagemule/MobArena/commands/user/JoinCommand.java @@ -29,23 +29,24 @@ public class JoinCommand implements Command String arg1 = (args.length > 0 ? args[0] : null); // Run some rough sanity checks, and grab the arena to join. - Arena arena = Commands.getArenaToJoinOrSpec(am, p, arg1); - if (arena == null) { + Arena toArena = Commands.getArenaToJoinOrSpec(am, p, arg1); + Arena fromArena = am.getArenaWithPlayer(p); + if (toArena == null) { return false; } // Deny joining from other arenas - if (am.getArenaWithPlayer(p).inArena(p)) { + if (fromArena != null && (fromArena.inArena(p) || fromArena.inLobby(p))) { Messenger.tellPlayer(p, Msg.JOIN_ALREADY_PLAYING); return false; } // Per-arena sanity checks - if (!arena.canJoin(p)) { + if (!toArena.canJoin(p)) { return false; } // Join the arena! - return arena.playerJoin(p, p.getLocation()); + return toArena.playerJoin(p, p.getLocation()); } }