diff --git a/pom.xml b/pom.xml index 634096c..27dd278 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.rammelkast.anticheatreloaded AntiCheatReloaded - 1.8.1-PRE + 1.8.1 AntiCheatReloaded https://www.spigotmc.org/resources/anticheatreloaded.23799/ diff --git a/src/main/java/com/rammelkast/anticheatreloaded/AntiCheatReloaded.java b/src/main/java/com/rammelkast/anticheatreloaded/AntiCheatReloaded.java index 7731969..9da61f1 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/AntiCheatReloaded.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/AntiCheatReloaded.java @@ -64,7 +64,6 @@ public class AntiCheatReloaded extends JavaPlugin { private static UpdateManager updateManager; private double tps = -1; - private int currentTick; @Override public void onEnable() { @@ -152,7 +151,6 @@ public class AntiCheatReloaded extends JavaPlugin { tps = (tps == 0.0D ? ticks : (tps + ticks) / 2.0D); ticks = 1; } - currentTick++; } }.runTaskTimer(this, 40L, 1L); // Launch MorePackets timer diff --git a/src/main/java/com/rammelkast/anticheatreloaded/check/Backend.java b/src/main/java/com/rammelkast/anticheatreloaded/check/Backend.java index 0cb3773..16aa529 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/check/Backend.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/check/Backend.java @@ -30,13 +30,11 @@ import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; import org.bukkit.enchantments.Enchantment; 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.combat.KillAuraCheck; import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck; import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck; @@ -58,7 +56,6 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil; public class Backend { public Map velocitized = new HashMap(); private List isAscending = new ArrayList(); - private Map ascensionCount = new HashMap(); private Map chatLevel = new HashMap(); private Map commandLevel = new HashMap(); private Map nofallViolation = new HashMap(); @@ -86,11 +83,9 @@ public class Backend { private Map inventoryTime = new HashMap(); private Map inventoryClicks = new HashMap(); private Map itemInHand = new HashMap(); - private Map steps = new HashMap(); - private Map stepTime = new HashMap(); private HashSet transparent = new HashSet(); private Map lastFallPacket = new HashMap(); - private Map fastSneakViolations = new HashMap(); + private Map fastSneakViolations = new HashMap(); private Magic magic; private AntiCheatManager manager = null; @@ -118,67 +113,66 @@ public class Backend { } public void garbageClean(Player player) { - UUID pU = player.getUniqueId(); + UUID uuid = player.getUniqueId(); - VelocityCheck.cleanPlayer(player); - MorePacketsCheck.MOVE_COUNT.remove(player.getUniqueId()); - blocksDropped.remove(pU); - blockTime.remove(pU); - FlightCheck.MOVING_EXEMPT.remove(pU); - brokenBlock.remove(pU); - placedBlock.remove(pU); - bowWindUp.remove(pU); - startEat.remove(pU); - lastHeal.remove(pU); - sprinted.remove(pU); - WaterWalkCheck.IS_IN_WATER.remove(pU); - WaterWalkCheck.IS_IN_WATER_CACHE.remove(pU); - instantBreakExempt.remove(pU); - isAscending.remove(player.getUniqueId()); - ascensionCount.remove(player.getUniqueId()); - FlightCheck.BLOCKS_OVER_FLIGHT.remove(pU); - nofallViolation.remove(pU); - fastBreakViolation.remove(pU); - YAxisCheck.Y_AXIS_VIOLATIONS.remove(pU); - YAxisCheck.LAST_Y_AXIS_VIOLATION.remove(pU); - YAxisCheck.LAST_Y_COORD_CACHE.remove(pU); - YAxisCheck.LAST_Y_TIME.remove(pU); - WaterWalkCheck.WATER_ASCENSION_VIOLATIONS.remove(pU); - WaterWalkCheck.WATER_SPEED_VIOLATIONS.remove(pU); - fastBreaks.remove(pU); - blockBreakHolder.remove(pU); - lastBlockBroken.remove(pU); - fastPlaceViolation.remove(pU); - lastBlockPlaced.remove(pU); - lastBlockPlaceTime.remove(pU); - blockPunches.remove(pU); - projectilesShot.remove(pU); - velocitized.remove(pU); - velocitytrack.remove(pU); - startEat.remove(pU); - lastHeal.remove(pU); - projectileTime.remove(pU); - bowWindUp.remove(pU); - instantBreakExempt.remove(pU); - sprinted.remove(pU); - brokenBlock.remove(pU); - placedBlock.remove(pU); - FlightCheck.MOVING_EXEMPT.remove(pU); - blockTime.remove(pU); - blocksDropped.remove(pU); - lastInventoryTime.remove(pU); - inventoryTime.remove(pU); - inventoryClicks.remove(pU); - lastFallPacket.remove(pU); - fastSneakViolations.remove(player.getUniqueId().toString()); - GlideCheck.LAST_MOTION_Y.remove(pU); - GlideCheck.LAST_FALL_DISTANCE.remove(pU); - GlideCheck.VIOLATIONS.remove(pU); - SpeedCheck.SPEED_VIOLATIONS.remove(player.getUniqueId()); - ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString()); - KillAuraCheck.ANGLE_FLAGS.remove(pU); - KillAuraCheck.PITCH_MOVEMENTS_CACHE.remove(pU); - KillAuraCheck.GCD_CACHE.remove(pU); + blocksDropped.remove(uuid); + blockTime.remove(uuid); + brokenBlock.remove(uuid); + placedBlock.remove(uuid); + bowWindUp.remove(uuid); + startEat.remove(uuid); + lastHeal.remove(uuid); + sprinted.remove(uuid); + instantBreakExempt.remove(uuid); + isAscending.remove(uuid); + nofallViolation.remove(uuid); + fastBreakViolation.remove(uuid); + fastBreaks.remove(uuid); + blockBreakHolder.remove(uuid); + lastBlockBroken.remove(uuid); + fastPlaceViolation.remove(uuid); + lastBlockPlaced.remove(uuid); + lastBlockPlaceTime.remove(uuid); + blockPunches.remove(uuid); + projectilesShot.remove(uuid); + velocitized.remove(uuid); + velocitytrack.remove(uuid); + startEat.remove(uuid); + lastHeal.remove(uuid); + projectileTime.remove(uuid); + bowWindUp.remove(uuid); + instantBreakExempt.remove(uuid); + sprinted.remove(uuid); + brokenBlock.remove(uuid); + placedBlock.remove(uuid); + blockTime.remove(uuid); + blocksDropped.remove(uuid); + lastInventoryTime.remove(uuid); + inventoryTime.remove(uuid); + inventoryClicks.remove(uuid); + lastFallPacket.remove(uuid); + fastSneakViolations.remove(uuid); + VelocityCheck.VIOLATIONS.remove(uuid); + MorePacketsCheck.MOVE_COUNT.remove(uuid); + GlideCheck.LAST_MOTION_Y.remove(uuid); + GlideCheck.LAST_FALL_DISTANCE.remove(uuid); + GlideCheck.VIOLATIONS.remove(uuid); + SpeedCheck.SPEED_VIOLATIONS.remove(uuid); + ElytraCheck.JUMP_Y_VALUE.remove(uuid); + KillAuraCheck.ANGLE_FLAGS.remove(uuid); + KillAuraCheck.PITCH_MOVEMENTS_CACHE.remove(uuid); + KillAuraCheck.GCD_CACHE.remove(uuid); + FlightCheck.MOVING_EXEMPT.remove(uuid); + FlightCheck.ASCENSION_COUNT.remove(uuid); + FlightCheck.BLOCKS_OVER_FLIGHT.remove(uuid); + YAxisCheck.Y_AXIS_VIOLATIONS.remove(uuid); + YAxisCheck.LAST_Y_AXIS_VIOLATION.remove(uuid); + YAxisCheck.LAST_Y_COORD_CACHE.remove(uuid); + YAxisCheck.LAST_Y_TIME.remove(uuid); + WaterWalkCheck.IS_IN_WATER.remove(uuid); + WaterWalkCheck.IS_IN_WATER_CACHE.remove(uuid); + WaterWalkCheck.WATER_ASCENSION_VIOLATIONS.remove(uuid); + WaterWalkCheck.WATER_SPEED_VIOLATIONS.remove(uuid); } public CheckResult checkFastBow(Player player, float force) { @@ -321,24 +315,24 @@ public class Backend { && !Utilities.cantStandAtExp(location)) { double i = x > magic.XZ_SPEED_MAX_SNEAK() ? x : z > magic.XZ_SPEED_MAX_SNEAK() ? z : -1; if (i != -1) { - if (this.fastSneakViolations.containsKey(player.getUniqueId().toString())) { - int flags = this.fastSneakViolations.get(player.getUniqueId().toString()); + if (this.fastSneakViolations.containsKey(player.getUniqueId())) { + int flags = this.fastSneakViolations.get(player.getUniqueId()); if (flags >= 3) { // TODO possible config return new CheckResult(CheckResult.Result.FAILED, "was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")"); } - this.fastSneakViolations.put(player.getUniqueId().toString(), flags + 1); + this.fastSneakViolations.put(player.getUniqueId(), flags + 1); return PASS; } else { - this.fastSneakViolations.put(player.getUniqueId().toString(), 1); + this.fastSneakViolations.put(player.getUniqueId(), 1); return PASS; } } else { - this.fastSneakViolations.remove(player.getUniqueId().toString()); + this.fastSneakViolations.remove(player.getUniqueId()); return PASS; } } else { - this.fastSneakViolations.remove(player.getUniqueId().toString()); + this.fastSneakViolations.remove(player.getUniqueId()); return PASS; } } @@ -383,39 +377,6 @@ public class Backend { } } - public CheckResult checkAscension(Player player, double y1, double y2) { - int max = magic.ASCENSION_COUNT_MAX(); - String string = ""; - if (player.hasPotionEffect(PotionEffectType.JUMP)) { - max += 12; - string = " with jump potion"; - } - Block block = player.getLocation().getBlock(); - if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player) - && !justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) - && !Utilities.isClimbableBlock(player.getEyeLocation().getBlock()) - && !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock()) - && !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock()) - && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -0.5, 0).getBlock())) { - // TODO isMoveUpBlock does not seem to be a success with stairs - if (y1 < y2) { - if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() - && !block.getRelative(BlockFace.EAST).isLiquid() - && !block.getRelative(BlockFace.WEST).isLiquid()) { - increment(player, ascensionCount, max); - if (ascensionCount.get(player.getUniqueId()) >= max) { - return new CheckResult(CheckResult.Result.FAILED, - "ascended " + ascensionCount.get(player.getUniqueId()) + " times in a row (max = " + max - + string + ")"); - } - } - } else { - ascensionCount.put(player.getUniqueId(), 0); - } - } - return PASS; - } - public CheckResult checkSwing(Player player, Block block) { UUID uuid = player.getUniqueId(); if (!isInstantBreakExempt(player)) { @@ -809,7 +770,7 @@ public class Backend { GlideCheck.LAST_FALL_DISTANCE.remove(player.getUniqueId()); GlideCheck.LAST_MOTION_Y.remove(player.getUniqueId()); GlideCheck.VIOLATIONS.remove(player.getUniqueId()); - ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString()); + ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId()); } public void logExitFly(final Player player) { @@ -887,35 +848,35 @@ public class Backend { commandLevel.put(user.getUUID(), level + 1); } - public int increment(Player player, Map ascensionCount2, int num) { + public int increment(Player player, Map map, int num) { UUID name = player.getUniqueId(); - if (ascensionCount2.get(name) == null) { - ascensionCount2.put(name, 1); + if (map.get(name) == null) { + map.put(name, 1); return 1; } else { - int amount = ascensionCount2.get(name) + 1; + int amount = map.get(name) + 1; if (amount < num + 1) { - ascensionCount2.put(name, amount); + map.put(name, amount); return amount; } else { - ascensionCount2.put(name, num); + map.put(name, num); return num; } } } - public int incrementOld(Player player, Map ascensionCount2, int num) { + public int incrementOld(Player player, Map map, int num) { UUID uuid = player.getUniqueId(); - if (ascensionCount2.get(uuid) == null) { - ascensionCount2.put(uuid, 1); + if (map.get(uuid) == null) { + map.put(uuid, 1); return 1; } else { - int amount = ascensionCount2.get(uuid) + 1; + int amount = map.get(uuid) + 1; if (amount < num + 1) { - ascensionCount2.put(uuid, amount); + map.put(uuid, amount); return amount; } else { - ascensionCount2.put(uuid, num); + map.put(uuid, num); return num; } } diff --git a/src/main/java/com/rammelkast/anticheatreloaded/check/combat/VelocityCheck.java b/src/main/java/com/rammelkast/anticheatreloaded/check/combat/VelocityCheck.java index 60622e5..86a1107 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/check/combat/VelocityCheck.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/check/combat/VelocityCheck.java @@ -35,11 +35,7 @@ import com.rammelkast.anticheatreloaded.event.EventListener; public class VelocityCheck { - private static final Map VL_COUNT = new HashMap(); - - public static void cleanPlayer(Player p) { - VL_COUNT.remove(p.getUniqueId()); - } + public static final Map VIOLATIONS = new HashMap(); public static void runCheck(EntityDamageByEntityEvent e, final Player player) { if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.VELOCITY)) @@ -51,24 +47,24 @@ public class VelocityCheck { if (!player.isOnline()) return; if (then.distance(player.getLocation()) < 0.125) { - if (!VL_COUNT.containsKey(player.getUniqueId())) - VL_COUNT.put(player.getUniqueId(), 1); + if (!VIOLATIONS.containsKey(player.getUniqueId())) + VIOLATIONS.put(player.getUniqueId(), 1); else { - VL_COUNT.put(player.getUniqueId(), VL_COUNT.get(player.getUniqueId()) + 1); - if (VL_COUNT.get(player.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic() + VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1); + if (VIOLATIONS.get(player.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic() .VELOCITY_MAX_FLAGS()) { EventListener.log( new CheckResult(CheckResult.Result.FAILED, - "had zero/low velocity " + VL_COUNT.get(player.getUniqueId()) + " times (max=" + "had zero/low velocity " + VIOLATIONS.get(player.getUniqueId()) + " times (max=" + AntiCheatReloaded.getManager().getBackend().getMagic() .VELOCITY_MAX_FLAGS() + ", dist=" + then.distance(player.getLocation()) + ")").getMessage(), player, CheckType.VELOCITY); - VL_COUNT.remove(player.getUniqueId()); + VIOLATIONS.remove(player.getUniqueId()); } } } else { - VL_COUNT.remove(player.getUniqueId()); + VIOLATIONS.remove(player.getUniqueId()); } } }.runTaskLater(AntiCheatReloaded.getPlugin(), 4); diff --git a/src/main/java/com/rammelkast/anticheatreloaded/check/movement/ElytraCheck.java b/src/main/java/com/rammelkast/anticheatreloaded/check/movement/ElytraCheck.java index c43a891..c87bf90 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/check/movement/ElytraCheck.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/check/movement/ElytraCheck.java @@ -20,6 +20,7 @@ package com.rammelkast.anticheatreloaded.check.movement; import java.util.HashMap; +import java.util.UUID; import org.bukkit.Location; import org.bukkit.Material; @@ -33,7 +34,7 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil; public class ElytraCheck { - public static final HashMap JUMP_Y_VALUE = new HashMap(); + public static final HashMap JUMP_Y_VALUE = new HashMap(); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); public static CheckResult runCheck(Player player, Distance distance) { @@ -42,7 +43,7 @@ public class ElytraCheck { return PASS; } - String uuid = player.getUniqueId().toString(); + UUID uuid = player.getUniqueId(); if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) { // This was a teleport, so skip check. JUMP_Y_VALUE.remove(uuid); diff --git a/src/main/java/com/rammelkast/anticheatreloaded/check/movement/FlightCheck.java b/src/main/java/com/rammelkast/anticheatreloaded/check/movement/FlightCheck.java index cb43d89..be81729 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/check/movement/FlightCheck.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/check/movement/FlightCheck.java @@ -24,10 +24,13 @@ import java.util.Map; import java.util.UUID; import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffectType; import com.rammelkast.anticheatreloaded.AntiCheatReloaded; +import com.rammelkast.anticheatreloaded.check.Backend; import com.rammelkast.anticheatreloaded.check.CheckResult; import com.rammelkast.anticheatreloaded.util.Distance; import com.rammelkast.anticheatreloaded.util.Utilities; @@ -40,6 +43,7 @@ public class FlightCheck { public static final Map BLOCKS_OVER_FLIGHT = new HashMap(); public static final Map MOVING_EXEMPT = new HashMap(); + public static final Map ASCENSION_COUNT = new HashMap(); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); public static CheckResult runCheck(Player player, Distance distance) { @@ -80,6 +84,40 @@ public class FlightCheck { } return PASS; } + + public static CheckResult checkAscension(Player player, double y1, double y2) { + Backend backend = AntiCheatReloaded.getManager().getBackend(); + int max = backend.getMagic().ASCENSION_COUNT_MAX(); + String string = ""; + if (player.hasPotionEffect(PotionEffectType.JUMP)) { + max += 12; + string = " with jump potion"; + } + Block block = player.getLocation().getBlock(); + if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player) + && !backend.justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) + && !Utilities.isClimbableBlock(player.getEyeLocation().getBlock()) + && !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock()) + && !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock()) + && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -0.5, 0).getBlock())) { + // TODO isMoveUpBlock does not seem to be a success with stairs + if (y1 < y2) { + if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() + && !block.getRelative(BlockFace.EAST).isLiquid() + && !block.getRelative(BlockFace.WEST).isLiquid()) { + backend.increment(player, ASCENSION_COUNT, max); + if (ASCENSION_COUNT.get(player.getUniqueId()) >= max) { + return new CheckResult(CheckResult.Result.FAILED, + "ascended " + ASCENSION_COUNT.get(player.getUniqueId()) + " times in a row (max = " + max + + string + ")"); + } + } + } else { + ASCENSION_COUNT.put(player.getUniqueId(), 0); + } + } + return PASS; + } public static boolean isMovingExempt(Player player) { return isDoing(player, MOVING_EXEMPT, -1) || player.isInsideVehicle(); diff --git a/src/main/java/com/rammelkast/anticheatreloaded/check/movement/GlideCheck.java b/src/main/java/com/rammelkast/anticheatreloaded/check/movement/GlideCheck.java index 6a6e713..8307f41 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/check/movement/GlideCheck.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/check/movement/GlideCheck.java @@ -30,7 +30,6 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import com.rammelkast.anticheatreloaded.AntiCheatReloaded; -import com.rammelkast.anticheatreloaded.check.Backend; import com.rammelkast.anticheatreloaded.check.CheckResult; import com.rammelkast.anticheatreloaded.util.Distance; import com.rammelkast.anticheatreloaded.util.Utilities; diff --git a/src/main/java/com/rammelkast/anticheatreloaded/command/executors/CommandReport.java b/src/main/java/com/rammelkast/anticheatreloaded/command/executors/CommandReport.java index 807ff4a..01577d5 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/command/executors/CommandReport.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/command/executors/CommandReport.java @@ -19,6 +19,10 @@ package com.rammelkast.anticheatreloaded.command.executors; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -27,12 +31,10 @@ import org.bukkit.entity.Player; import com.rammelkast.anticheatreloaded.AntiCheatReloaded; import com.rammelkast.anticheatreloaded.check.CheckType; import com.rammelkast.anticheatreloaded.command.CommandBase; -import com.rammelkast.anticheatreloaded.manage.CheckManager; -import com.rammelkast.anticheatreloaded.util.*; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; +import com.rammelkast.anticheatreloaded.util.Group; +import com.rammelkast.anticheatreloaded.util.Permission; +import com.rammelkast.anticheatreloaded.util.User; +import com.rammelkast.anticheatreloaded.util.Utilities; public class CommandReport extends CommandBase { diff --git a/src/main/java/com/rammelkast/anticheatreloaded/event/EventListener.java b/src/main/java/com/rammelkast/anticheatreloaded/event/EventListener.java index 125ae1c..ca481ed 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/event/EventListener.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/event/EventListener.java @@ -37,7 +37,6 @@ import com.rammelkast.anticheatreloaded.manage.AntiCheatManager; import com.rammelkast.anticheatreloaded.manage.CheckManager; import com.rammelkast.anticheatreloaded.manage.UserManager; import com.rammelkast.anticheatreloaded.util.User; -import com.rammelkast.anticheatreloaded.util.VersionUtil; public class EventListener implements Listener { private static final Map USAGE_LIST = new EnumMap(CheckType.class); diff --git a/src/main/java/com/rammelkast/anticheatreloaded/event/PlayerListener.java b/src/main/java/com/rammelkast/anticheatreloaded/event/PlayerListener.java index 76e24f0..23b4e01 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/event/PlayerListener.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/event/PlayerListener.java @@ -29,7 +29,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; -import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerAnimationEvent; @@ -263,10 +262,10 @@ public class PlayerListener extends EventListener { if (!VersionUtil.isBountifulUpdate()) { if (itemInHand.getType() == Material.FIREWORK_ROCKET) { - ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString()); + ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId()); if (player.isGliding()) { // TODO config max elytra height? - ElytraCheck.JUMP_Y_VALUE.put(player.getUniqueId().toString(), 9999.99D); + ElytraCheck.JUMP_Y_VALUE.put(player.getUniqueId(), 9999.99D); } } } @@ -485,7 +484,7 @@ public class PlayerListener extends EventListener { if (getCheckManager().willCheck(player, CheckType.FLIGHT) && !player.isFlying()) { CheckResult result1 = YAxisCheck.runCheck(player, new Distance(from, to)); - CheckResult result2 = getBackend().checkAscension(player, from.getY(), to.getY()); + CheckResult result2 = FlightCheck.checkAscension(player, from.getY(), to.getY()); String log = result1.failed() ? result1.getMessage() : result2.failed() ? result2.getMessage() : ""; if (!log.equals("")) { if (!silentMode()) { diff --git a/src/main/java/com/rammelkast/anticheatreloaded/event/VehicleListener.java b/src/main/java/com/rammelkast/anticheatreloaded/event/VehicleListener.java index bc5b6d0..765f8fa 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/event/VehicleListener.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/event/VehicleListener.java @@ -49,6 +49,7 @@ public class VehicleListener extends EventListener { AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners()); } + @SuppressWarnings("deprecation") @EventHandler(ignoreCancelled = true) public void onVehicleDestroy(VehicleDestroyEvent event) { if (VersionUtil.isBountifulUpdate()) { diff --git a/src/main/java/com/rammelkast/anticheatreloaded/manage/CheckManager.java b/src/main/java/com/rammelkast/anticheatreloaded/manage/CheckManager.java index 87acbd5..dd48a5d 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/manage/CheckManager.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/manage/CheckManager.java @@ -19,20 +19,19 @@ package com.rammelkast.anticheatreloaded.manage; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import com.rammelkast.anticheatreloaded.AntiCheatReloaded; -import com.rammelkast.anticheatreloaded.check.CheckType; -import com.rammelkast.anticheatreloaded.config.Configuration; -import com.rammelkast.anticheatreloaded.util.VersionUtil; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import com.rammelkast.anticheatreloaded.check.CheckType; +import com.rammelkast.anticheatreloaded.config.Configuration; +import com.rammelkast.anticheatreloaded.util.VersionUtil; + /** *

* The manager that AntiCheat will check with to see if it should watch certain checks and certain players. diff --git a/src/main/java/com/rammelkast/anticheatreloaded/util/UpdateManager.java b/src/main/java/com/rammelkast/anticheatreloaded/util/UpdateManager.java index 56b4a55..cd03b1d 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/util/UpdateManager.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/util/UpdateManager.java @@ -67,6 +67,7 @@ public class UpdateManager { builder.append((char) readChar); } data = builder.toString(); + reader.close(); } catch (IOException exception) {} finally { if (stream != null) { diff --git a/src/main/java/com/rammelkast/anticheatreloaded/util/VersionUtil.java b/src/main/java/com/rammelkast/anticheatreloaded/util/VersionUtil.java index 72dd23d..72ac3f9 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/util/VersionUtil.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/util/VersionUtil.java @@ -77,6 +77,7 @@ public class VersionUtil { return player.getInventory().getBoots().containsEnchantment(Enchantment.FROST_WALKER); } + @SuppressWarnings("deprecation") public static ItemStack getItemInHand(Player player) { if (isBountifulUpdate()) { return player.getItemInHand(); diff --git a/src/main/java/com/rammelkast/anticheatreloaded/util/XMaterial.java b/src/main/java/com/rammelkast/anticheatreloaded/util/XMaterial.java index 20896cd..017e0fc 100644 --- a/src/main/java/com/rammelkast/anticheatreloaded/util/XMaterial.java +++ b/src/main/java/com/rammelkast/anticheatreloaded/util/XMaterial.java @@ -1124,7 +1124,6 @@ public enum XMaterial { * * @since 3.0.0 */ - @SuppressWarnings("UnstableApiUsage") private static final ImmutableMap DUPLICATED = Maps.immutableEnumMap(ImmutableMap.builder() .put(MELON, MELON_SLICE) .put(CARROT, CARROTS) @@ -1847,7 +1846,6 @@ public enum XMaterial { * @return data of this material, or 0 if none. * @since 1.0.0 */ - @SuppressWarnings("deprecation") public byte getData() { return data; } @@ -1916,7 +1914,6 @@ public enum XMaterial { * @see #matchXMaterial(String, byte) * @since 2.0.0 */ - @SuppressWarnings("OptionalAssignedToNull") @Nullable public Material parseMaterial(boolean suggest) { Optional cache = PARSED_CACHE.getIfPresent(this);