Fix for MonsterHurting setting

This commit is contained in:
Fabrizio La Rosa 2020-06-24 18:58:39 +02:00
parent 59fc4f2bd9
commit dffd68e503
2 changed files with 4 additions and 14 deletions

View File

@ -38,15 +38,4 @@ public class BrewingPermission extends ListeningPermission {
if (CompatibleMaterial.getMaterial(block) == CompatibleMaterial.BREWING_STAND)
cancelAndMessage(event, player, plugin, messageManager);
}
@PermissionHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (!(event.getDamager() instanceof Player)) return;
Player player = (Player)event.getDamager();
Entity entity = event.getEntity();
if (!(entity instanceof Monster)) return;
cancelAndMessage(event, player, plugin, messageManager);
}
}

View File

@ -7,6 +7,7 @@ import com.songoda.skyblock.permission.ListeningPermission;
import com.songoda.skyblock.permission.PermissionHandler;
import com.songoda.skyblock.permission.PermissionPriority;
import com.songoda.skyblock.permission.PermissionType;
import org.bukkit.Bukkit;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@ -32,8 +33,8 @@ public class MonsterHurtingPermission extends ListeningPermission {
Entity entity = event.getEntity();
if (entity.getType() == EntityType.ARMOR_STAND || !(entity instanceof Monster)) return;
cancelAndMessage(event, player, plugin, messageManager);
if (entity instanceof Monster){
cancelAndMessage(event, player, plugin, messageManager);
}
}
}