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:
@@ -11,6 +11,7 @@ These changes will (most likely) be included in the next version.
|
|||||||
|
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
- Food levels no longer deplete for players in the lobby and spectator area.
|
||||||
|
|
||||||
## [0.103.2] - 2019-04-23
|
## [0.103.2] - 2019-04-23
|
||||||
- MobArena no longer touches the `flySpeed` player attribute when players join an arena. This should fix issues where a crash would result in players being "locked in the air" when trying to fly outside of the arena. It also introduces compatibility with plugins that use flight to augment player abilities.
|
- MobArena no longer touches the `flySpeed` player attribute when players join an arena. This should fix issues where a crash would result in players being "locked in the air" when trying to fly outside of the arena. It also introduces compatibility with plugins that use flight to augment player abilities.
|
||||||
|
|||||||
@@ -949,15 +949,22 @@ public class ArenaListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||||
if (!arena.isRunning())
|
if (!(event.getEntity() instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(event.getEntity() instanceof Player) || !arena.inArena((Player) event.getEntity()))
|
Player p = (Player) event.getEntity();
|
||||||
return;
|
|
||||||
|
|
||||||
// If the food level is locked, cancel all changes.
|
if (arena.isRunning()) {
|
||||||
if (lockFoodLevel)
|
if (lockFoodLevel) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Always locked in lobby/spec
|
||||||
|
if (arena.inLobby(p) || arena.inSpec(p)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerAnimation(PlayerAnimationEvent event) {
|
public void onPlayerAnimation(PlayerAnimationEvent event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user