From 293027fc2339b4900cb468974bdd686cb6e427a9 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 19 Dec 2020 17:21:21 +0000 Subject: [PATCH] Fixed Annihilate infinite vector --- .../enchantments/ecoenchants/special/Annihilate.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java index 92c5cc18..2a39f884 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java @@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; +import com.willfp.ecoenchants.util.VectorUtils; import org.bukkit.entity.LivingEntity; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.util.Vector; @@ -19,7 +20,9 @@ public class Annihilate extends EcoEnchant { public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) { double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier"); Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier).multiply(-1); + if(!VectorUtils.isFinite(vector)) return; vector.setY(0.2); + if(!VectorUtils.isFinite(vector)) return; victim.setVelocity(vector); } }