From a29c6724ee92a17ad683d1565fb65fd60bb1ea3f Mon Sep 17 00:00:00 2001 From: Dawson Hessler Date: Sat, 19 Sep 2020 18:24:13 -0400 Subject: [PATCH] 2.10.2 small update - Implemented menu advertisements. A lot less intrusive. - Fixed errors inside of BadPackets (E). Added back BadPackets (E). - Fixed false positive in NoFall (A). - Optimized imports. - Added KauriVersion enum to the Kauri API. - Fixed errors caused by KauriAPI not loading before certain calls to it. --- API/pom.xml | 2 +- .../main/java/dev/brighten/api/KauriAPI.java | 4 +- .../java/dev/brighten/api/KauriVersion.java | 27 +++++++ .../dev/brighten/api/wrappers/Wrapper.java | 2 - Free/pom.xml | 4 +- .../java/dev/brighten/anticheat/Load.java | 15 +--- .../brighten/anticheat/check/FreeChecks.java | 53 ++------------ .../check/impl/combat/hitbox/ReachA.java | 5 +- .../check/impl/movement/fly/FlyA.java | 2 - .../check/impl/movement/nofall/NoFallA.java | 8 +-- .../check/impl/movement/speed/SpeedA.java | 2 - .../impl/packets/badpackets/BadPacketsA.java | 5 +- .../impl/packets/badpackets/BadPacketsC.java | 3 - .../impl/packets/badpackets/BadPacketsE.java | 16 +---- .../check/impl/packets/badpackets/Timer.java | 1 - Impl/pom.xml | 2 +- .../java/dev/brighten/anticheat/Load.java | 2 +- .../classloader/KauriClassLoader.java | 2 +- .../anticheat/commands/MenuCommand.java | 72 ++++++++++++++++--- .../brighten/anticheat/data/ObjectData.java | 2 +- .../data/classes/BlockInformation.java | 9 ++- .../anticheat/listeners/CancelListeners.java | 2 +- .../anticheat/processing/EntityProcessor.java | 2 - .../processing/MovementProcessor.java | 1 - .../anticheat/processing/PacketProcessor.java | 3 - .../anticheat/processing/PotionProcessor.java | 6 -- .../keepalive/KeepaliveProcessor.java | 2 +- .../brighten/anticheat/utils/CacheMap.java | 2 +- Premium/pom.xml | 4 +- .../anticheat/premium/impl/InventoryB.java | 5 +- .../anticheat/premium/impl/InventoryC.java | 3 - .../anticheat/premium/impl/Motion.java | 5 +- .../impl/autoclicker/AutoclickerD.java | 5 +- .../impl/autoclicker/AutoclickerE.java | 1 - .../impl/autoclicker/AutoclickerH.java | 5 +- .../impl/autoclicker/AutoclickerI.java | 5 +- .../impl/autoclicker/AutoclickerJ.java | 5 +- Regular/pom.xml | 2 +- .../anticheat/check/RegularChecks.java | 7 +- .../impl/combat/autoclicker/AutoclickerB.java | 5 +- .../impl/combat/autoclicker/AutoclickerC.java | 5 +- .../impl/combat/autoclicker/AutoclickerG.java | 5 +- .../check/impl/combat/hand/HandA.java | 5 +- .../check/impl/combat/hand/HandB.java | 5 +- .../check/impl/combat/hand/HandC.java | 5 +- .../check/impl/combat/hand/HandD.java | 5 +- .../check/impl/combat/killaura/KillauraA.java | 5 +- .../check/impl/combat/killaura/KillauraB.java | 5 +- .../check/impl/combat/killaura/KillauraC.java | 5 +- .../check/impl/combat/killaura/KillauraD.java | 2 - .../check/impl/combat/killaura/KillauraE.java | 5 +- .../check/impl/combat/killaura/KillauraF.java | 5 +- .../check/impl/movement/speed/SpeedC.java | 1 - .../impl/movement/velocity/VelocityC.java | 1 - .../anticheat/check/impl/packets/TimerB.java | 43 +++++++---- .../impl/packets/exploits/PacketSpam.java | 2 - pom.xml | 2 +- 57 files changed, 235 insertions(+), 179 deletions(-) create mode 100644 API/src/main/java/dev/brighten/api/KauriVersion.java diff --git a/API/pom.xml b/API/pom.xml index a3bf1696f..eb0077fa2 100644 --- a/API/pom.xml +++ b/API/pom.xml @@ -5,7 +5,7 @@ Kauri dev.brighten.anticheat - 2.10.1 + 2.10.2 4.0.0 diff --git a/API/src/main/java/dev/brighten/api/KauriAPI.java b/API/src/main/java/dev/brighten/api/KauriAPI.java index f388166ed..d400397de 100644 --- a/API/src/main/java/dev/brighten/api/KauriAPI.java +++ b/API/src/main/java/dev/brighten/api/KauriAPI.java @@ -4,7 +4,6 @@ import dev.brighten.api.handlers.ExemptHandler; import dev.brighten.api.wrappers.WrappedDataManager; import dev.brighten.api.wrappers.WrappedKauri; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import java.util.concurrent.Executors; @@ -17,7 +16,8 @@ public class KauriAPI { public ExemptHandler exemptHandler; public ScheduledExecutorService service; public WrappedDataManager dataManager; - private WrappedKauri kauriPlugin; + WrappedKauri kauriPlugin; + public KauriAPI() { INSTANCE = this; diff --git a/API/src/main/java/dev/brighten/api/KauriVersion.java b/API/src/main/java/dev/brighten/api/KauriVersion.java new file mode 100644 index 000000000..ca9f4a29a --- /dev/null +++ b/API/src/main/java/dev/brighten/api/KauriVersion.java @@ -0,0 +1,27 @@ +package dev.brighten.api; + +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public enum KauriVersion { + FREE("Free", 0), + FULL("Full", 45), + ARA("Ara", 8.99f); + + public final String name; + public final float price; + + public static String getVersion() { + return KauriAPI.INSTANCE.kauriPlugin.getPlugin().getDescription().getVersion(); + } + + public static KauriVersion getPlan() { + if(KauriAPI.INSTANCE.kauriPlugin.fetchField("usingPremium")) + return FULL; + + if(KauriAPI.INSTANCE.kauriPlugin.fetchField("usingAra")) + return ARA; + + return FREE; + } +} diff --git a/API/src/main/java/dev/brighten/api/wrappers/Wrapper.java b/API/src/main/java/dev/brighten/api/wrappers/Wrapper.java index e2de3d502..49014970b 100644 --- a/API/src/main/java/dev/brighten/api/wrappers/Wrapper.java +++ b/API/src/main/java/dev/brighten/api/wrappers/Wrapper.java @@ -3,10 +3,8 @@ import cc.funkemunky.api.reflections.types.WrappedClass; import cc.funkemunky.api.reflections.types.WrappedField; import cc.funkemunky.api.reflections.types.WrappedMethod; -import lombok.RequiredArgsConstructor; import java.util.Arrays; -import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; diff --git a/Free/pom.xml b/Free/pom.xml index 5ae4ea560..c1beb073a 100644 --- a/Free/pom.xml +++ b/Free/pom.xml @@ -5,7 +5,7 @@ Kauri dev.brighten.anticheat - 2.10.1 + 2.10.2 4.0.0 @@ -34,7 +34,7 @@ shade - true + false dev.brighten.anticheat:Impl diff --git a/Free/src/main/java/dev/brighten/anticheat/Load.java b/Free/src/main/java/dev/brighten/anticheat/Load.java index ca5679ac0..92e38fbcf 100644 --- a/Free/src/main/java/dev/brighten/anticheat/Load.java +++ b/Free/src/main/java/dev/brighten/anticheat/Load.java @@ -9,25 +9,16 @@ import cc.funkemunky.api.utils.RunUtils; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.Config; -import dev.brighten.anticheat.classloader.KauriClassLoader; import dev.brighten.anticheat.data.DataManager; import dev.brighten.anticheat.logs.LoggerManager; import dev.brighten.anticheat.processing.EntityProcessor; import dev.brighten.anticheat.processing.PacketProcessor; import dev.brighten.anticheat.processing.keepalive.KeepaliveProcessor; -import dev.brighten.anticheat.utils.SystemUtil; import dev.brighten.anticheat.utils.TickTimer; -import dev.brighten.anticheat.classloader.file.FileDownloader; import dev.brighten.api.KauriAPI; import org.bukkit.Bukkit; -import java.io.File; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.Optional; import java.util.concurrent.Executors; public class Load { @@ -42,6 +33,9 @@ public static void load() { register("Loading config..."); Kauri.INSTANCE.saveDefaultConfig(); + register("Loading API..."); + Kauri.INSTANCE.kauriAPI = new KauriAPI(); + register("Loading commands..."); Kauri.INSTANCE.commandManager = new CommandManager(Kauri.INSTANCE); @@ -63,9 +57,6 @@ public static void load() { register("Setting the language to " + Color.Yellow + Config.language); Kauri.INSTANCE.msgHandler.setCurrentLang(Config.language); - register("Loading API..."); - Kauri.INSTANCE.kauriAPI = new KauriAPI(); - register("Registering checks..."); Check.registerChecks(); diff --git a/Free/src/main/java/dev/brighten/anticheat/check/FreeChecks.java b/Free/src/main/java/dev/brighten/anticheat/check/FreeChecks.java index db46d8d5b..6fab15035 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/FreeChecks.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/FreeChecks.java @@ -1,6 +1,9 @@ package dev.brighten.anticheat.check; -import cc.funkemunky.api.utils.*; +import cc.funkemunky.api.utils.Init; +import cc.funkemunky.api.utils.MiscUtils; +import cc.funkemunky.api.utils.Priority; +import cc.funkemunky.api.utils.RunUtils; import dev.brighten.anticheat.Kauri; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckRegister; @@ -10,13 +13,6 @@ import dev.brighten.anticheat.check.impl.movement.nofall.NoFallA; import dev.brighten.anticheat.check.impl.movement.speed.SpeedA; import dev.brighten.anticheat.check.impl.packets.badpackets.*; -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitTask; @Init(priority = Priority.LOWEST) @@ -27,51 +23,14 @@ public class FreeChecks implements CheckRegister { public FreeChecks() { registerChecks(); - ConfigDefault paidMsgingToOps = - new ConfigDefault<>(true, "misc.upgradeMessaging.messageOps", Kauri.INSTANCE); - - TextComponent message = new TextComponent(); - TextComponent lBracket = new TextComponent("["), kauri = new TextComponent("Kauri"), - rbracket = new TextComponent("]"); - lBracket.setColor(ChatColor.DARK_GRAY); - kauri.setColor(ChatColor.GOLD); - kauri.setBold(true); - rbracket.setColor(ChatColor.DARK_GRAY); - - message.addExtra(lBracket); - message.addExtra(kauri); - message.addExtra(rbracket); - - TextComponent buyMessage = new TextComponent("We appreciate you using Kauri." + - " If you would like to help us out while unlocking more, please consider "); - - buyMessage.setColor(ChatColor.GRAY); - - TextComponent purchasing = new TextComponent("purchasing a premium package"); - purchasing.setColor(ChatColor.WHITE); - purchasing.setItalic(true); - purchasing.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new BaseComponent[]{new TextComponent(Color.Yellow + Color.Italics + "Open URL")})); - purchasing.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://funkemunky.cc/shop")); - - message.addExtra(buyMessage); - message.addExtra(purchasing); - msgingTask = RunUtils.taskTimerAsync(() -> { if (!Kauri.INSTANCE.usingPremium && !Kauri.INSTANCE.usingAra) { - if (paidMsgingToOps.get()) { - for (Player player : Bukkit.getOnlinePlayers()) { - if (!player.isOp()) continue; - - player.spigot().sendMessage(message); - } - } MiscUtils.printToConsole("&fWe appreciate you using Kauri. If you would like to help us out " + "while unlocking more, please consider purchasing a " + "premium package at &e&ohttps://funkemunky.cc/shop" ); } else msgingTask.cancel(); - }, Kauri.INSTANCE, 20 * 30, 20 * 240); + }, Kauri.INSTANCE, 40, 18000); } @Override @@ -85,7 +44,7 @@ public void registerChecks() { Check.register(new BadPacketsB()); Check.register(new BadPacketsC()); Check.register(new BadPacketsD()); - //Check.register(new BadPacketsE()); + Check.register(new BadPacketsE()); Check.register(new BadPacketsF()); Check.register(new BadPacketsG()); Check.register(new BadPacketsH()); diff --git a/Free/src/main/java/dev/brighten/anticheat/check/impl/combat/hitbox/ReachA.java b/Free/src/main/java/dev/brighten/anticheat/check/impl/combat/hitbox/ReachA.java index fb401996e..bbfd2e034 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/impl/combat/hitbox/ReachA.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/impl/combat/hitbox/ReachA.java @@ -4,7 +4,10 @@ import cc.funkemunky.api.utils.KLocation; import cc.funkemunky.api.utils.world.EntityData; import cc.funkemunky.api.utils.world.types.SimpleCollisionBox; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; import lombok.val; diff --git a/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/fly/FlyA.java b/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/fly/FlyA.java index d118e5d39..3dcfc2568 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/fly/FlyA.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/fly/FlyA.java @@ -3,13 +3,11 @@ import cc.funkemunky.api.tinyprotocol.api.ProtocolVersion; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.utils.Color; -import cc.funkemunky.api.utils.MathUtils; import dev.brighten.anticheat.check.api.Cancellable; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckInfo; import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CheckType; -import net.minecraft.server.v1_8_R3.BlockClay; @CheckInfo(name = "Fly (A)", description = "Simple fly check.", punishVL = 10, checkType = CheckType.FLIGHT, vlToFlag = 3, developer = true) diff --git a/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/nofall/NoFallA.java b/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/nofall/NoFallA.java index d4fb5298d..04aeb86bc 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/nofall/NoFallA.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/nofall/NoFallA.java @@ -44,13 +44,9 @@ public void onPacket(WrappedInFlyingPacket packet, long timeStamp) { && data.playerInfo.lastVelocity.hasPassed(4) && (data.playerInfo.deltaY != 0 || data.playerInfo.deltaXZ > 0) && data.playerInfo.blockAboveTimer.hasPassed(10) - && flag) { - vl+= data.lagInfo.lagging - || data.playerInfo.nearGround - || data.blockInfo.blocksNear - ? 1 : data.playerInfo.clientGround ? 2 : 3; + && flag) { ; - if(vl > 2) { + if(++vl > 2) { flag("ground=" + data.playerInfo.clientGround + " deltaY=" + data.playerInfo.deltaY); } } else vl-= vl > 0 ? 0.2f : 0; diff --git a/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedA.java b/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedA.java index 5bc089bbf..078facfb2 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedA.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedA.java @@ -2,7 +2,6 @@ import cc.funkemunky.api.tinyprotocol.api.ProtocolVersion; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; -import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutVelocityPacket; import cc.funkemunky.api.utils.PlayerUtils; import dev.brighten.anticheat.check.api.Cancellable; @@ -11,7 +10,6 @@ import dev.brighten.anticheat.check.api.Packet; import dev.brighten.anticheat.processing.TagsBuilder; import dev.brighten.api.check.CheckType; -import org.bukkit.entity.EntityType; import org.bukkit.potion.PotionEffectType; @CheckInfo(name = "Speed (A)", description = "Minecraft code speed acceleration check.", diff --git a/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsA.java b/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsA.java index 096663856..3211ac3ed 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsA.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsA.java @@ -3,7 +3,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInBlockDigPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInBlockPlacePacket; import cc.funkemunky.api.utils.BlockUtils; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsC.java b/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsC.java index 6ffc3915b..46f6b1567 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsC.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsC.java @@ -2,9 +2,6 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInHeldItemSlotPacket; -import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInTransactionPacket; -import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; -import dev.brighten.anticheat.Kauri; import dev.brighten.anticheat.check.api.Cancellable; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckInfo; diff --git a/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsE.java b/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsE.java index b780927f3..46d6173e4 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsE.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/BadPacketsE.java @@ -5,37 +5,27 @@ import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckInfo; import dev.brighten.anticheat.check.api.Packet; -import dev.brighten.anticheat.data.ObjectData; -import dev.brighten.anticheat.utils.TickTimer; import dev.brighten.api.check.CheckType; @CheckInfo(name = "BadPackets (E)", description = "Checks for a player not swinging their arm.", checkType = CheckType.BADPACKETS, punishVL = 10, developer = true) public class BadPacketsE extends Check { - private TickTimer lastSwing; private int attackTicks; - @Override - public void setData(ObjectData data) { - super.setData(data); - lastSwing = new TickTimer( 8); - } - @Packet public void onFlying(WrappedInUseEntityPacket packet) { if(!packet.getAction().equals(WrappedInUseEntityPacket.EnumEntityUseAction.ATTACK)) return; - if(attackTicks++ > 3 && lastSwing.hasNotPassed(3) - && !data.lagInfo.lagging && data.lagInfo.lastPacketDrop.hasPassed(5)) { + if(attackTicks++ > 3 + && !data.lagInfo.lagging) { vl++; - flag("has not swung since %v ticks", lastSwing.getPassed()); + flag("has not swung since %v ticks", attackTicks); } } @Packet public void onFlying(WrappedInArmAnimationPacket packet) { - lastSwing.reset(); attackTicks = 0; } } diff --git a/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/Timer.java b/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/Timer.java index a2af3d8a3..59469fe29 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/Timer.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/impl/packets/badpackets/Timer.java @@ -2,7 +2,6 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInTransactionPacket; -import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutPositionPacket; import cc.funkemunky.api.utils.math.RollingAverage; import dev.brighten.anticheat.Kauri; import dev.brighten.anticheat.check.api.Cancellable; diff --git a/Impl/pom.xml b/Impl/pom.xml index 512aa92ab..160402493 100644 --- a/Impl/pom.xml +++ b/Impl/pom.xml @@ -5,7 +5,7 @@ Kauri dev.brighten.anticheat - 2.10.1 + 2.10.2 4.0.0 diff --git a/Impl/src/main/java/dev/brighten/anticheat/Load.java b/Impl/src/main/java/dev/brighten/anticheat/Load.java index 23131dbc7..747ad0656 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/Load.java +++ b/Impl/src/main/java/dev/brighten/anticheat/Load.java @@ -10,6 +10,7 @@ import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.Config; import dev.brighten.anticheat.classloader.KauriClassLoader; +import dev.brighten.anticheat.classloader.file.FileDownloader; import dev.brighten.anticheat.data.DataManager; import dev.brighten.anticheat.logs.LoggerManager; import dev.brighten.anticheat.processing.EntityProcessor; @@ -17,7 +18,6 @@ import dev.brighten.anticheat.processing.keepalive.KeepaliveProcessor; import dev.brighten.anticheat.utils.SystemUtil; import dev.brighten.anticheat.utils.TickTimer; -import dev.brighten.anticheat.classloader.file.FileDownloader; import dev.brighten.api.KauriAPI; import org.bukkit.Bukkit; diff --git a/Impl/src/main/java/dev/brighten/anticheat/classloader/KauriClassLoader.java b/Impl/src/main/java/dev/brighten/anticheat/classloader/KauriClassLoader.java index 023874819..e8fd11c05 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/classloader/KauriClassLoader.java +++ b/Impl/src/main/java/dev/brighten/anticheat/classloader/KauriClassLoader.java @@ -1,7 +1,7 @@ package dev.brighten.anticheat.classloader; -import dev.brighten.anticheat.utils.SystemUtil; import dev.brighten.anticheat.classloader.file.JarUtil; +import dev.brighten.anticheat.utils.SystemUtil; import java.io.File; import java.net.URL; diff --git a/Impl/src/main/java/dev/brighten/anticheat/commands/MenuCommand.java b/Impl/src/main/java/dev/brighten/anticheat/commands/MenuCommand.java index 88dc70c4e..6ff8079aa 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/commands/MenuCommand.java +++ b/Impl/src/main/java/dev/brighten/anticheat/commands/MenuCommand.java @@ -14,8 +14,14 @@ import dev.brighten.anticheat.utils.menu.preset.button.FillerButton; import dev.brighten.anticheat.utils.menu.type.impl.ChestMenu; import dev.brighten.anticheat.utils.mojang.MojangAPI; +import dev.brighten.api.KauriVersion; import dev.brighten.api.check.CheckType; import lombok.val; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -49,26 +55,58 @@ public void onCommand(CommandAdapter cmd) { cmd.getPlayer().sendMessage(Color.Green + "Opened main menu."); } + private static BaseComponent[] freeMessage = new ComponentBuilder("We would appreciate if you purchased a " + + "full version. It really helps to fund the development of Kauri for the longterm.") + .color(ChatColor.GRAY) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new ComponentBuilder("Opens https://funkemunky.cc/shop") + .color(ChatColor.GRAY).italic(true).create())) + .event(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://funkemunky.cc/shop")) + .create(), + fullMessage = new ComponentBuilder("Thanks for buying a full copy!").color(ChatColor.GREEN) + .append("If you run a server that needs best in class combat detection, we suggesting trying ") + .color(ChatColor.GRAY).append("Kauri Ara").color(ChatColor.GOLD).bold(true) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new ComponentBuilder("Opens https://funkemunky.cc/shop") + .color(ChatColor.GRAY).italic(true).create())) + .event(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://funkemunky.cc/shop")) + .create(), + araMessage = new ComponentBuilder("Thanks for purchasing Kauri Ara!") + .color(ChatColor.GREEN).create(); private static ChestMenu getMainMenu() { ChestMenu menu = new ChestMenu(Color.Gold + "Kauri Menu", 3); menu.setItem(11, createButton(XMaterial.ANVIL.parseMaterial(), 1, "&cEdit Checks", (player, info) -> categoryMenu.showMenu(player), "", "&7Toggle Kauri checks on or off.")); + KauriVersion plan = KauriVersion.getPlan(); menu.setItem(13, createButton(XMaterial.ENCHANTED_BOOK.parseMaterial(), 1, "&cKauri Anticheat", (player, info) -> { - if (info.getClickType().equals(ClickType.RIGHT) - || info.getClickType().equals(ClickType.SHIFT_RIGHT)) { - menu.setParent(null); - menu.close(player); - player.sendMessage(MiscUtils.line(Color.Dark_Gray)); - player.sendMessage(Color.translate("&6Discord: &fhttps://discord.me/Brighten")); - player.sendMessage(Color.translate("&6Website: &fhttps://funkemunky.cc/contact")); - player.sendMessage(MiscUtils.line(Color.Dark_Gray)); + switch(info.getClickType()) { + case RIGHT: + case SHIFT_RIGHT: { + menu.setParent(null); + menu.close(player); + player.sendMessage(MiscUtils.line(Color.Dark_Gray)); + player.sendMessage(Color.translate("&6Discord: &fhttps://discord.me/Brighten")); + player.sendMessage(Color.translate("&6Website: &fhttps://funkemunky.cc/contact")); + player.sendMessage(MiscUtils.line(Color.Dark_Gray)); + break; + } + case LEFT: + case SHIFT_LEFT: { + menu.setParent(null); + menu.close(player); + if(plan.equals(KauriVersion.FREE)) { + player.spigot().sendMessage(freeMessage); + } else if(plan.equals(KauriVersion.FULL)) { + player.spigot().sendMessage(fullMessage); + } else player.spigot().sendMessage(araMessage); + break; + } } }, - "", "&7You are using &6Kauri Anticheat v" + - Kauri.INSTANCE.getDescription().getVersion(), "&e&oRight Click &7&oclick to get support.")); + getKauriLore(plan))); menu.setItem(15, createButton(XMaterial.PAPER.parseMaterial(), 1, "&cView Recent Violators", (player, info) -> { player.sendMessage(Color.Gray + "Loading menu..."); @@ -77,6 +115,20 @@ private static ChestMenu getMainMenu() { return menu; } + private static String[] getKauriLore(KauriVersion plan) { + if(plan.equals(KauriVersion.FREE)) { + return new String[] {"", "&7You are using &6Kauri Anticheat v" + + KauriVersion.getVersion(), "&7Your Plan: &e" + plan.name, + "", "&cYou are currently using a &oFREE TRIAL&c", + "", "&e&oLeft click &7&oto purchase a full version.", + "&e&oRight Click &7&oclick to get support."}; + } else { + return new String[] {"", "&7You are using &6Kauri Anticheat v" + + KauriVersion.getVersion(), "&7Your Plan: &e" + plan.name, + "", "&e&oRight Click &7&oclick to get support."}; + } + } + private static ChestMenu getChecksCategoryMenu() { ChestMenu menu = new ChestMenu(Color.Gold + "Check Categories", 3); diff --git a/Impl/src/main/java/dev/brighten/anticheat/data/ObjectData.java b/Impl/src/main/java/dev/brighten/anticheat/data/ObjectData.java index 82d8694b5..cdd3f9fbb 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/data/ObjectData.java +++ b/Impl/src/main/java/dev/brighten/anticheat/data/ObjectData.java @@ -12,7 +12,6 @@ import cc.funkemunky.api.utils.objects.evicting.ConcurrentEvictingList; import cc.funkemunky.api.utils.world.types.SimpleCollisionBox; import dev.brighten.anticheat.Kauri; -import dev.brighten.api.check.CancelType; import dev.brighten.anticheat.check.api.Config; import dev.brighten.anticheat.data.classes.BlockInformation; import dev.brighten.anticheat.data.classes.CheckManager; @@ -25,6 +24,7 @@ import dev.brighten.anticheat.processing.keepalive.KeepAlive; import dev.brighten.anticheat.utils.PastLocation; import dev.brighten.anticheat.utils.TickTimer; +import dev.brighten.api.check.CancelType; import dev.brighten.api.data.Data; import lombok.AllArgsConstructor; import lombok.val; diff --git a/Impl/src/main/java/dev/brighten/anticheat/data/classes/BlockInformation.java b/Impl/src/main/java/dev/brighten/anticheat/data/classes/BlockInformation.java index 11fa34984..2078edd79 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/data/classes/BlockInformation.java +++ b/Impl/src/main/java/dev/brighten/anticheat/data/classes/BlockInformation.java @@ -1,6 +1,5 @@ package dev.brighten.anticheat.data.classes; -import cc.funkemunky.api.Atlas; import cc.funkemunky.api.tinyprotocol.api.ProtocolVersion; import cc.funkemunky.api.tinyprotocol.packet.types.enums.WrappedEnumParticle; import cc.funkemunky.api.utils.BlockUtils; @@ -11,9 +10,7 @@ import cc.funkemunky.api.utils.world.types.SimpleCollisionBox; import dev.brighten.anticheat.Kauri; import dev.brighten.anticheat.data.ObjectData; -import dev.brighten.anticheat.processing.EntityProcessor; import dev.brighten.anticheat.utils.CacheList; -import dev.brighten.anticheat.utils.CacheMap; import dev.brighten.anticheat.utils.CollisionHandler; import dev.brighten.anticheat.utils.Helper; import lombok.val; @@ -23,8 +20,10 @@ import org.bukkit.entity.EntityType; import org.bukkit.util.Vector; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; diff --git a/Impl/src/main/java/dev/brighten/anticheat/listeners/CancelListeners.java b/Impl/src/main/java/dev/brighten/anticheat/listeners/CancelListeners.java index 39abe8dab..f5f7da1fb 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/listeners/CancelListeners.java +++ b/Impl/src/main/java/dev/brighten/anticheat/listeners/CancelListeners.java @@ -3,8 +3,8 @@ import cc.funkemunky.api.utils.BlockUtils; import cc.funkemunky.api.utils.Init; import dev.brighten.anticheat.Kauri; -import dev.brighten.api.check.CancelType; import dev.brighten.anticheat.data.ObjectData; +import dev.brighten.api.check.CancelType; import lombok.val; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Impl/src/main/java/dev/brighten/anticheat/processing/EntityProcessor.java b/Impl/src/main/java/dev/brighten/anticheat/processing/EntityProcessor.java index c16add720..993323e34 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/processing/EntityProcessor.java +++ b/Impl/src/main/java/dev/brighten/anticheat/processing/EntityProcessor.java @@ -7,13 +7,11 @@ import org.bukkit.entity.Vehicle; import org.bukkit.scheduler.BukkitTask; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; -import java.util.stream.Collectors; public class EntityProcessor { diff --git a/Impl/src/main/java/dev/brighten/anticheat/processing/MovementProcessor.java b/Impl/src/main/java/dev/brighten/anticheat/processing/MovementProcessor.java index 1a5b0935a..5d96252c9 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/processing/MovementProcessor.java +++ b/Impl/src/main/java/dev/brighten/anticheat/processing/MovementProcessor.java @@ -4,7 +4,6 @@ import cc.funkemunky.api.reflections.impl.MinecraftReflection; import cc.funkemunky.api.tinyprotocol.api.ProtocolVersion; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; -import cc.funkemunky.api.tinyprotocol.packet.types.MathHelper; import cc.funkemunky.api.utils.*; import cc.funkemunky.api.utils.handlers.PlayerSizeHandler; import cc.funkemunky.api.utils.objects.VariableValue; diff --git a/Impl/src/main/java/dev/brighten/anticheat/processing/PacketProcessor.java b/Impl/src/main/java/dev/brighten/anticheat/processing/PacketProcessor.java index 76170e80b..2a4002465 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/processing/PacketProcessor.java +++ b/Impl/src/main/java/dev/brighten/anticheat/processing/PacketProcessor.java @@ -2,8 +2,6 @@ import cc.funkemunky.api.events.impl.PacketReceiveEvent; import cc.funkemunky.api.events.impl.PacketSendEvent; -import cc.funkemunky.api.reflections.impl.MinecraftReflection; -import cc.funkemunky.api.reflections.types.WrappedField; import cc.funkemunky.api.tinyprotocol.api.Packet; import cc.funkemunky.api.tinyprotocol.api.ProtocolVersion; import cc.funkemunky.api.tinyprotocol.api.TinyProtocolHandler; @@ -13,7 +11,6 @@ import cc.funkemunky.api.utils.XMaterial; import dev.brighten.anticheat.Kauri; import dev.brighten.anticheat.data.ObjectData; -import dev.brighten.anticheat.utils.MiscUtils; import lombok.val; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Impl/src/main/java/dev/brighten/anticheat/processing/PotionProcessor.java b/Impl/src/main/java/dev/brighten/anticheat/processing/PotionProcessor.java index 12537c026..e28af096c 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/processing/PotionProcessor.java +++ b/Impl/src/main/java/dev/brighten/anticheat/processing/PotionProcessor.java @@ -1,20 +1,14 @@ package dev.brighten.anticheat.processing; -import cc.funkemunky.api.tinyprotocol.api.TinyProtocolHandler; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; -import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInTransactionPacket; import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutEntityEffectPacket; -import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutTransaction; import dev.brighten.anticheat.data.ObjectData; import lombok.RequiredArgsConstructor; import lombok.val; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; @RequiredArgsConstructor diff --git a/Impl/src/main/java/dev/brighten/anticheat/processing/keepalive/KeepaliveProcessor.java b/Impl/src/main/java/dev/brighten/anticheat/processing/keepalive/KeepaliveProcessor.java index b111099c3..523e9294c 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/processing/keepalive/KeepaliveProcessor.java +++ b/Impl/src/main/java/dev/brighten/anticheat/processing/keepalive/KeepaliveProcessor.java @@ -12,7 +12,7 @@ import java.util.Map; import java.util.Optional; import java.util.UUID; -import java.util.concurrent.*; +import java.util.concurrent.ConcurrentHashMap; public class KeepaliveProcessor implements Runnable { diff --git a/Impl/src/main/java/dev/brighten/anticheat/utils/CacheMap.java b/Impl/src/main/java/dev/brighten/anticheat/utils/CacheMap.java index f71fd6393..ee02d1dfa 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/utils/CacheMap.java +++ b/Impl/src/main/java/dev/brighten/anticheat/utils/CacheMap.java @@ -2,7 +2,7 @@ import dev.brighten.anticheat.Kauri; -import java.util.*; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; diff --git a/Premium/pom.xml b/Premium/pom.xml index 41c9034cd..26eb6f852 100644 --- a/Premium/pom.xml +++ b/Premium/pom.xml @@ -5,7 +5,7 @@ Kauri dev.brighten.anticheat - 2.10.1 + 2.10.2 4.0.0 @@ -59,7 +59,7 @@ dev.brighten.anticheat Impl ${parent.version} - provided + compile diff --git a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/InventoryB.java b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/InventoryB.java index 7121d444f..cacbdd1bb 100644 --- a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/InventoryB.java +++ b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/InventoryB.java @@ -4,7 +4,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutCloseWindowPacket; import cc.funkemunky.api.utils.MathUtils; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/InventoryC.java b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/InventoryC.java index a678ebd11..7e668b801 100644 --- a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/InventoryC.java +++ b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/InventoryC.java @@ -1,10 +1,7 @@ package dev.brighten.anticheat.premium.impl; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; -import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInHeldItemSlotPacket; -import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInTransactionPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInWindowClickPacket; -import dev.brighten.anticheat.Kauri; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckInfo; import dev.brighten.anticheat.check.api.Packet; diff --git a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/Motion.java b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/Motion.java index 995867f7c..11cad1b7b 100644 --- a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/Motion.java +++ b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/Motion.java @@ -2,7 +2,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.utils.MathUtils; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerD.java b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerD.java index 2bc5425fa..c85e1616e 100644 --- a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerD.java +++ b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerD.java @@ -1,7 +1,10 @@ package dev.brighten.anticheat.premium.impl.autoclicker; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInArmAnimationPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.anticheat.utils.Pattern; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerE.java b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerE.java index d561d0888..355877f65 100644 --- a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerE.java +++ b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerE.java @@ -2,7 +2,6 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInArmAnimationPacket; import cc.funkemunky.api.utils.Color; -import cc.funkemunky.api.utils.math.cond.MaxDouble; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckInfo; import dev.brighten.anticheat.check.api.Packet; diff --git a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerH.java b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerH.java index d9e5fd360..b5e4919e2 100644 --- a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerH.java +++ b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerH.java @@ -1,7 +1,10 @@ package dev.brighten.anticheat.premium.impl.autoclicker; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInArmAnimationPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerI.java b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerI.java index b0a0d12e8..726903aa7 100644 --- a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerI.java +++ b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerI.java @@ -2,7 +2,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInArmAnimationPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerJ.java b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerJ.java index 61b446482..699d7db6c 100644 --- a/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerJ.java +++ b/Premium/src/main/java/dev/brighten/anticheat/premium/impl/autoclicker/AutoclickerJ.java @@ -2,7 +2,10 @@ import cc.funkemunky.api.tinyprotocol.api.ProtocolVersion; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInArmAnimationPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Regular/pom.xml b/Regular/pom.xml index cff73905f..ebf5273b4 100644 --- a/Regular/pom.xml +++ b/Regular/pom.xml @@ -5,7 +5,7 @@ Kauri dev.brighten.anticheat - 2.10.1 + 2.10.2 4.0.0 diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/RegularChecks.java b/Regular/src/main/java/dev/brighten/anticheat/check/RegularChecks.java index 860fd40af..f677b9e6c 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/RegularChecks.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/RegularChecks.java @@ -7,11 +7,11 @@ import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckRegister; import dev.brighten.anticheat.check.impl.combat.aim.*; -import dev.brighten.anticheat.check.impl.combat.hand.*; -import dev.brighten.anticheat.check.impl.combat.killaura.*; import dev.brighten.anticheat.check.impl.combat.autoclicker.AutoclickerC; import dev.brighten.anticheat.check.impl.combat.autoclicker.AutoclickerG; +import dev.brighten.anticheat.check.impl.combat.hand.*; import dev.brighten.anticheat.check.impl.combat.hitbox.Hitboxes; +import dev.brighten.anticheat.check.impl.combat.killaura.*; import dev.brighten.anticheat.check.impl.movement.fly.FlyB; import dev.brighten.anticheat.check.impl.movement.fly.FlyC; import dev.brighten.anticheat.check.impl.movement.general.FastLadder; @@ -21,7 +21,6 @@ import dev.brighten.anticheat.check.impl.movement.speed.SpeedC; import dev.brighten.anticheat.check.impl.movement.velocity.VelocityA; import dev.brighten.anticheat.check.impl.movement.velocity.VelocityC; -import dev.brighten.anticheat.check.impl.packets.TimerB; import dev.brighten.anticheat.check.impl.packets.exploits.*; @Init(priority = Priority.LOWEST) @@ -57,7 +56,7 @@ public void registerChecks() { Check.register(new KillauraE()); Check.register(new KillauraF()); Check.register(new OmniSprint()); - Check.register(new TimerB()); + //Check.register(new TimerB()); Check.register(new VelocityA()); Check.register(new VelocityC()); Check.register(new HandA()); diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerB.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerB.java index 5290cc46f..24127fe93 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerB.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerB.java @@ -3,7 +3,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInArmAnimationPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInBlockPlacePacket; import cc.funkemunky.api.utils.objects.evicting.EvictingList; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; import lombok.val; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerC.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerC.java index fd0e88060..81bbd6240 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerC.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerC.java @@ -6,7 +6,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.utils.MathUtils; import cc.funkemunky.api.utils.math.cond.MaxDouble; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerG.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerG.java index 7ce89f7df..c5ac6e1e4 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerG.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/autoclicker/AutoclickerG.java @@ -1,7 +1,10 @@ package dev.brighten.anticheat.check.impl.combat.autoclicker; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInArmAnimationPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandA.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandA.java index a3edcd5e4..862d886d4 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandA.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandA.java @@ -2,7 +2,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInBlockPlacePacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandB.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandB.java index d84147bb4..b5e79ca4a 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandB.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandB.java @@ -2,7 +2,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInBlockDigPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandC.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandC.java index 08cfced32..e69b100e7 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandC.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandC.java @@ -2,7 +2,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInBlockDigPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandD.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandD.java index c5f4bf0a7..8f41bec3c 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandD.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/hand/HandD.java @@ -8,7 +8,10 @@ import cc.funkemunky.api.utils.world.BlockData; import cc.funkemunky.api.utils.world.types.RayCollision; import cc.funkemunky.api.utils.world.types.SimpleCollisionBox; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; import lombok.val; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraA.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraA.java index 6a69190c0..4d7c46ef2 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraA.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraA.java @@ -7,7 +7,10 @@ import cc.funkemunky.api.utils.world.EntityData; import cc.funkemunky.api.utils.world.types.RayCollision; import cc.funkemunky.api.utils.world.types.SimpleCollisionBox; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; import org.bukkit.Location; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraB.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraB.java index 9168908ea..864eac2bb 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraB.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraB.java @@ -2,7 +2,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraC.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraC.java index 0dd8ba274..513a0cd3f 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraC.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraC.java @@ -3,7 +3,10 @@ import cc.funkemunky.api.tinyprotocol.api.ProtocolVersion; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInArmAnimationPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraD.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraD.java index 8587c3855..0c8c0d4f2 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraD.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraD.java @@ -1,8 +1,6 @@ package dev.brighten.anticheat.check.impl.combat.killaura; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; -import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; -import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInWindowClickPacket; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckInfo; import dev.brighten.anticheat.check.api.Packet; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraE.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraE.java index 1725d1c73..49060f824 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraE.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraE.java @@ -3,7 +3,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInBlockPlacePacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraF.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraF.java index 8d6236977..abe180ab8 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraF.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraF.java @@ -2,7 +2,10 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; -import dev.brighten.anticheat.check.api.*; +import dev.brighten.anticheat.check.api.Cancellable; +import dev.brighten.anticheat.check.api.Check; +import dev.brighten.anticheat.check.api.CheckInfo; +import dev.brighten.anticheat.check.api.Packet; import dev.brighten.api.check.CancelType; import dev.brighten.api.check.CheckType; import org.bukkit.entity.Player; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedC.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedC.java index cd50d069c..db8784ba7 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedC.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedC.java @@ -2,7 +2,6 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.utils.MathUtils; -import cc.funkemunky.api.utils.math.cond.MaxInteger; import dev.brighten.anticheat.check.api.Cancellable; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckInfo; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/velocity/VelocityC.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/velocity/VelocityC.java index 4cd56d9df..b0e7fd1c2 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/velocity/VelocityC.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/velocity/VelocityC.java @@ -1,6 +1,5 @@ package dev.brighten.anticheat.check.impl.movement.velocity; -import cc.funkemunky.api.tinyprotocol.api.ProtocolVersion; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutVelocityPacket; diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/packets/TimerB.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/packets/TimerB.java index c5b39fdd9..bae0f1457 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/packets/TimerB.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/packets/TimerB.java @@ -1,36 +1,51 @@ package dev.brighten.anticheat.check.impl.packets; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; -import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInTransactionPacket; -import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutPositionPacket; -import cc.funkemunky.api.utils.MathUtils; -import cc.funkemunky.api.utils.math.RollingAverage; -import cc.funkemunky.api.utils.objects.evicting.EvictingList; -import dev.brighten.anticheat.Kauri; import dev.brighten.anticheat.check.api.Cancellable; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckInfo; import dev.brighten.anticheat.check.api.Packet; -import dev.brighten.anticheat.utils.ExponentialMovingAverage; -import dev.brighten.anticheat.utils.MiscUtils; import dev.brighten.api.check.CheckType; -import lombok.val; + +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; @CheckInfo(name = "Timer (B)", description = "Checks the rate of packets coming in.", - checkType = CheckType.BADPACKETS, vlToFlag = 4, developer = true) + checkType = CheckType.BADPACKETS, vlToFlag = 20, developer = true) @Cancellable public class TimerB extends Check { - private int ticks, buffer; - private ExponentialMovingAverage average = new ExponentialMovingAverage(50); + private int buffer; + private final List list = new CopyOnWriteArrayList<>(); private long lastFlying = System.currentTimeMillis(); @Packet public void onPacket(WrappedInFlyingPacket packet, long current) { + long delta = current - lastFlying; + + if(list.size() > 20 && (delta > 5 && delta < 90)) { + if(list.size() > 21) { + list.stream().filter(l -> l < 5 || l > 90).forEach(list::remove); + } + for (int i = 0; i < list.size() - 20; i++) { + list.remove(0); + } + } + + list.add(delta); + + double average = list.stream().mapToLong(l -> l).average().orElse(50); + + double pct = 50 / average * 100; - double avg = average.average(current - lastFlying); + if(pct > 101 && list.size() > 15) { + if(++buffer > 20) { + vl++; + flag("pct=%v.1", pct); + } + } else if(buffer > 0) buffer-= 1f; - debug("std=%v.5", avg); + debug("delta=%v.2", average); lastFlying = current; } } \ No newline at end of file diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/packets/exploits/PacketSpam.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/packets/exploits/PacketSpam.java index 084436bde..62458a7ff 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/packets/exploits/PacketSpam.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/packets/exploits/PacketSpam.java @@ -5,9 +5,7 @@ import cc.funkemunky.api.events.impl.PacketReceiveEvent; import cc.funkemunky.api.events.impl.PacketSendEvent; import cc.funkemunky.api.tinyprotocol.api.Packet; -import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutCustomPayload; import cc.funkemunky.api.utils.RunUtils; -import dev.brighten.anticheat.Kauri; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckInfo; import dev.brighten.anticheat.check.api.Event; diff --git a/pom.xml b/pom.xml index 81c7bfa44..a29531300 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ dev.brighten.anticheat Kauri pom - 2.10.1 + 2.10.2 API Impl