From 184938b579db94bc47d3433134378f19e60f14a2 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 11 Oct 2021 11:44:35 +0300 Subject: [PATCH 1/3] 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 +} From e55ba7d6c1ee6d6cf1fdfbfc32fdd6fb880727cf Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 18 Oct 2021 19:57:51 +0300 Subject: [PATCH 2/3] Fixed grindstone dupe bug --- .../support/merging/grindstone/GrindstoneListeners.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneListeners.java index 30bf41f5..cc3ef010 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneListeners.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneListeners.java @@ -6,7 +6,6 @@ import com.willfp.eco.util.NumberUtils; import com.willfp.ecoenchants.enchantments.EcoEnchant; import org.bukkit.Location; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.Player; @@ -16,12 +15,9 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.GrindstoneInventory; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; import org.jetbrains.annotations.NotNull; import java.util.HashSet; -import java.util.Map; import java.util.Set; public class GrindstoneListeners extends PluginDependent implements Listener { @@ -60,7 +56,8 @@ public class GrindstoneListeners extends PluginDependent implements L return; } - this.getPlugin().getScheduler().runLater(() -> { + this.getPlugin().getScheduler().runLater(() -> { + if (inventory.getItem(2) != null || event.isCancelled()) return; Set enchants = new HashSet<>(); if (top != null) { enchants.addAll(top.getEnchantments().keySet()); @@ -80,4 +77,5 @@ public class GrindstoneListeners extends PluginDependent implements L } }, 1); } + } From 717c2a87baf93eaa80c06552ab63b1c8ebc047c6 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 18 Oct 2021 20:01:43 +0300 Subject: [PATCH 3/3] Fixed grindstone dupe bug --- .../ecoenchants/normal/Tornado.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 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 c2f83953..2d3cdd91 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,12 +27,18 @@ public class Tornado extends EcoEnchant { Vector toAdd = new Vector(0, yVelocity, 0); - 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")); - } + 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)); - }, 1); + }); + + this.getPlugin().getScheduler().runLater(() -> victim.setVelocity(victim.getVelocity().clone().add(toAdd)), 1); } -} +} \ No newline at end of file