mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 14:38:45 +00:00
Fix riptide false positives, improved performance
This commit is contained in:
1 parent
bd1db83a98
commit
7e1f0d83ce
7 files changed
+29
-76
No files matched your search
@@ -93,6 +93,8 @@ public class MovementManager {
|
||||
public boolean hasIncreasingEffect = false;
|
||||
// If the player had a speed increasing effect previous tick
|
||||
public boolean hadIncreasingEffect = false;
|
||||
// Riptiding ticks
|
||||
public int riptideTicks;
|
||||
// Time of last update
|
||||
public long lastUpdate;
|
||||
|
||||
@@ -182,6 +184,17 @@ public class MovementManager {
|
||||
this.nearLiquidTicks = 0;
|
||||
}
|
||||
|
||||
if (VersionUtil.CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||
if (player.isRiptiding()) {
|
||||
this.riptideTicks = 30;
|
||||
} else {
|
||||
if (this.riptideTicks > 0)
|
||||
this.riptideTicks--;
|
||||
else
|
||||
this.riptideTicks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.hadSpeedEffect = this.hasSpeedEffect;
|
||||
this.hasSpeedEffect = player.hasPotionEffect(PotionEffectType.SPEED);
|
||||
|
||||
|
||||
@@ -20,15 +20,12 @@
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
@@ -41,7 +38,6 @@ public class User {
|
||||
private final int id;
|
||||
private int level = 0;
|
||||
private Location goodLocation;
|
||||
private List<ItemStack> inventorySnapshot = null;
|
||||
private Configuration config = AntiCheatReloaded.getManager().getConfiguration();
|
||||
private int toX, toY, toZ;
|
||||
private String[] messages = new String[2];
|
||||
@@ -245,44 +241,7 @@ public class User {
|
||||
goodLocation = location;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a copy of the player's inventory, for use in resetting
|
||||
*
|
||||
* @param is ItemStack list to store
|
||||
*/
|
||||
public void setInventorySnapshot(ItemStack[] is) {
|
||||
inventorySnapshot = new ArrayList<ItemStack>();
|
||||
for (int i = 0; i < is.length; i++) {
|
||||
if (is[i] != null) {
|
||||
inventorySnapshot.add(is[i].clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the current inventory snapshot
|
||||
*/
|
||||
public void removeInventorySnapshot() {
|
||||
inventorySnapshot = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the player's inventory with the current inventory snapshot
|
||||
*
|
||||
* @param inventory Player's inventory
|
||||
*/
|
||||
public void restoreInventory(Inventory inventory) {
|
||||
if (inventorySnapshot != null) {
|
||||
inventory.clear();
|
||||
for (ItemStack is : inventorySnapshot) {
|
||||
if (is != null) {
|
||||
inventory.addItem(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the player's to location
|
||||
*
|
||||
|
||||
@@ -35,8 +35,8 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
public class VersionUtil {
|
||||
|
||||
public static final MinecraftVersion CURRENT_VERSION;
|
||||
private static final List<String> SUPPORTED_VERSIONS;
|
||||
private static final MinecraftVersion CURRENT_VERSION;
|
||||
|
||||
public static String getVersion() {
|
||||
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||
@@ -73,13 +73,6 @@ public class VersionUtil {
|
||||
|| AntiCheatReloaded.getManager().getBackend().justLevitated(player);
|
||||
}
|
||||
|
||||
public static boolean isRiptiding(Player player) {
|
||||
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||
return false;
|
||||
}
|
||||
return player.isRiptiding();
|
||||
}
|
||||
|
||||
public static boolean isSlowFalling(Player player) {
|
||||
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user