mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Fixes regarding 1.9+ support
This commit is contained in:
1 parent
06c1eab2e6
commit
7ae3f010a3
10 files changed
+43
-17
No files matched your search
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
||||
<artifactId>AntiCheatReloaded</artifactId>
|
||||
<version>1.6.3-ALPHA</version>
|
||||
<version>1.6.4-ALPHA</version>
|
||||
<name>AntiCheatReloaded</name>
|
||||
<url>https://rammelkast.com</url>
|
||||
<properties>
|
||||
|
||||
@@ -70,17 +70,17 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
eventList.add(new InventoryListener());
|
||||
// Order is important in some cases, don't screw with these unless
|
||||
// needed, especially config
|
||||
setupConfig();
|
||||
setupEvents();
|
||||
setupCommands();
|
||||
this.setupConfig();
|
||||
this.setupEvents();
|
||||
this.setupCommands();
|
||||
// Enterprise must come before levels
|
||||
setupEnterprise();
|
||||
restoreLevels();
|
||||
this.setupEnterprise();
|
||||
this.restoreLevels();
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||
setupProtocol();
|
||||
this.setupProtocol();
|
||||
} else {
|
||||
getLogger().severe("Shutting down, ProtocolLib not found!");
|
||||
Bukkit.getConsoleSender().sendMessage("[ACR] " + ChatColor.RED + "Shutting down, ProtocolLib not found!");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ public class Backend {
|
||||
public CheckResult checkSwing(Player player, Block block) {
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (!isInstantBreakExempt(player)) {
|
||||
if (!player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !(player.getInventory().getItemInHand().getType() == Material.SHEARS && block.getType() == Material.LEAVES)) {
|
||||
if (!VersionUtil.getItemInHand(player).containsEnchantment(Enchantment.DIG_SPEED) && !(VersionUtil.getItemInHand(player).getType() == Material.SHEARS && block.getType() == Material.LEAVES)) {
|
||||
if (blockPunches.get(uuid) != null && player.getGameMode() != GameMode.CREATIVE) {
|
||||
int i = blockPunches.get(uuid);
|
||||
if (i < magic.BLOCK_PUNCH_MIN()) {
|
||||
@@ -447,7 +447,7 @@ public class Backend {
|
||||
|
||||
public CheckResult checkFastBreak(Player player, Block block) {
|
||||
int violations = magic.FASTBREAK_MAXVIOLATIONS();
|
||||
long timemax = isInstantBreakExempt(player) ? 0 : Utilities.calcSurvivalFastBreak(player.getInventory().getItemInHand(), block.getType());
|
||||
long timemax = isInstantBreakExempt(player) ? 0 : Utilities.calcSurvivalFastBreak(VersionUtil.getItemInHand(player), block.getType());
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
violations = magic.FASTBREAK_MAXVIOLATIONS_CREATIVE();
|
||||
timemax = magic.FASTBREAK_TIMEMAX_CREATIVE();
|
||||
@@ -634,8 +634,8 @@ public class Backend {
|
||||
}
|
||||
|
||||
public CheckResult checkAutoTool(Player player) {
|
||||
if (itemInHand.containsKey(player.getUniqueId()) && itemInHand.get(player.getUniqueId()) != player.getItemInHand().getType()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " switched tools too fast (had " + itemInHand.get(player.getName()) + ", has " + player.getItemInHand().getType() + ")");
|
||||
if (itemInHand.containsKey(player.getUniqueId()) && itemInHand.get(player.getUniqueId()) != VersionUtil.getItemInHand(player).getType()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " switched tools too fast (had " + itemInHand.get(player.getUniqueId()) + ", has " + VersionUtil.getItemInHand(player).getType() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ public class GlideCheck {
|
||||
violations.put(player.getUniqueId(), violations.get(player.getUniqueId()) + 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO more sophisticated check
|
||||
}
|
||||
lastDiff.put(player.getUniqueId(), distance.getYDifference());
|
||||
lastFallDistance.put(player.getUniqueId(), player.getFallDistance());
|
||||
|
||||
@@ -29,7 +29,6 @@ public class Config extends ConfigurationFile {
|
||||
public static final String FILENAME = "config.yml";
|
||||
|
||||
public ConfigValue<Boolean> logToConsole;
|
||||
public ConfigValue<Boolean> autoUpdate;
|
||||
public ConfigValue<Boolean> verboseStartup;
|
||||
public ConfigValue<Boolean> silentMode;
|
||||
public ConfigValue<Boolean> exemptOp;
|
||||
@@ -59,7 +58,6 @@ public class Config extends ConfigurationFile {
|
||||
public void open() {
|
||||
logToConsole = new ConfigValue<Boolean>("system.log-to-console");
|
||||
|
||||
autoUpdate = new ConfigValue<Boolean>("system.auto-update");
|
||||
verboseStartup = new ConfigValue<Boolean>("system.verbose-startup");
|
||||
silentMode = new ConfigValue<Boolean>("system.silent-mode");
|
||||
exemptOp = new ConfigValue<Boolean>("system.exempt-op");
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.util.EnumSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class NMS_1_9_PLUS {
|
||||
@@ -17,5 +19,9 @@ public class NMS_1_9_PLUS {
|
||||
static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION;
|
||||
|
||||
static final Enchantment FROST_WALKER = Enchantment.FROST_WALKER;
|
||||
|
||||
public static ItemStack getItemInHand(Player player) {
|
||||
return player.getInventory().getItemInMainHand();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class VersionUtil {
|
||||
|
||||
@@ -79,5 +80,13 @@ public class VersionUtil {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getItemInHand(Player player) {
|
||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
||||
return NMS_1_9_PLUS.getItemInHand(player);
|
||||
} else {
|
||||
return player.getItemInHand();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,8 +15,6 @@ spam:
|
||||
action-one: KICK
|
||||
action-two: BAN
|
||||
system:
|
||||
# Turning auto-update off is a _BAD_ idea. You will no longer be protected by the latest hacks/cheats if you do so, and will have to update manually.
|
||||
auto-update: true
|
||||
# Should AntiCheatReloaded log ALL failed checks to console?
|
||||
log-to-console: false
|
||||
# Should AntiCheatReloaded log to file?
|
||||
|
||||
@@ -17,7 +17,7 @@ database:
|
||||
# Password for the user
|
||||
password: ''
|
||||
# Prefix for the tables
|
||||
prefix: 'ac_'
|
||||
prefix: 'acr_'
|
||||
# Database/Schema to use
|
||||
database: 'anticheat'
|
||||
# Logging settings
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
# AntiCheatReloaded configuration file
|
||||
#
|
||||
# This file is not yet fully documented
|
||||
# For more information on the undocumented values visit:
|
||||
# https://github.com/Rammelkast/AntiCheatReloaded/blob/master/src/main/java/com/rammelkast/anticheatreloaded/config/providers/Magic.java#L39-L380
|
||||
#
|
||||
ANIMATION_INTERACT_MAX: 3
|
||||
ANIMATION_MIN: 200
|
||||
ASCENSION_COUNT_MAX: 8
|
||||
@@ -82,7 +87,15 @@ Y_MAXVIOLATIONS: 1
|
||||
Y_MAXVIOTIME: 5500
|
||||
Y_SPEED_MAX: 0.5125
|
||||
Y_TIME: 800
|
||||
# Amount of suspicious mid-air movements before a player is suspected of glide
|
||||
# Increase this in case of false positives
|
||||
GLIDE_LIMIT: 10
|
||||
# Amount of hits to a bot before a player is suspected
|
||||
# Increase this in case of false positives
|
||||
KILLAURA_BOTHITS: 4
|
||||
# Maximum amount of movement packets allowed per second
|
||||
# Increase this in case of false positives
|
||||
BLINK_PACKET: 74
|
||||
# Maximum amount of suspected "fake-criticalhits" before a player is suspected
|
||||
# Increase this in case of false positives
|
||||
VELOCITY_AMT: 5
|
||||
Reference in new issue
Block a user