mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-23 19:16:41 +01:00
v0.94.4.71 redo - not allow joining other arenas from in lobby or arena, spectator is fine
This commit is contained in:
parent
795edcb9ff
commit
7e48ec7410
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user