Fix nohunger under 1.9

Closes #829
This commit is contained in:
Connor Monahan 2016-06-08 17:59:45 -04:00
parent aa41a11daf
commit f6175451ee

View File

@ -3,6 +3,7 @@ package com.tommytony.war.event;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.text.MessageFormat;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -377,10 +378,7 @@ public class WarEntityListener implements Listener {
*/
@EventHandler
public void onEntityRegainHealth(final EntityRegainHealthEvent event) {
if (!War.war.isLoaded() ||
(event.getRegainReason() != RegainReason.REGEN
&& event.getRegainReason() != RegainReason.EATING
&& event.getRegainReason() != RegainReason.SATIATED)) {
if (!War.war.isLoaded()) {
return;
}
@ -393,8 +391,7 @@ public class WarEntityListener implements Listener {
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
if (zone != null) {
Team team = Team.getTeamByPlayerName(player.getName());
if ((event.getRegainReason() == RegainReason.EATING
|| event.getRegainReason() != RegainReason.SATIATED )
if (event.getRegainReason() == RegainReason.SATIATED
&& team.getTeamConfig().resolveBoolean(TeamConfig.NOHUNGER)) {
// noHunger setting means you can't auto-heal with full hunger bar (use saturation instead to control how fast you get hungry)
event.setCancelled(true);