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

Binary file not shown.

View File

@ -620,20 +620,31 @@ public class ArenaListener
public void onPlayerDropItem(PlayerDropItemEvent event) {
Player p = event.getPlayer();
// If the player is active in the arena, only cancel if sharing is not
// allowed
// If the player is active in the arena, only cancel if sharing is not allowed
if (arena.inArena(p)) {
if (!canShare) {
Messenger.tellPlayer(p, Msg.LOBBY_DROP_ITEM);
event.setCancelled(true);
}
}
// Else, if the player is in the lobby or a spectator, just cancel
else if (arena.inLobby(p) || arena.inSpec(p)) {
// If the player is in the lobby, just cancel
else if (arena.inLobby(p)) {
Messenger.tellPlayer(p, Msg.LOBBY_DROP_ITEM);
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

View File

@ -67,6 +67,7 @@ public enum Msg
MISC_HELP("For a list of commands, type /ma help"),
MISC_MULTIPLE_MATCHES("Did you mean one of these commands?"),
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>");
private String msg, spoutMsg;