mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 06:28:52 +00:00
1.12 fixes
This commit is contained in:
1 parent
717b7acb67
commit
2d064ee849
3 files changed
+17
-8
No files matched your search
@@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This check seems to be broken/outdated
|
* This check seems to be broken/outdated
|
||||||
@@ -27,14 +28,11 @@ public class WaterWalkCheck {
|
|||||||
public static Map<UUID, Integer> waterSpeedViolation = new HashMap<UUID, Integer>();
|
public static Map<UUID, Integer> waterSpeedViolation = new HashMap<UUID, Integer>();
|
||||||
public static Map<UUID, Integer> waterAscensionViolation = new HashMap<UUID, Integer>();
|
public static Map<UUID, Integer> waterAscensionViolation = new HashMap<UUID, Integer>();
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO check & fix for 1.11? (see #25)
|
|
||||||
*/
|
|
||||||
public static CheckResult runCheck(Player player, double x, double y, double z) {
|
public static CheckResult runCheck(Player player, double x, double y, double z) {
|
||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
|
|
||||||
if (player.getVehicle() == null && !player.isFlying()) {
|
if (player.getVehicle() == null && !player.isFlying() && !VersionUtil.isFrostWalk(player)) {
|
||||||
if (block.isLiquid()) {
|
if (block.isLiquid()) {
|
||||||
if (isInWater.contains(uuid)) {
|
if (isInWater.contains(uuid)) {
|
||||||
if (isInWaterCache.contains(uuid)) {
|
if (isInWaterCache.contains(uuid)) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.rammelkast.anticheatreloaded.util;
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
public class NMS_1_9_PLUS {
|
public class NMS_1_9_PLUS {
|
||||||
@@ -15,4 +16,6 @@ public class NMS_1_9_PLUS {
|
|||||||
|
|
||||||
static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION;
|
static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION;
|
||||||
|
|
||||||
|
static final Enchantment FROST_WALKER = Enchantment.FROST_WALKER;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ public class VersionUtil {
|
|||||||
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS);
|
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS);
|
||||||
|
|
||||||
public static boolean isFlying(Player p) {
|
public static boolean isFlying(Player p) {
|
||||||
if (getVersion().equals("v1_9_R1") || getVersion().equals("v1_10_R1") || getVersion().equals("v1_11_R1")) {
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
||||||
return p.isFlying() || p.isGliding() || p.hasPotionEffect(NMS_1_9_PLUS.LEVITATION);
|
return p.isFlying() || p.isGliding() || p.hasPotionEffect(NMS_1_9_PLUS.LEVITATION);
|
||||||
} else {
|
} else {
|
||||||
return p.isFlying();
|
return p.isFlying();
|
||||||
@@ -27,7 +27,7 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumSet<Material> getMoveUpBlocks() {
|
public static EnumSet<Material> getMoveUpBlocks() {
|
||||||
if (getVersion().equals("v1_9_R1") || getVersion().equals("v1_10_R1") || getVersion().equals("v1_11_R1")) {
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
||||||
return NMS_1_9_PLUS.MOVE_UP_BLOCKS_1_9;
|
return NMS_1_9_PLUS.MOVE_UP_BLOCKS_1_9;
|
||||||
} else {
|
} else {
|
||||||
return MOVE_UP_BLOCKS_1_8;
|
return MOVE_UP_BLOCKS_1_8;
|
||||||
@@ -35,7 +35,7 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNewYSpeed() {
|
public static boolean isNewYSpeed() {
|
||||||
if (getVersion().equals("v1_9_R1") || getVersion().equals("v1_10_R1") || getVersion().equals("v1_11_R1")) {
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -43,11 +43,19 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static long getHealTime() {
|
public static long getHealTime() {
|
||||||
if (getVersion().equals("v1_9_R1") || getVersion().equals("v1_10_R1") || getVersion().equals("v1_11_R1")) {
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
||||||
return 495;
|
return 495;
|
||||||
} else {
|
} else {
|
||||||
return 1995;
|
return 1995;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isFrostWalk(Player player) {
|
||||||
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
||||||
|
return player.getInventory().getBoots().containsEnchantment(NMS_1_9_PLUS.FROST_WALKER);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user