diff --git a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java index 0f3d054..ebb83b1 100644 --- a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java +++ b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java @@ -152,17 +152,17 @@ public class PlayerListener extends EventListener backend.checkLongReachBlock(player,distance.getXDifference(), distance.getYDifference(), distance.getZDifference()); } - /* Chest Cheat Check */ + /* Visuals Check */ if(event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK) { Block block = event.getClickedBlock(); - if(((block.getType()) == Material.CHEST) && checkManager.willCheck(player, CheckType.CHEST_HACK)) + if(checkManager.willCheck(player, CheckType.VISUALS)) { // save load and actually call the backend check here. - if(backend.checkChestCheat(player, block)) + if(backend.checkVisuals(player, block)) { event.setCancelled(true); - log("tried to use freecam chest hack",player,CheckType.CHEST_HACK); + log("failed visuals check",player,CheckType.VISUALS); } } } diff --git a/src/main/java/net/h31ix/anticheat/manage/Backend.java b/src/main/java/net/h31ix/anticheat/manage/Backend.java index eef3867..a0525b7 100644 --- a/src/main/java/net/h31ix/anticheat/manage/Backend.java +++ b/src/main/java/net/h31ix/anticheat/manage/Backend.java @@ -261,7 +261,7 @@ public class Backend } } - public boolean checkChestCheat(Player player, Block block) + public boolean checkVisuals(Player player, Block block) { // The most complicated check in the world...approaching nirvana. int strikes = 0; @@ -327,8 +327,6 @@ public class Backend player.sendMessage("Block detected at -X: " + a + " Block: " + coords.getBlock().getType().toString()); player.sendBlockChange(coords, 46, (byte) 0); strikes++; - } else { - player.sendBlockChange(coords, 56, (byte) 0); } } } @@ -360,8 +358,6 @@ public class Backend player.sendMessage("Block detected at -Z: " + a + " Block: " + coords.getBlock().getType().toString()); player.sendBlockChange(coords, 46, (byte) 0); strikes++; - } else { - player.sendBlockChange(coords, 57, (byte) 0); } } } @@ -397,8 +393,6 @@ public class Backend player.sendMessage("Block detected at +X: " + a + " Block: " + coords.getBlock().getType().toString()); player.sendBlockChange(coords, 46, (byte) 0); strikes++; - } else { - player.sendBlockChange(coords, 35, (byte) 0); } } } @@ -430,8 +424,6 @@ public class Backend player.sendMessage("Block detected at -Z: " + a + " Block: " + coords.getBlock().getType().toString()); player.sendBlockChange(coords, 46, (byte) 0); strikes++; - } else { - player.sendBlockChange(coords, 57, (byte) 0); } } } @@ -449,8 +441,6 @@ public class Backend player.sendMessage("Block detected at +X: " + a + " Block: " + coords.getBlock().getType().toString()); player.sendBlockChange(coords, 46, (byte) 0); strikes++; - } else { - player.sendBlockChange(coords, 35, (byte) 0); } } } @@ -465,8 +455,6 @@ public class Backend player.sendMessage("Block detected at +Z: " + a + " Block: " + coords.getBlock().getType().toString()); player.sendBlockChange(coords, 46, (byte) 0); strikes++; - } else { - player.sendBlockChange(coords, 1, (byte) 0); } } } @@ -494,8 +482,6 @@ public class Backend player.sendMessage("Block detected at -X: " + a + " Block: " + coords.getBlock().getType().toString()); player.sendBlockChange(coords, 46, (byte) 0); strikes++; - } else { - player.sendBlockChange(coords, 56, (byte) 0); } } } @@ -520,8 +506,6 @@ public class Backend player.sendMessage("Block detected at +Z: " + a + " Block: " + coords.getBlock().getType().toString()); player.sendBlockChange(coords, 46, (byte) 0); strikes++; - } else { - player.sendBlockChange(coords, 1, (byte) 0); } } } @@ -532,7 +516,7 @@ public class Backend player.sendMessage("Strikes: " + strikes + " Dir: " + direction); player.sendMessage("X: " + x + " Y: " + y + " Z:" + z); - return false; + return strikes > 0; } public boolean checkWaterWalk(Player player, double x, double z) diff --git a/src/main/java/net/h31ix/anticheat/manage/CheckType.java b/src/main/java/net/h31ix/anticheat/manage/CheckType.java index 8cbf345..2cca275 100644 --- a/src/main/java/net/h31ix/anticheat/manage/CheckType.java +++ b/src/main/java/net/h31ix/anticheat/manage/CheckType.java @@ -38,7 +38,7 @@ public enum CheckType WATER_WALK("anticheat.waterwalk"), NO_SWING("anticheat.noswing"), FAST_BREAK("anticheat.fastbreak"), - CHEST_HACK("anticheat.chest"), + VISUALS("anticheat.visuals"), FAST_PLACE("anticheat.fastplace"), SPAM("anticheat.spam"), SPRINT("anticheat.sprint"),