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 b713c60957
commit 184938b579

View File

@ -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);
}
}
}