1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Did the requested changes.

This commit is contained in:
LinoxGH 2020-08-30 18:13:45 +03:00 committed by GitHub
parent e0914af6d9
commit cdb6eeab96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,7 +42,7 @@ public class CoolerListener implements Listener {
@EventHandler
public void onHungerLoss(FoodLevelChangeEvent e) {
if (cooler == null || cooler.isDisabled()) {
if (cooler == null || cooler.isDisabled() || !(e.getEntity() instanceof Player)) {
return;
}
@ -55,11 +55,11 @@ public class CoolerListener implements Listener {
@EventHandler
public void onHungerDamage(EntityDamageEvent e) {
if (cooler == null || cooler.isDisabled()) {
if (cooler == null || cooler.isDisabled() || !(e.getEntity() instanceof Player)) {
return;
}
if (e.getCause() == EntityDamageEvent.DamageCause.STARVATION) {
if (e.getCause() == DamageCause.STARVATION) {
checkAndConsume((Player) e.getEntity());
}
}