From 184938b579db94bc47d3433134378f19e60f14a2 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 11 Oct 2021 11:44:35 +0300 Subject: [PATCH] Added time-to-exempt config option for Tornado enchantment and started exempting players that were hit by Tornado from being detectedf by AntiCheats. --- .../ecoenchants/normal/Tornado.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java index 2d3cdd91..c2f83953 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java @@ -27,18 +27,12 @@ public class Tornado extends EcoEnchant { 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(() -> { + this.getPlugin().getScheduler().runLater(() -> { + if (victim instanceof Player player) { + AnticheatManager.exemptPlayer(player); + this.getPlugin().getScheduler().runLater(() -> AnticheatManager.unexemptPlayer(player), this.getConfig().getInt("time-to-exempt")); + } victim.setVelocity(victim.getVelocity().clone().add(toAdd)); - }); - - this.getPlugin().getScheduler().runLater(() -> victim.setVelocity(victim.getVelocity().clone().add(toAdd)), 1); + }, 1); } -} \ No newline at end of file +}