mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-22 15:05:18 +01:00
Fixed rapid fastbow anticheat trigger
This commit is contained in:
parent
a4baefb092
commit
59b098b7e8
@ -1,10 +1,12 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -20,6 +22,9 @@ public class Rapid extends EcoEnchant {
|
||||
@NotNull final Arrow arrow,
|
||||
final int level,
|
||||
@NotNull final EntityShootBowEvent event) {
|
||||
if (shooter instanceof Player player) {
|
||||
AnticheatManager.exemptPlayer(player);
|
||||
}
|
||||
double multiplier = 1 - ((this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-faster-per-level") / 100) * level);
|
||||
|
||||
if (event.getForce() < multiplier) {
|
||||
@ -28,5 +33,9 @@ public class Rapid extends EcoEnchant {
|
||||
|
||||
double force = 1 / event.getForce();
|
||||
event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(force));
|
||||
|
||||
if (shooter instanceof Player player) {
|
||||
AnticheatManager.unexemptPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user