Dropping items as a spectator outside of the region forces the player to leave. Thanks to ACStache.

This commit is contained in:
garbagemule
2012-03-30 03:11:29 +02:00
parent be1adba3b8
commit f2fefdb62d
3 changed files with 17 additions and 5 deletions
BIN
View File
Binary file not shown.
@@ -620,8 +620,7 @@ public class ArenaListener
public void onPlayerDropItem(PlayerDropItemEvent event) { public void onPlayerDropItem(PlayerDropItemEvent event) {
Player p = event.getPlayer(); Player p = event.getPlayer();
// If the player is active in the arena, only cancel if sharing is not // If the player is active in the arena, only cancel if sharing is not allowed
// allowed
if (arena.inArena(p)) { if (arena.inArena(p)) {
if (!canShare) { if (!canShare) {
Messenger.tellPlayer(p, Msg.LOBBY_DROP_ITEM); Messenger.tellPlayer(p, Msg.LOBBY_DROP_ITEM);
@@ -629,12 +628,24 @@ public class ArenaListener
} }
} }
// Else, if the player is in the lobby or a spectator, just cancel // If the player is in the lobby, just cancel
else if (arena.inLobby(p) || arena.inSpec(p)) { else if (arena.inLobby(p)) {
Messenger.tellPlayer(p, Msg.LOBBY_DROP_ITEM); Messenger.tellPlayer(p, Msg.LOBBY_DROP_ITEM);
event.setCancelled(true); event.setCancelled(true);
} }
// Same if it's a spectator, but...
else if (arena.inSpec(p)) {
Messenger.tellPlayer(p, Msg.LOBBY_DROP_ITEM);
event.setCancelled(true);
// If the spectator isn't in the region, force them to leave
if (!region.contains(p.getLocation())) {
Messenger.tellPlayer(p, Msg.MISC_MA_LEAVE_REMINDER);
arena.playerLeave(p);
}
}
/* /*
* If the player is not in the arena in any way (as arena player, lobby * If the player is not in the arena in any way (as arena player, lobby
* player or a spectator), but they -are- in the region, it must mean * player or a spectator), but they -are- in the region, it must mean
+1
View File
@@ -67,6 +67,7 @@ public enum Msg
MISC_HELP("For a list of commands, type /ma help"), MISC_HELP("For a list of commands, type /ma help"),
MISC_MULTIPLE_MATCHES("Did you mean one of these commands?"), MISC_MULTIPLE_MATCHES("Did you mean one of these commands?"),
MISC_NO_MATCHES("Command not found. Type /ma help"), MISC_NO_MATCHES("Command not found. Type /ma help"),
MISC_MA_LEAVE_REMINDER("Remember to use /ma leave when you are done."),
MISC_NONE("<none>"); MISC_NONE("<none>");
private String msg, spoutMsg; private String msg, spoutMsg;