Launch check

This commit is contained in:
LoJoSho
2022-07-16 21:03:49 -05:00
parent 6981c78f90
commit 51dd9d9cf4

View File

@@ -4,6 +4,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import com.willfp.ecoenchants.enchantments.util.VelocityChecks;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -55,6 +56,10 @@ public class Launch extends EcoEnchant {
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
double boost = 1 + (multiplier * level);
if (VelocityChecks.isUnsafeVelocity(player.getVelocity().multiply(boost))) {
return;
}
this.getPlugin().getScheduler().run(() -> player.setVelocity(player.getVelocity().multiply(boost)));
}
}