diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Missile.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Missile.java index 5bf9aca7..ec042cce 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Missile.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Missile.java @@ -8,6 +8,7 @@ import org.bukkit.entity.WitherSkull; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.metadata.FixedMetadataValue; @@ -22,6 +23,7 @@ public class Missile extends Spell { skull.setCharged(true); skull.setIsIncendiary(false); skull.setMetadata("eco-damage", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level)); + skull.setMetadata("nobreak", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(),true)); skull.setShooter(player); } @@ -34,4 +36,12 @@ public class Missile extends Spell { event.setDamage(multiplier); } + + @EventHandler + public void onWitherSkullExplode(EntityExplodeEvent event) { + if(!(event.getEntity() instanceof WitherSkull)) return; + if(event.getEntity().getMetadata("nobreak").isEmpty()) return; + + event.setCancelled(true); + } }