From bfec9a26e6a7987123d89628b05e082fa2f90363 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 26 Sep 2021 17:39:39 +0100 Subject: [PATCH] Fixed buckshot --- .../enchantments/ecoenchants/normal/Buckshot.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java index e28adf86..47dfc8bd 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java @@ -33,17 +33,13 @@ public class Buckshot extends EcoEnchant { ((Player) shooter).playSound(shooter.getLocation(), Sound.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0f, 1.0f); } - int numberPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level"); - int number = numberPerLevel * level; - double spread = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "spread-per-level"); - if (level < this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "maximum-level")) { - spread *= level; - } else { - spread *= this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "maximum-level"); - } + int number = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level"); + number *= level; + + double spread = Math.abs(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "spread-per-level")); + spread *= level; for (int i = 0; i < number; i += 1) { - Vector velocity = event.getProjectile().getVelocity().clone(); velocity.add(new Vector(NumberUtils.randFloat(-spread, spread), NumberUtils.randFloat(-spread, spread), NumberUtils.randFloat(-spread, spread)));