diff --git a/pom.xml b/pom.xml index 11fc756..6fe5357 100644 --- a/pom.xml +++ b/pom.xml @@ -37,6 +37,26 @@ 1.6 + + org.apache.maven.plugins + maven-shade-plugin + 1.3 + + + package + + shade + + + + + + + net.gravitydevelopment.* + + + + AntiCheat @@ -90,6 +110,7 @@ net.gravitydevelopment.updater updater 2.1 + compile diff --git a/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java b/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java index d377df9..4c9140b 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java +++ b/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java @@ -154,7 +154,7 @@ public class AntiCheat extends JavaPlugin { public void run() { verboseLog("Checking for a new update..."); Updater updater = new Updater(plugin, PROJECT_ID, file, Updater.UpdateType.DEFAULT, false); - update = updater.getResult() != Updater.UpdateResult.NO_UPDATE; + update = updater.getResult() == Updater.UpdateResult.SUCCESS; verboseLog("Update available: " + update); } }); diff --git a/src/main/java/net/gravitydevelopment/anticheat/config/files/Magic.java b/src/main/java/net/gravitydevelopment/anticheat/config/files/Magic.java index 9ae41f4..1a2d332 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/config/files/Magic.java +++ b/src/main/java/net/gravitydevelopment/anticheat/config/files/Magic.java @@ -311,6 +311,10 @@ public class Magic extends ConfigurationFile { * Maximum speed a player can travel forwards or backwards while under the influence; Type=double, +Leniency=Increase. */ public double XZ_SPEED_MAX_POTION; + /** + * Maximum speed a player can travel forwards or backwards while sprinting while under the influence; Type=double, +Leniency=Increase. + */ + public double XZ_SPEED_MAX_POTION_SPRINT; /** * Maximum speed a player can travel forwards or backwards while sneaking; Type=double, +Leniency=Increase. */ @@ -374,11 +378,11 @@ public class Magic extends ConfigurationFile { // 0.2 -> 0.3 diffs // Fix improperly stored double Y_MAXDIFF new ConfigValue("Y_MAXDIFF").setValue(new ConfigValue("Y_MAXDIFF").getDefaultValue()); - // Update version - version = new ConfigValue("VERSION").setValue(0.3D); setNeedsReload(true); } + new ConfigValue("VERSION").setValue(new ConfigValue("VERSION").getDefaultValue()); + ENTERED_EXITED_TIME = new ConfigValue("ENTERED_EXITED_TIME").getValue(); SNEAK_TIME = new ConfigValue("SNEAK_TIME").getValue(); TELEPORT_TIME = new ConfigValue("TELEPORT_TIME").getValue(); @@ -445,6 +449,7 @@ public class Magic extends ConfigurationFile { Y_TIME = new ConfigValue("Y_TIME").getValue(); XZ_SPEED_MAX = new ConfigValue("XZ_SPEED_MAX").getValue(); XZ_SPEED_MAX_SPRINT = new ConfigValue("XZ_SPEED_MAX_SPRINT").getValue(); + XZ_SPEED_MAX_POTION_SPRINT = new ConfigValue("XZ_SPEED_MAX_POTION_SPRINT").getValue(); XZ_SPEED_MAX_FLY = new ConfigValue("XZ_SPEED_MAX_FLY").getValue(); XZ_SPEED_MAX_POTION = new ConfigValue("XZ_SPEED_MAX_POTION").getValue(); XZ_SPEED_MAX_SNEAK = new ConfigValue("XZ_SPEED_MAX_SNEAK").getValue(); diff --git a/src/main/java/net/gravitydevelopment/anticheat/manage/Backend.java b/src/main/java/net/gravitydevelopment/anticheat/manage/Backend.java index bf28442..3a1c992 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/manage/Backend.java +++ b/src/main/java/net/gravitydevelopment/anticheat/manage/Backend.java @@ -304,8 +304,13 @@ public class Backend { reason = "while flying "; max = magic.XZ_SPEED_MAX_FLY; } else if (player.hasPotionEffect(PotionEffectType.SPEED)) { - reason = "with speed potion "; - max = magic.XZ_SPEED_MAX_POTION; + if (player.isSprinting()) { + reason = "with speed potion while sprinting "; + max = magic.XZ_SPEED_MAX_POTION_SPRINT; + } else { + reason = "with speed potion "; + max = magic.XZ_SPEED_MAX_POTION; + } } else if (player.isSprinting()) { reason = "while sprinting "; max = magic.XZ_SPEED_MAX_SPRINT; @@ -440,7 +445,7 @@ public class Backend { if (distance.getYDifference() > magic.TELEPORT_MIN || distance.getYDifference() < 0) { return PASS; } - if (!isMovingExempt(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !Utilities.isClimbableBlock(player.getLocation().add(0, -1, 0).getBlock()) && !player.isInsideVehicle() && !Utilities.isInWater(player)) { + if (!isMovingExempt(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !Utilities.isClimbableBlock(player.getLocation().add(0, -1, 0).getBlock()) && !player.isInsideVehicle() && !Utilities.isInWater(player) && !hasJumpPotion(player)) { double y1 = player.getLocation().getY(); String name = player.getName(); // Fix Y axis spam. @@ -1041,6 +1046,14 @@ public class Backend { } } + public boolean hasJumpPotion(Player player) { + return player.hasPotionEffect(PotionEffectType.JUMP); + } + + public boolean hasSpeedPotion(Player player) { + return player.hasPotionEffect(PotionEffectType.SPEED); + } + public void processChatSpammer(Player player) { User user = manager.getUserManager().getUser(player.getName()); int level = chatLevel.containsKey(user.getName()) ? chatLevel.get(user.getName()) : 0; diff --git a/src/main/resources/magic.yml b/src/main/resources/magic.yml index 0b8f9ac..d6e6e9e 100644 --- a/src/main/resources/magic.yml +++ b/src/main/resources/magic.yml @@ -71,6 +71,7 @@ WATER_SPEED_VIOLATION_MAX: 4 XZ_SPEED_MAX: 0.25 XZ_SPEED_MAX_FLY: 0.56 XZ_SPEED_MAX_POTION: 0.7 +XZ_SPEED_MAX_POTION_SPRINT: 0.95 XZ_SPEED_MAX_SNEAK: 0.15 XZ_SPEED_MAX_SOULSAND: 0.13 XZ_SPEED_MAX_SOULSAND_POTION: 0.16 @@ -83,4 +84,4 @@ Y_MAXVIOLATIONS: 1 Y_MAXVIOTIME: 5000 Y_SPEED_MAX: 0.5 Y_TIME: 1000 -VERSION: 0.4 +VERSION: 0.5