Changed firewand to small fireball

This commit is contained in:
Auxilor 2020-11-21 12:00:08 +00:00
parent 67998241a8
commit 9d74ab702c

View File

@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.Player;
import org.bukkit.entity.SmallFireball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@ -19,7 +20,7 @@ public class Firewand extends Spell {
@Override
public void onUse(Player player, int level, PlayerInteractEvent event) {
Fireball fireball = player.launchProjectile(Fireball.class, player.getEyeLocation().getDirection().multiply(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity")));
SmallFireball fireball = player.launchProjectile(SmallFireball.class, player.getEyeLocation().getDirection().multiply(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity")));
fireball.setIsIncendiary(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "fire"));
fireball.setMetadata("eco-damage", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level));
if(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "no-explode")) {
@ -30,7 +31,7 @@ public class Firewand extends Spell {
@EventHandler(priority = EventPriority.LOW)
public void onFireballDamage(EntityDamageByEntityEvent event) {
if(!(event.getDamager() instanceof Fireball)) return;
if(!(event.getDamager() instanceof SmallFireball)) return;
if(event.getDamager().getMetadata("eco-damage").isEmpty()) return;
double multiplier = event.getDamager().getMetadata("eco-damage").get(0).asDouble();
@ -40,7 +41,7 @@ public class Firewand extends Spell {
@EventHandler
public void onFireballExplode(EntityExplodeEvent event) {
if(!(event.getEntity() instanceof Fireball)) return;
if(!(event.getEntity() instanceof SmallFireball)) return;
if(event.getEntity().getMetadata("nobreak").isEmpty()) return;
event.setCancelled(true);