Added time-to-exempt config option for Tornado enchantment and started exempting players that were hit by Tornado from being detectedf by AntiCheats.

This commit is contained in:
_OfTeN_ 2021-10-11 11:44:35 +03:00
parent 7645e71a6b
commit 445ad5bb18
2 changed files with 2 additions and 15 deletions

View File

@ -1,11 +1,9 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.normal; 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.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -27,18 +25,6 @@ public class Tornado extends EcoEnchant {
Vector toAdd = new Vector(0, yVelocity, 0); Vector toAdd = new Vector(0, yVelocity, 0);
if (victim instanceof Player pVictim) {
AnticheatManager.exemptPlayer(pVictim);
this.getPlugin().getScheduler().runLater(() -> {
AnticheatManager.unexemptPlayer(pVictim);
}, 40);
}
this.getPlugin().getScheduler().run(() -> {
victim.setVelocity(victim.getVelocity().clone().add(toAdd));
});
this.getPlugin().getScheduler().runLater(() -> victim.setVelocity(victim.getVelocity().clone().add(toAdd)), 1); this.getPlugin().getScheduler().runLater(() -> victim.setVelocity(victim.getVelocity().clone().add(toAdd)), 1);
} }
} }

View File

@ -30,3 +30,4 @@ general-config:
config: config:
velocity-per-level: 0.25 velocity-per-level: 0.25
time-to-exempt: 60 #In ticks. Time to exempt hit player from being detected by your Anti-Cheat for flying (The higher max velocity is - the higher should be this value)