mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-26 15:45:12 +01:00
Fixed Anticheat compatibility with Charge and Spring
This commit is contained in:
parent
fc8041cb72
commit
7f467a92b4
@ -1,5 +1,6 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
||||
|
||||
import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -28,7 +29,11 @@ public class Spring extends EcoEnchant {
|
||||
public void onJump(@NotNull final Player player,
|
||||
final int level,
|
||||
@NotNull final PlayerMoveEvent event) {
|
||||
AnticheatManager.exemptPlayer(player);
|
||||
|
||||
double multiplier = 0.5 + ((double) (level * level) / 4 - 0.2) / 3;
|
||||
player.setVelocity(player.getLocation().getDirection().multiply(multiplier).setY(multiplier));
|
||||
|
||||
this.getPlugin().getScheduler().runLater(() -> AnticheatManager.unexemptPlayer(player), 10);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
|
||||
|
||||
import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -16,12 +17,16 @@ public class Charge extends Spell {
|
||||
public boolean onUse(@NotNull final Player player,
|
||||
final int level,
|
||||
@NotNull final PlayerInteractEvent event) {
|
||||
AnticheatManager.exemptPlayer(player);
|
||||
|
||||
Vector velocity = player.getEyeLocation().getDirection().clone();
|
||||
velocity.normalize();
|
||||
velocity.multiply(level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-per-level"));
|
||||
velocity.setY(player.getEyeLocation().getDirection().clone().getY() + 0.2);
|
||||
player.setVelocity(velocity);
|
||||
|
||||
this.getPlugin().getScheduler().runLater(() -> AnticheatManager.unexemptPlayer(player), 10);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user