mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-22 15:05:18 +01:00
Fixed missile breaking blocks
This commit is contained in:
parent
1e1af832e4
commit
2fbef163c2
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user