Lock food level for players in the lobby or spectator area.
There is no reason why food should be a thing in the lobby or spectator area. This commit effectively disables it for players in those places/states, while retaining the in-arena conditional logic based on the config-file setting. Fixes #514
This commit is contained in:
@@ -949,15 +949,22 @@ public class ArenaListener
|
||||
}
|
||||
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||
if (!arena.isRunning())
|
||||
if (!(event.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(event.getEntity() instanceof Player) || !arena.inArena((Player) event.getEntity()))
|
||||
return;
|
||||
Player p = (Player) event.getEntity();
|
||||
|
||||
// If the food level is locked, cancel all changes.
|
||||
if (lockFoodLevel)
|
||||
event.setCancelled(true);
|
||||
if (arena.isRunning()) {
|
||||
if (lockFoodLevel) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
// Always locked in lobby/spec
|
||||
if (arena.inLobby(p) || arena.inSpec(p)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerAnimation(PlayerAnimationEvent event) {
|
||||
|
||||
Reference in New Issue
Block a user