mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-23 11:06:14 +01:00
Dropping items as a spectator outside of the region forces the player to leave. Thanks to ACStache.
This commit is contained in:
parent
be1adba3b8
commit
f2fefdb62d
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user