mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +00:00
Fix #83, fix BadPackets false positive added packet sneak check.
This commit is contained in:
1 parent
7d13aae057
commit
c6e4ce091a
4 files changed
+33
-6
No files matched your search
@@ -35,6 +35,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
||||
@@ -49,6 +51,7 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||
import com.rammelkast.anticheatreloaded.manage.UserManager;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
@@ -87,6 +90,7 @@ public class Backend {
|
||||
private HashSet<Byte> transparent = new HashSet<Byte>();
|
||||
private Map<UUID, Long> lastFallPacket = new HashMap<UUID, Long>();
|
||||
private Map<UUID, Integer> fastSneakViolations = new HashMap<UUID, Integer>();
|
||||
private Map<UUID, Long> lastSneak = new HashMap<UUID, Long>();
|
||||
|
||||
private Magic magic;
|
||||
private AntiCheatManager manager = null;
|
||||
@@ -325,6 +329,21 @@ public class Backend {
|
||||
}
|
||||
}
|
||||
|
||||
public CheckResult checkSneakToggle(Player player) {
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||
final long lastSneak = this.lastSneak.getOrDefault(player.getUniqueId(), (long) 0);
|
||||
this.lastSneak.put(player.getUniqueId(), System.currentTimeMillis());
|
||||
if (System.currentTimeMillis() - lastSneak < 75 && (AntiCheatReloaded.getPlugin().getTPS() > 12
|
||||
&& !user.isLagging())) {
|
||||
if (!this.silentMode()) {
|
||||
player.teleport(user.getGoodLocation(player.getLocation()));
|
||||
}
|
||||
return new CheckResult(Result.FAILED,
|
||||
"toggled sneak too fast (time=" + (System.currentTimeMillis() - lastSneak) + ")");
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
public CheckResult checkSprintHungry(PlayerToggleSprintEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (event.isSprinting() && player.getGameMode() != GameMode.CREATIVE
|
||||
|
||||
Reference in new issue
Block a user