├── .gitignore ├── README.md ├── pom.xml └── src └── main ├── java └── dev │ └── isnow │ └── fox │ ├── Fox.java │ ├── FoxPlugin.java │ ├── api │ ├── APIManager.java │ └── impl │ │ ├── FoxFlagEvent.java │ │ └── FoxPunishEvent.java │ ├── check │ ├── Check.java │ ├── api │ │ └── CheckInfo.java │ └── impl │ │ ├── combat │ │ ├── aim │ │ │ ├── AimA.java │ │ │ ├── AimB.java │ │ │ ├── AimC.java │ │ │ ├── AimD.java │ │ │ ├── AimE.java │ │ │ ├── AimF.java │ │ │ ├── AimG.java │ │ │ ├── AimH.java │ │ │ ├── AimI.java │ │ │ ├── AimJ.java │ │ │ ├── AimK.java │ │ │ ├── AimL.java │ │ │ ├── AimM.java │ │ │ ├── AimN.java │ │ │ ├── AimO.java │ │ │ ├── AimP.java │ │ │ ├── AimQ.java │ │ │ ├── AimR.java │ │ │ └── AimS.java │ │ ├── aura │ │ │ ├── AuraA.java │ │ │ ├── AuraB.java │ │ │ ├── AuraC.java │ │ │ ├── AuraD.java │ │ │ ├── AuraE.java │ │ │ ├── AuraF.java │ │ │ ├── AuraG.java │ │ │ ├── AuraH.java │ │ │ ├── AuraI.java │ │ │ ├── AuraJ.java │ │ │ ├── AuraK.java │ │ │ ├── AuraL.java │ │ │ ├── AuraM.java │ │ │ ├── AuraN.java │ │ │ ├── AuraO.java │ │ │ ├── AuraP.java │ │ │ ├── AuraQ.java │ │ │ ├── AuraR.java │ │ │ ├── AuraS.java │ │ │ ├── AuraT.java │ │ │ ├── AuraU.java │ │ │ ├── AuraV.java │ │ │ └── AuraW.java │ │ ├── autoclicker │ │ │ ├── AutoClickerA.java │ │ │ ├── AutoClickerB.java │ │ │ ├── AutoClickerC.java │ │ │ ├── AutoClickerD.java │ │ │ ├── AutoClickerE.java │ │ │ ├── AutoClickerF.java │ │ │ ├── AutoClickerG.java │ │ │ ├── AutoClickerH.java │ │ │ ├── AutoClickerI.java │ │ │ ├── AutoClickerJ.java │ │ │ ├── AutoClickerK.java │ │ │ ├── AutoClickerL.java │ │ │ └── AutoClickerM.java │ │ ├── entity │ │ │ └── EntityA.java │ │ ├── hitbox │ │ │ ├── HitBoxA.java │ │ │ └── HitBoxB.java │ │ ├── reach │ │ │ ├── ReachA.java │ │ │ └── ReachB.java │ │ └── velocity │ │ │ ├── VelocityA.java │ │ │ └── VelocityB.java │ │ ├── movement │ │ ├── flight │ │ │ ├── FlightA.java │ │ │ ├── FlightB.java │ │ │ ├── FlightC.java │ │ │ ├── FlightD.java │ │ │ └── FlightE.java │ │ ├── ghostblock │ │ │ └── GhostBlockA.java │ │ ├── motion │ │ │ ├── MotionA.java │ │ │ ├── MotionB.java │ │ │ ├── MotionC.java │ │ │ ├── MotionD.java │ │ │ ├── MotionE.java │ │ │ ├── MotionF.java │ │ │ └── MotionG.java │ │ └── speed │ │ │ ├── SpeedA.java │ │ │ ├── SpeedB.java │ │ │ ├── SpeedC.java │ │ │ └── SpeedD.java │ │ └── player │ │ ├── badpackets │ │ ├── BadPacketsA.java │ │ ├── BadPacketsB.java │ │ ├── BadPacketsC.java │ │ ├── BadPacketsD.java │ │ ├── BadPacketsE.java │ │ ├── BadPacketsF.java │ │ ├── BadPacketsG.java │ │ ├── BadPacketsH.java │ │ ├── BadPacketsI.java │ │ ├── BadPacketsJ.java │ │ ├── BadPacketsK.java │ │ ├── BadPacketsL.java │ │ └── BadPacketsM.java │ │ ├── breaker │ │ └── BreakerA.java │ │ ├── crasher │ │ ├── CrasherA.java │ │ ├── CrasherB.java │ │ ├── CrasherC.java │ │ └── CrasherD.java │ │ ├── fastplace │ │ └── FastPlaceA.java │ │ ├── ground │ │ ├── GroundA.java │ │ ├── GroundB.java │ │ └── GroundC.java │ │ ├── inventory │ │ ├── InventoryA.java │ │ ├── InventoryB.java │ │ ├── InventoryC.java │ │ └── InventoryD.java │ │ ├── payload │ │ ├── PayloadA.java │ │ └── PayloadB.java │ │ └── timer │ │ ├── TimerA.java │ │ ├── TimerB.java │ │ └── TimerC.java │ ├── command │ ├── CommandInfo.java │ ├── CommandManager.java │ ├── FoxCommand.java │ ├── VanishCommand.java │ └── impl │ │ ├── Alerts.java │ │ ├── Ban.java │ │ ├── Checks.java │ │ ├── Crash.java │ │ ├── Debug.java │ │ ├── Demo.java │ │ ├── Exempt.java │ │ ├── ForceBot.java │ │ ├── Gui.java │ │ ├── Help.java │ │ ├── Info.java │ │ ├── KB.java │ │ ├── Logs.java │ │ ├── Reload.java │ │ └── Scare.java │ ├── config │ ├── Config.java │ └── ConfigValue.java │ ├── data │ ├── PlayerData.java │ └── processor │ │ ├── ActionProcessor.java │ │ ├── BotProcessor.java │ │ ├── ClickProcessor.java │ │ ├── CombatProcessor.java │ │ ├── ConnectionProcessor.java │ │ ├── GhostBlockProcessor.java │ │ ├── PositionProcessor.java │ │ ├── RotationProcessor.java │ │ └── VelocityProcessor.java │ ├── exempt │ ├── ExemptProcessor.java │ └── type │ │ └── ExemptType.java │ ├── gui │ └── GuiManager.java │ ├── listener │ ├── bukkit │ │ ├── BukkitEventManager.java │ │ └── RegistrationListener.java │ └── packet │ │ └── NetworkManager.java │ ├── manager │ ├── AFKManager.java │ ├── AlertManager.java │ ├── CheckManager.java │ ├── ClientBrandListener.java │ ├── PlayerDataManager.java │ ├── PunishmentManager.java │ └── TickManager.java │ ├── packet │ ├── Packet.java │ ├── PacketData.java │ └── processor │ │ ├── ReceivingPacketProcessor.java │ │ └── SendingPacketProcessor.java │ ├── update │ └── UpdateChecker.java │ └── util │ ├── BlockUtil.java │ ├── BotTypes.java │ ├── BotUtils.java │ ├── ColorUtil.java │ ├── LogUtil.java │ ├── MathUtil.java │ ├── Metrics.java │ ├── MovingStats.java │ ├── PlayerUtil.java │ ├── ReflectionsUtil.java │ ├── ServerUtil.java │ ├── TimeUtils.java │ ├── Verbose.java │ ├── WrappedBlockUtil.java │ ├── WrappedEntityHumanUtil.java │ ├── WrappedEntityUtil.java │ ├── WrappedItemStackUtil.java │ ├── discord │ └── DiscordWebhook.java │ ├── reach │ ├── BoundingBox.java │ ├── CollisionBox.java │ └── reach │ │ ├── GetBoundingBox.java │ │ ├── PlayerReachEntity.java │ │ ├── Ray.java │ │ ├── ReachInterpolationData.java │ │ ├── ReachUtils.java │ │ ├── SimpleCollisionBox.java │ │ └── VanillaMath.java │ └── type │ ├── AABB.java │ ├── BlockUtil.java │ ├── BoundingBox.java │ ├── CollideEntry.java │ ├── ConcurrentEvictingList.java │ ├── CustomLocation.java │ ├── EntityHelper.java │ ├── EvictingList.java │ ├── EvictingMap.java │ ├── HitboxExpansion.java │ ├── LimitedDouble.java │ ├── Pair.java │ ├── RayTrace.java │ ├── Velocity.java │ ├── VpnInfo.java │ ├── WrappedBlock.java │ ├── WrappedEntity.java │ ├── WrappedEntityHuman.java │ └── WrappedItemStack.java └── resources ├── checks.yml ├── config.yml └── plugin.yml /README.md: -------------------------------------------------------------------------------- 1 | # FoxAC 2 | 3 | Anticheat which stole code from Overflow, leaked by Trippy 4 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/FoxPlugin.java: -------------------------------------------------------------------------------- 1 | 2 | package dev.isnow.fox; 3 | 4 | import org.bukkit.plugin.java.JavaPlugin; 5 | 6 | public final class FoxPlugin extends JavaPlugin { 7 | 8 | @Override 9 | public void onLoad() { 10 | Fox.INSTANCE.load(this); 11 | } 12 | 13 | @Override 14 | public void onEnable() { 15 | Fox.INSTANCE.start(this); 16 | } 17 | 18 | @Override 19 | public void onDisable() { 20 | Fox.INSTANCE.stop(this); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/api/APIManager.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.api; 4 | 5 | import dev.isnow.fox.Fox; 6 | import dev.isnow.fox.api.impl.FoxFlagEvent; 7 | import dev.isnow.fox.api.impl.FoxPunishEvent; 8 | import dev.isnow.fox.check.Check; 9 | import dev.isnow.fox.config.Config; 10 | import org.bukkit.Bukkit; 11 | 12 | public final class APIManager { 13 | public static void callFlagEvent(final Check check) { 14 | if (!Config.API_ENABLED) return; 15 | 16 | final FoxFlagEvent flagEvent = new FoxFlagEvent( 17 | check.getData().getPlayer(), 18 | check.getCheckInfo().name(), 19 | check.getCheckInfo().type(), 20 | check.getVl(), 21 | check.getBuffer() 22 | ); 23 | 24 | Bukkit.getScheduler().runTask(Fox.INSTANCE.getPlugin(), () -> Bukkit.getPluginManager().callEvent(flagEvent)); 25 | } 26 | 27 | public static void callPunishEvent(final Check check) { 28 | if (!Config.API_ENABLED) return; 29 | final FoxPunishEvent punishEvent = new FoxPunishEvent( 30 | check.getData().getPlayer(), 31 | check.getCheckInfo().name(), 32 | check.getCheckInfo().type(), 33 | check.getPunishCommands(), 34 | check.getVl(), 35 | check.getBuffer() 36 | ); 37 | 38 | Bukkit.getScheduler().runTask(Fox.INSTANCE.getPlugin(), () -> Bukkit.getPluginManager().callEvent(punishEvent)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/api/impl/FoxFlagEvent.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.api.impl; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Getter; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.event.Event; 9 | import org.bukkit.event.HandlerList; 10 | 11 | @Getter 12 | @AllArgsConstructor 13 | public final class FoxFlagEvent extends Event { 14 | 15 | private final Player player; 16 | 17 | private final String check, type; 18 | private final int currentViolationLevel; 19 | private final double currentBuffer; 20 | 21 | private static final HandlerList handlers = new HandlerList(); 22 | 23 | @Override 24 | public HandlerList getHandlers() { 25 | return handlers; 26 | } 27 | 28 | public static HandlerList getHandlerList() { 29 | return handlers; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/api/impl/FoxPunishEvent.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.api.impl; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Getter; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.event.Event; 9 | import org.bukkit.event.HandlerList; 10 | 11 | import java.util.ArrayList; 12 | 13 | @Getter 14 | @AllArgsConstructor 15 | public final class FoxPunishEvent extends Event { 16 | 17 | private final Player player; 18 | 19 | private final String check, type; 20 | private final ArrayList banCommands; 21 | private final int currentViolationLevel; 22 | private final double currentBuffer; 23 | 24 | private static final HandlerList handlers = new HandlerList(); 25 | 26 | @Override 27 | public HandlerList getHandlers() { 28 | return handlers; 29 | } 30 | 31 | public static HandlerList getHandlerList() { 32 | return handlers; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/api/CheckInfo.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.api; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Target(ElementType.TYPE) 12 | public @interface CheckInfo { 13 | String name(); 14 | String type(); 15 | 16 | String description(); 17 | 18 | boolean experimental() default false; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Aim", description = "Checks for snapping.", type = "B", experimental = true) 10 | public class AimB extends Check { 11 | 12 | private float lastDeltaYaw; 13 | private float lastLastDeltaYaw; 14 | 15 | public AimB(PlayerData data) { 16 | super(data); 17 | } 18 | 19 | @Override 20 | public void handle(Packet packet) { 21 | if (packet.isRotation()) { 22 | if (this.isExempt(ExemptType.TELEPORT, ExemptType.JOINED)) { 23 | return; 24 | } 25 | 26 | final float deltaYaw = this.data.getRotationProcessor().getDeltaYaw(); 27 | 28 | debug("deltaYaw: " + deltaYaw); 29 | 30 | if (deltaYaw < 5.0f && this.lastDeltaYaw > 30.0f && this.lastLastDeltaYaw < 5.0f && isExempt(ExemptType.TELEPORT)) { 31 | final double low = (deltaYaw + this.lastLastDeltaYaw) / 2.0f; 32 | final double high = this.lastDeltaYaw; 33 | if(increaseBuffer() > 5) { 34 | fail(low+ " / " +high); 35 | } else { 36 | decreaseBufferBy(0.10); 37 | } 38 | } 39 | this.lastLastDeltaYaw = this.lastDeltaYaw; 40 | this.lastDeltaYaw = deltaYaw; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimC.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.data.processor.RotationProcessor; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.MathUtil; 9 | import dev.isnow.fox.util.TimeUtils; 10 | 11 | @CheckInfo(name = "Aim", description = "Checks for jitter.", type = "C") 12 | public class AimC extends Check { 13 | public AimC(PlayerData data) { 14 | super(data); 15 | 16 | } 17 | 18 | @Override 19 | public void handle(Packet packet) { 20 | if (packet.isRotation() && TimeUtils.elapsed(data.getCombatProcessor().getLastAttack()) <= 1000L) { 21 | final RotationProcessor processor = data.getRotationProcessor(); 22 | 23 | final float deltaYaw = processor.getDeltaYaw(); 24 | final float lastDeltaYaw = processor.getLastDeltaYaw(); 25 | final float deltaPitch = processor.getDeltaPitch(); 26 | 27 | final double divisorYaw = MathUtil.getGcd((long) (deltaYaw * MathUtil.EXPANDER), (long) (lastDeltaYaw * MathUtil.EXPANDER)); 28 | 29 | final double epik = data.getRotationProcessor().getGcd() / divisorYaw; 30 | debug(epik); 31 | if (deltaYaw > 0.0 && deltaPitch > 0.0 && deltaYaw < 1 && deltaPitch < 1) { 32 | if (epik > 1.0E-7) { 33 | if (buffer++ > 10) { 34 | buffer = 5; 35 | fail(epik); 36 | } 37 | } else { 38 | decreaseBufferBy(2); 39 | } 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimD.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.data.processor.RotationProcessor; 7 | import dev.isnow.fox.exempt.type.ExemptType; 8 | import dev.isnow.fox.packet.Packet; 9 | import dev.isnow.fox.util.MathUtil; 10 | 11 | @CheckInfo(name = "Aim", description = "Checks for invalid sensitivity.", type = "D", experimental = true) 12 | public class AimD 13 | extends Check { 14 | 15 | public AimD(PlayerData data) { 16 | super(data); 17 | } 18 | 19 | @Override 20 | public void handle(Packet packet) { 21 | if (packet.isUseEntity()) { 22 | final RotationProcessor processor = data.getRotationProcessor(); 23 | 24 | final boolean cinematic = processor.isCinematic(); 25 | 26 | if(cinematic && data.getRotationProcessor().getSensitivity() < 0) 27 | return; 28 | 29 | final boolean attack = data.getCombatProcessor().getLastAttackTick() < 10; 30 | 31 | final float deltaYaw = processor.getDeltaYaw(); 32 | final float lastDeltaYaw = processor.getLastDeltaYaw(); 33 | final float deltaPitch = processor.getDeltaPitch(); 34 | 35 | final double divisorYaw = MathUtil.getGcd((long) (deltaYaw * MathUtil.EXPANDER), (long) (lastDeltaYaw * MathUtil.EXPANDER)); 36 | 37 | final double epik = data.getRotationProcessor().getGcd() / divisorYaw; 38 | debug("epik=" + epik); 39 | if (deltaYaw > 0.0 && deltaPitch > 0.0 && deltaYaw < 1 && deltaPitch < 1 && attack && !isExempt(ExemptType.CINEMATIC)) { 40 | if (epik > 9.9E-7) { 41 | if (buffer++ > 6) { 42 | buffer = 0; 43 | fail("epik=" + epik); 44 | } 45 | } else { 46 | decreaseBufferBy(2); 47 | } 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimE.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Aim", description = "Checks for snappy deltas.", type = "E") 10 | public final class AimE 11 | extends Check { 12 | private float lastDeltaYaw; 13 | private float lastLastDeltaYaw; 14 | 15 | public AimE(PlayerData data) { 16 | super(data); 17 | } 18 | 19 | @Override 20 | public void handle(Packet packet) { 21 | if (packet.isRotation()) { 22 | boolean invalid; 23 | float deltaYaw = this.data.getRotationProcessor().getDeltaYaw(); 24 | boolean exempt = this.isExempt(ExemptType.TELEPORT); 25 | boolean bl = invalid = deltaYaw < 1.5f && this.lastDeltaYaw > 30.0f && this.lastLastDeltaYaw < 1.5f; 26 | 27 | debug("deltaYaw: " + deltaYaw + "lastDeltaYaw: " +lastDeltaYaw+ "lastlast: " + lastLastDeltaYaw); 28 | 29 | if (exempt) { 30 | this.lastDeltaYaw = deltaYaw; 31 | this.lastLastDeltaYaw = deltaYaw; 32 | } 33 | if (invalid && !exempt && increaseBuffer() > 3) { 34 | fail(); 35 | 36 | this.lastLastDeltaYaw = this.lastDeltaYaw; 37 | this.lastDeltaYaw = deltaYaw; 38 | } 39 | } else { 40 | this.decreaseBufferBy(0.25); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimF.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | @CheckInfo(name = "Aim", description = "Checks for constant rots.", type = "F") 9 | public class AimF 10 | extends Check { 11 | public AimF(PlayerData data) { 12 | super(data); 13 | } 14 | 15 | 16 | @Override 17 | public void handle(Packet packet) { 18 | if(packet.isRotation()) { 19 | final float deltaYaw = Math.abs(data.getRotationProcessor().getDeltaYaw() % 360F); 20 | final float deltaPitch = Math.abs(data.getRotationProcessor().getDeltaPitch() % 360F); 21 | 22 | debug("Yaw:" + deltaYaw + " round: " + Math.round(deltaYaw) + " Pitch: " + deltaPitch + " round: " + Math.round(deltaPitch)); 23 | if (deltaYaw > 0.09) { 24 | if (deltaYaw == Math.round(deltaYaw)) { 25 | if (buffer++ > 4) { 26 | fail(deltaYaw + " round: " + Math.round(deltaYaw)); 27 | } 28 | } else { 29 | decreaseBufferBy(3); 30 | } 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimG.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | @CheckInfo(name = "Aim", description = "Checks for impossible ratio.", type = "G", experimental = true) 9 | public final class AimG extends Check { 10 | 11 | 12 | public AimG(final PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(final Packet packet) { 18 | if (packet.isRotation() && hitTicks() < 5) { 19 | 20 | final float deltaYaw = data.getRotationProcessor().getDeltaYaw(); 21 | final float deltaPitch = data.getRotationProcessor().getDeltaPitch(); 22 | 23 | final boolean invalid = deltaYaw > .5F && deltaPitch < .0001 && deltaPitch > 0; 24 | 25 | if (invalid) { 26 | if (increaseBuffer() > 4) { 27 | fail("deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch); 28 | } 29 | } else { 30 | 31 | decreaseBufferBy(.25); 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimH.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.MathUtil; 9 | 10 | @CheckInfo(name = "Aim", description = "Checks for invalid gcd rotations.", type = "H") 11 | public final class AimH 12 | extends Check { 13 | public AimH(PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(Packet packet) { 19 | if (packet.isRotation()) { 20 | float deltaPitch = this.data.getRotationProcessor().getDeltaPitch(); 21 | float lastDeltaPitch = this.data.getRotationProcessor().getLastDeltaPitch(); 22 | long expandedDeltaPitch = (long)((double)deltaPitch * MathUtil.EXPANDER); 23 | long expandedLastDeltaPitch = (long)((double)lastDeltaPitch * MathUtil.EXPANDER); 24 | long gcd = MathUtil.getGcd(expandedDeltaPitch, expandedLastDeltaPitch); 25 | boolean exempt = deltaPitch == 0.0f || lastDeltaPitch == 0.0f || this.isExempt(ExemptType.CINEMATIC); 26 | debug("gcd: " + gcd + "deltaPitch: " +deltaPitch+ "lastDeltaPitch: " + lastDeltaPitch + "expandDelta" +expandedDeltaPitch); 27 | if (!exempt && gcd < 131072L && gcd > 66000) { 28 | if (increaseBuffer() > 5) { 29 | fail(gcd); 30 | 31 | } 32 | } else { 33 | this.decreaseBufferBy(1.0); 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimI.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.data.processor.RotationProcessor; 7 | import dev.isnow.fox.exempt.type.ExemptType; 8 | import dev.isnow.fox.packet.Packet; 9 | import dev.isnow.fox.util.MathUtil; 10 | 11 | @CheckInfo(name = "Aim", description = "Checks for invalid gcd usage.", type = "I", experimental = true) 12 | public final class AimI extends Check { 13 | 14 | public AimI(final PlayerData data) { 15 | super(data); 16 | } 17 | 18 | @Override 19 | public void handle(Packet packet) { 20 | if (packet.isRotation() && System.currentTimeMillis() - data.getCombatProcessor().getLastAttack() <= 850) { 21 | final RotationProcessor processor = data.getRotationProcessor(); 22 | 23 | final float deltaYaw = processor.getDeltaYaw(); 24 | final float deltaPitch = processor.getDeltaPitch(); 25 | final float lastDeltaPitch = processor.getLastDeltaPitch(); 26 | 27 | final double divisorPitch = MathUtil.getGcd((long) (deltaPitch * MathUtil.EXPANDER), (long) (lastDeltaPitch * MathUtil.EXPANDER)); 28 | 29 | final double divisor = Math.abs(processor.getGcd() / divisorPitch); 30 | 31 | debug("divisor=" + divisor); 32 | 33 | if (deltaYaw > 0.0 && deltaPitch > 0.0 && deltaYaw < 2 && deltaPitch < 2) { 34 | 35 | final boolean exempt = isExempt(ExemptType.CINEMATIC); 36 | 37 | final boolean invalid = divisor > 5E-7 && !exempt; 38 | 39 | if (invalid) { 40 | if (buffer++ > 10) { 41 | fail(divisor); 42 | } 43 | } else { 44 | decreaseBufferBy(0.05); 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimL.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | import java.util.function.Predicate; 10 | 11 | @CheckInfo(name = "Aim", description = "Checks for precise aim.", type = "L", experimental = true) 12 | public final class AimL extends Check { 13 | 14 | private final Predicate validRotation = rotation -> rotation > 3F && rotation < 35F; 15 | 16 | public AimL(final PlayerData data) { 17 | super(data); 18 | } 19 | 20 | @Override 21 | public void handle(final Packet packet) { 22 | if(packet.isRotation()) { 23 | final float deltaPitch = Math.abs(data.getRotationProcessor().getDeltaPitch()); 24 | final float deltaYaw = Math.abs(data.getRotationProcessor().getDeltaYaw() % 360F); 25 | 26 | final float pitch = Math.abs(data.getRotationProcessor().getPitch()); 27 | 28 | final boolean invalidPitch = deltaPitch < 0.009 && validRotation.test(deltaYaw); 29 | final boolean invalidYaw = deltaYaw < 0.009 && validRotation.test(deltaPitch); 30 | 31 | final boolean exempt = isExempt(ExemptType.VEHICLE, ExemptType.TELEPORT); 32 | final boolean invalid = !exempt && (invalidPitch || invalidYaw) && pitch < 89F; 33 | final boolean overMaxSens = (data.getRotationProcessor().getSensitivity() > 100); 34 | 35 | debug(deltaYaw + " " + deltaPitch); 36 | 37 | if (invalid && !overMaxSens) { 38 | if (increaseBuffer() > 10) { 39 | fail(deltaYaw + " " + deltaPitch); 40 | } 41 | } else { 42 | decreaseBufferBy(1); 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimM.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | @CheckInfo(name = "Aim", description = "Checks for invalid deltas.", type = "M", experimental = true) 9 | public final class AimM extends Check { 10 | 11 | public AimM(final PlayerData data) { 12 | super(data); 13 | } 14 | 15 | @Override 16 | public void handle(final Packet packet) { 17 | if (packet.isRotation()) { 18 | final float deltaPitch = data.getRotationProcessor().getDeltaPitch(); 19 | final float deltaYaw = data.getRotationProcessor().getDeltaYaw(); 20 | 21 | final boolean invalid = deltaYaw == 0.0F && deltaPitch >= 20.0F; 22 | 23 | debug("deltaPitch: " + deltaPitch + "deltaYaw: " +deltaYaw); 24 | 25 | if (invalid) { 26 | if (increaseBuffer() > 3) { 27 | fail(); 28 | } 29 | } else { 30 | decreaseBufferBy(0.05); 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimN.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.data.processor.RotationProcessor; 7 | import dev.isnow.fox.exempt.type.ExemptType; 8 | import dev.isnow.fox.packet.Packet; 9 | import dev.isnow.fox.util.MathUtil; 10 | 11 | @CheckInfo(name = "Aim", description = "Checks for GCD bypasses.", type = "N", experimental = true) 12 | public class AimN extends Check { 13 | public AimN(PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(Packet packet) { 19 | if (packet.isRotation() && System.currentTimeMillis() - data.getCombatProcessor().getLastAttack() < 850) { 20 | final RotationProcessor processor = data.getRotationProcessor(); 21 | 22 | final float deltaPitch = processor.getDeltaPitch(); 23 | final float lastDeltaPitch = processor.getLastDeltaPitch(); 24 | 25 | if (deltaPitch > 1 && !isExempt(ExemptType.TELEPORT)) { 26 | final long expanded = (long) (deltaPitch * MathUtil.EXPANDER); 27 | final long lastExpanded = (long) (lastDeltaPitch * MathUtil.EXPANDER); 28 | 29 | final long gcd = MathUtil.getGcd(expanded, lastExpanded); 30 | 31 | final double divisor = gcd / MathUtil.EXPANDER; 32 | 33 | final double moduloPitch = Math.abs(processor.getPitch() % divisor); 34 | 35 | debug("modulo=" + moduloPitch); 36 | 37 | if (moduloPitch < 1.2E-5) { 38 | if (buffer++ > 3) { 39 | fail("modulo=" + moduloPitch); 40 | } 41 | } 42 | } else { 43 | decreaseBufferBy(0.5); 44 | } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimQ.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 8 | 9 | @CheckInfo(name = "Aim", description = "Checks for invalid yaw change", type = "Q") 10 | public class AimQ extends Check { 11 | 12 | public AimQ(PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(Packet packet) { 18 | if(packet.isUseEntity()) { 19 | WrappedPacketInUseEntity useEntityPacket = new WrappedPacketInUseEntity(packet.getRawPacket()); 20 | 21 | if (useEntityPacket.getAction() == WrappedPacketInUseEntity.EntityUseAction.ATTACK) { 22 | 23 | double pitch = Math.abs(data.getRotationProcessor().getPitch() - data.getRotationProcessor().getLastPitch()); 24 | double yaw = Math.abs(data.getRotationProcessor().getPitch() - data.getRotationProcessor().getLastPitch()); 25 | 26 | if (pitch > 3.0 && yaw < 0.0001D) { 27 | if (increaseBuffer() > 3) { 28 | fail(); 29 | } 30 | } else { 31 | decreaseBuffer(); 32 | } 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimR.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import dev.isnow.fox.util.MathUtil; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | @CheckInfo(name = "Aim", description = "Checks for invalid yaw movements.", type = "R") 13 | public class AimR extends Check { 14 | 15 | private double lastSTD; 16 | private double lastDeltaYaw; 17 | private final List deltaYawList = new ArrayList<>(); 18 | 19 | public AimR(PlayerData data) { 20 | super(data); 21 | } 22 | 23 | @Override 24 | public void handle(Packet packet) { 25 | if(packet.isPosition() && packet.isUseEntity()) { 26 | double yaw = MathUtil.wrapAngleTo180_float(data.getRotationProcessor().getYaw()); 27 | 28 | if (yaw > 150.0) { 29 | deltaYawList.add(yaw); 30 | 31 | if (deltaYawList.size() >= 25) { 32 | double std = MathUtil.getStandardDeviation(deltaYawList); 33 | 34 | 35 | if (std < 0.03 || Math.abs(std - lastSTD) < 0.001 && yaw > 155.0) { 36 | fail("STD: " + std + " size:" + deltaYawList.size() + " yaw:" + yaw); 37 | } 38 | 39 | 40 | lastSTD = std; 41 | deltaYawList.clear(); 42 | } 43 | } 44 | lastDeltaYaw = yaw; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aim/AimS.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aim; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | @CheckInfo(name = "Aim", type = "S", description = "Invalid rotation ratio") 9 | public class AimS extends Check { 10 | 11 | public AimS(final PlayerData data) { 12 | super(data); 13 | } 14 | 15 | @Override 16 | public void handle(final Packet packet) { 17 | 18 | if (packet.isRotation() && hitTicks() < 5) { 19 | 20 | final float deltaYaw = data.getRotationProcessor().getDeltaYaw(); 21 | final float deltaPitch = data.getRotationProcessor().getDeltaPitch(); 22 | final boolean invalid = deltaYaw > .5F && deltaPitch < .0001 && deltaPitch > 0; 23 | 24 | if (invalid) { 25 | if (increaseBuffer() > 4) { 26 | fail("deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch); 27 | } 28 | } else { 29 | decreaseBufferBy(.25); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraA.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import dev.isnow.fox.util.type.EvictingList; 8 | 9 | @CheckInfo(name = "Aura", type = "A", description = "Invalid USE ENTITY order.") 10 | public class AuraA extends Check { 11 | public AuraA(PlayerData data) { 12 | super(data); 13 | } 14 | 15 | private final EvictingList packetOrder = new EvictingList<>(3); 16 | 17 | @Override 18 | public void handle(Packet packet) { 19 | if (packet.isFlyingType() || packet.isUseEntityAttack() || packet.isTransaction()) { 20 | packetOrder.add(packet); 21 | 22 | if (packetOrder.size() == 3) { 23 | 24 | boolean flag = packetOrder.get(2).isTransaction() && 25 | packetOrder.get(1).isUseEntityAttack() && 26 | packetOrder.get(0).isFlyingType(); 27 | 28 | if (flag) 29 | fail(); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import dev.isnow.fox.util.type.EvictingList; 8 | 9 | @CheckInfo(name = "Aura", type = "B", description = "Invalid ARM ANIMATION order") 10 | public class AuraB extends Check { 11 | public AuraB(PlayerData data) { 12 | super(data); 13 | } 14 | 15 | private final EvictingList packetOrder = new EvictingList<>(3); 16 | 17 | @Override 18 | public void handle(Packet packet) { 19 | if (packet.isFlyingType() || packet.isArmAnimation() || packet.isTransaction()) { 20 | packetOrder.add(packet); 21 | 22 | if (packetOrder.size() == 3) { 23 | 24 | boolean flag = packetOrder.get(2).isTransaction() && 25 | packetOrder.get(1).isArmAnimation() && 26 | packetOrder.get(0).isFlyingType(); 27 | 28 | if (flag) 29 | fail(); 30 | } 31 | 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraC.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | @CheckInfo(name = "Aura", type = "C", description = "Missing ENTITY INTERACT packet") 9 | public class AuraC extends Check { 10 | public AuraC(PlayerData data) { 11 | super(data); 12 | } 13 | 14 | private boolean sentAttack, sentBlock, sentInteract; 15 | 16 | @Override 17 | public void handle(Packet packet) { 18 | if (packet.isBlockPlace()) { 19 | sentBlock = true; 20 | } else if (packet.isUseEntityAttack()) { 21 | sentAttack = true; 22 | } else if (packet.isUseEntityInteractAt() || packet.isUseEntityInteract()) { 23 | sentInteract = true; 24 | } else if (packet.isFlyingType()) { 25 | if (sentBlock && sentAttack && !sentInteract) { 26 | fail("Autoblock"); 27 | } 28 | sentAttack = false; 29 | sentBlock = false; 30 | sentInteract = false; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraD.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import dev.isnow.fox.util.PlayerUtil; 8 | 9 | @CheckInfo(name = "Aura", type = "D", description = "Invalid Sword Block Movement") 10 | public class AuraD extends Check { 11 | public AuraD(PlayerData data) { 12 | super(data); 13 | } 14 | 15 | private boolean blocked, stopSprint; 16 | 17 | //Fix, I think it falses when you block on the ground 18 | //It could also be caused by desync but I doubt that 19 | @Override 20 | public void handle(Packet packet) { 21 | if (PlayerUtil.isHoldingSword(data.getPlayer()) && data.getActionProcessor().isSprinting() && packet.isBlockPlace()) { 22 | blocked = true; 23 | } else if (packet.isStopSprinting()) { 24 | stopSprint = true; 25 | } else if (packet.isFlyingType()) { 26 | 27 | //if (blocked && !stopSprint) 28 | //flag(); 29 | blocked = false; 30 | stopSprint = false; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraE.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import dev.isnow.fox.util.type.EvictingList; 8 | 9 | @CheckInfo(name = "Aura", type = "E", description = "Invalid BLOCK PLACE order") 10 | public class AuraE extends Check { 11 | public AuraE(PlayerData data) { 12 | super(data); 13 | } 14 | 15 | private final EvictingList packetOrder = new EvictingList<>(3); 16 | 17 | @Override 18 | public void handle(Packet packet) { 19 | if (packet.isFlyingType() || packet.isBlockPlace() || packet.isTransaction()) { 20 | packetOrder.add(packet); 21 | 22 | if (packetOrder.size() == 3) { 23 | 24 | boolean flag = packetOrder.get(2).isTransaction() && 25 | packetOrder.get(1).isBlockPlace() && 26 | packetOrder.get(0).isFlyingType(); 27 | 28 | if (flag) 29 | fail(); 30 | } 31 | 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraF.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | @CheckInfo(name = "Aura", type = "F", description = "Invalid BLOCK PLACE & BLOCK DIG") 9 | public class AuraF extends Check { 10 | public AuraF(PlayerData data) { 11 | super(data); 12 | } 13 | 14 | private boolean blockPlaced, blockDigged, entityUsed; 15 | 16 | @Override 17 | public void handle(Packet packet) { 18 | if (packet.isFlyingType() || packet.isBlockPlace() || packet.isBlockDig() || packet.isUseEntity()) { 19 | if (packet.isBlockPlace()) { 20 | blockPlaced = true; 21 | } else if (packet.isBlockDig()) { 22 | blockDigged = true; 23 | } else if (packet.isUseEntity()) { 24 | entityUsed = true; 25 | } else if (packet.isFlyingType()) { 26 | if (blockDigged && blockPlaced && entityUsed) 27 | fail(); 28 | blockPlaced = false; 29 | blockDigged = false; 30 | entityUsed = false; 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraG.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import dev.isnow.fox.util.type.EvictingList; 8 | 9 | @CheckInfo(name = "Aura", type = "G", description = "Invalid BLOCK DIG order") 10 | public class AuraG extends Check { 11 | public AuraG(PlayerData data) { 12 | super(data); 13 | } 14 | 15 | private final EvictingList packetOrder = new EvictingList<>(3); 16 | 17 | @Override 18 | public void handle(Packet packet) { 19 | if (packet.isFlyingType() || packet.isBlockDig() || packet.isTransaction()) { 20 | packetOrder.add(packet); 21 | 22 | if (packetOrder.size() == 3) { 23 | 24 | boolean flag = packetOrder.get(2).isTransaction() && 25 | packetOrder.get(1).isBlockDig() && 26 | packetOrder.get(0).isFlyingType(); 27 | 28 | if (flag) 29 | fail(); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraH.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | @CheckInfo(name = "Aura", type = "H", description = "Missing ARM ANIMATION packet") 9 | public class AuraH extends Check { 10 | public AuraH(PlayerData data) { 11 | super(data); 12 | } 13 | 14 | private boolean armAnimation, useEntity; 15 | 16 | @Override 17 | public void handle(Packet packet) { 18 | if (packet.isArmAnimation()) { 19 | armAnimation = true; 20 | } else if (packet.isUseEntityAttack()) { 21 | useEntity = true; 22 | } else if (packet.isFlyingType()) { 23 | if (useEntity && !armAnimation) 24 | fail("No Swing"); 25 | armAnimation = false; 26 | useEntity = false; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraI.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 8 | import org.bukkit.entity.Entity; 9 | 10 | @CheckInfo(name = "Aura", type = "I", description = "Too many USE ENTITY") 11 | public class AuraI extends Check { 12 | public AuraI(PlayerData data) { 13 | super(data); 14 | } 15 | 16 | private Entity lastEntity; 17 | 18 | @Override 19 | public void handle(Packet packet) { 20 | if (packet.isUseEntityAttack()) { 21 | WrappedPacketInUseEntity useEntity = new WrappedPacketInUseEntity(packet.getRawPacket()); 22 | if (lastEntity != null && lastEntity != useEntity.getEntity()) 23 | fail("Multi Aura"); 24 | lastEntity = useEntity.getEntity(); 25 | } else if (packet.isFlyingType()) { 26 | lastEntity = null; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraJ.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import dev.isnow.fox.util.PlayerUtil; 8 | 9 | @CheckInfo(name = "Aura", type = "J", description = "Missing USE ENTITY Interact") 10 | public class AuraJ extends Check { 11 | public AuraJ(PlayerData data) { 12 | super(data); 13 | } 14 | 15 | private boolean sentInteract; 16 | private boolean sentInteractAt; 17 | 18 | @Override 19 | public void handle(Packet packet) { 20 | 21 | if (PlayerUtil.is1_7(data.getPlayer())) return; 22 | 23 | if (packet.isUseEntityInteractAt()) { 24 | sentInteract = true; 25 | } else if (packet.isUseEntityInteract()) { 26 | sentInteractAt = true; 27 | } else if (packet.isFlyingType()) { 28 | if (sentInteract != sentInteractAt) 29 | fail("Interact: " + sentInteract + "\n" + "Interact At:" + sentInteractAt); 30 | sentInteract = false; 31 | sentInteractAt = false; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraK.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | import java.math.BigDecimal; 9 | 10 | @CheckInfo(name = "Aura", type = "K", description = "Extremely Precise Strafe") 11 | public class AuraK extends Check { 12 | public AuraK(PlayerData data) { 13 | super(data); 14 | } 15 | 16 | private int sentLooks, buffer; 17 | BigDecimal previousAngle, bigDecimal; 18 | 19 | @Override 20 | public void handle(Packet packet) { 21 | if (packet.isLook() || packet.isPositionLook()) { 22 | sentLooks++; 23 | } 24 | if (packet.isPositionLook()) { 25 | 26 | previousAngle = bigDecimal; 27 | bigDecimal = BigDecimal.valueOf(Math.abs(data.getPositionProcessor().getLastMoveAngle())); 28 | 29 | if (sentLooks < 30 || previousAngle.equals(bigDecimal)) return; 30 | 31 | String moveAngle = bigDecimal + ""; 32 | 33 | if (moveAngle.contains("E") || moveAngle.equalsIgnoreCase("0.0")) { 34 | if ((buffer += 5) > 20) { 35 | fail(); 36 | buffer = Math.max(30, buffer); 37 | } 38 | } else { 39 | buffer = Math.max(0, buffer - 1); 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraL.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.blockplace.WrappedPacketInBlockPlace; 8 | import io.github.retrooper.packetevents.utils.player.Direction; 9 | 10 | @CheckInfo(name = "Aura", type = "L", description = "Invalid BLOCK PLACE face") 11 | public class AuraL extends Check { 12 | public AuraL(PlayerData data) { 13 | super(data); 14 | } 15 | 16 | private boolean sentBlock, sentUseEntity; 17 | 18 | @Override 19 | public void handle(Packet packet) { 20 | if (packet.isBlockPlace()) { 21 | sentBlock = true; 22 | if (sentUseEntity) { 23 | WrappedPacketInBlockPlace wrapper = new WrappedPacketInBlockPlace(packet.getRawPacket()); 24 | if (wrapper.getDirection() != Direction.OTHER) 25 | fail(); 26 | } 27 | } else if (packet.isUseEntity()) { 28 | sentUseEntity = true; 29 | } else if (packet.isFlyingType()) { 30 | sentBlock = false; 31 | sentUseEntity = false; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraM.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.TimeUtils; 9 | 10 | 11 | @CheckInfo(name = "Aura", type = "M", description = "Checks if pitch doesn't match angle") 12 | public class AuraM extends Check { 13 | 14 | public AuraM(PlayerData data) { 15 | super(data); 16 | } 17 | 18 | @Override 19 | public void handle(Packet packet) { 20 | if (packet.isPosLook()) { 21 | if (TimeUtils.elapsed(data.getCombatProcessor().getLastAttack()) <= 850L && !isExempt(ExemptType.TELEPORT)) { 22 | /* 23 | Lmao patches sigma, lb, impact HEHEHEHEHEHEHEHEEHEHHEEHEHHEHEHHEHEH 24 | */ 25 | 26 | if (data.getRotationProcessor().getPitch() == 0) { 27 | if (increaseBuffer() > 2) fail("0"); 28 | } else { 29 | decreaseBufferBy(0.25); 30 | } 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraN.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | @CheckInfo(name = "Aura", description = "Checks for invalid samples.", type = "N") 9 | 10 | public class AuraN extends Check { 11 | 12 | private int swings; 13 | private int hits; 14 | 15 | public AuraN(PlayerData data) { 16 | super(data); 17 | } 18 | 19 | @Override 20 | public void handle(Packet packet) { 21 | if (packet.getPacketId() == 43) { 22 | if (++this.swings >= 100) { 23 | if (this.hits > 85) { 24 | this.fail(swings); 25 | } 26 | 27 | this.swings = 0; 28 | this.hits = 0; 29 | } 30 | } else if (packet.getPacketId() == 14) { 31 | ++this.hits; 32 | } 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraO.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | @CheckInfo(name = "Aura", description = "Checks for impossible accuracy.", type = "O", experimental = true) 9 | 10 | public final class AuraO extends Check { 11 | 12 | public AuraO(PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(final Packet packet) { 18 | if(packet.isUseEntity()) { 19 | final boolean invalid = data.getCombatProcessor().getHitMissRatio() > 99 && 20 | data.getRotationProcessor().getDeltaYaw() > 1.5F && 21 | data.getRotationProcessor().getDeltaPitch() > 0 && 22 | data.getPositionProcessor().getDeltaXZ() > 0.1; 23 | 24 | if (invalid) { 25 | if (increaseBuffer() > 25) { 26 | fail(data.getCombatProcessor().getHitMissRatio()); 27 | } 28 | } else { 29 | decreaseBufferBy(2); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraP.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import dev.isnow.fox.util.PlayerUtil; 8 | import org.bukkit.entity.Entity; 9 | import org.bukkit.entity.Player; 10 | 11 | @CheckInfo(name = "Aura", type = "P", description = "Checks for invalid acceleration.") 12 | public final class AuraP extends Check { 13 | public AuraP(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | if (packet.isFlying() && hitTicks() < 2) { 20 | final Entity target = data.getCombatProcessor().getTarget(); 21 | 22 | final double deltaXZ = data.getPositionProcessor().getDeltaXZ(); 23 | final double lastDeltaXZ = data.getPositionProcessor().getLastDeltaXZ(); 24 | 25 | final double baseSpeed = PlayerUtil.getBaseSpeed(data.getPlayer(), 0.22F); 26 | final boolean sprinting = data.getActionProcessor().isSprinting(); 27 | 28 | final double acceleration = Math.abs(deltaXZ - lastDeltaXZ); 29 | 30 | final boolean exempt = !(target instanceof Player); 31 | final boolean invalid = acceleration < 0.0027 && sprinting && deltaXZ > baseSpeed; 32 | 33 | debug("deltaXZ: " + deltaXZ + "accel: " +acceleration+ "lastDelta: " + lastDeltaXZ); 34 | 35 | if (invalid && !exempt) { 36 | if (increaseBuffer() > 3) { 37 | fail(); 38 | } 39 | } else { 40 | decreaseBufferBy(0.05); 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraQ.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 8 | 9 | @CheckInfo(name = "Aura", type = "Q", description = "Attacked two entities at once.") 10 | public class AuraQ extends Check { 11 | 12 | private int ticks, lastEntityId; 13 | 14 | public AuraQ(final PlayerData data) { 15 | super(data); 16 | } 17 | 18 | @Override 19 | public void handle(final Packet packet) { 20 | if (packet.isUseEntity()) { 21 | 22 | final WrappedPacketInUseEntity wrapper = new WrappedPacketInUseEntity(packet.getRawPacket()); 23 | 24 | check: { 25 | 26 | if (wrapper.getAction() != WrappedPacketInUseEntity.EntityUseAction.ATTACK) break check; 27 | 28 | if (wrapper.getEntityId() != lastEntityId) { 29 | if (++ticks > 1) { 30 | fail(); 31 | } 32 | } 33 | lastEntityId = wrapper.getEntityId(); 34 | } 35 | } else if (packet.isFlying()) { 36 | ticks = 0; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraR.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | 8 | @CheckInfo(name = "Aura", description = "Checks for values that match auras.", type = "R", experimental = true) 9 | public class AuraR extends Check { 10 | 11 | private int ticks, invalidTicks, lastTicks, totalTicks; 12 | 13 | public AuraR(PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | if (packet.isFlying()) { 20 | ++ticks; 21 | } else if (packet.isUseEntity()) { 22 | if (ticks <= 8) { 23 | if (lastTicks == ticks) { 24 | ++invalidTicks; 25 | } 26 | 27 | if (++totalTicks >= 25) { 28 | if (invalidTicks > 22) { 29 | fail(); 30 | } 31 | 32 | totalTicks = 0; 33 | invalidTicks = 0; 34 | } 35 | 36 | lastTicks = ticks; 37 | } 38 | 39 | ticks = 0; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraS.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.entityaction.WrappedPacketInEntityAction; 8 | 9 | @CheckInfo(name = "Aura", type = "S", description = "Checks for invalid sprinting orders. (S-TAP Detection)") 10 | public final class AuraS extends Check { 11 | public AuraS(final PlayerData data) { 12 | super(data); 13 | } 14 | 15 | @Override 16 | public void handle(final Packet packet) { 17 | if (packet.isEntityAction()) { 18 | final WrappedPacketInEntityAction wrapper = new WrappedPacketInEntityAction(packet.getRawPacket()); 19 | 20 | final boolean sprinting = wrapper.getAction() == WrappedPacketInEntityAction.PlayerAction.START_SPRINTING 21 | || wrapper.getAction() == WrappedPacketInEntityAction.PlayerAction.STOP_SPRINTING; 22 | 23 | if (sprinting) { 24 | if (increaseBuffer() > 1) { 25 | fail(); 26 | } 27 | } 28 | } else if (packet.isFlying()) { 29 | resetBuffer(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraT.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 8 | import org.bukkit.entity.Entity; 9 | 10 | @CheckInfo(name = "Aura", description = "Checks for switch auras.", type = "T") 11 | public final class AuraT extends Check { 12 | 13 | public AuraT(PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | if (packet.isUseEntity()) { 20 | final WrappedPacketInUseEntity wrapper = new WrappedPacketInUseEntity(packet.getRawPacket()); 21 | 22 | if (wrapper.getAction() == WrappedPacketInUseEntity.EntityUseAction.ATTACK) { 23 | final Entity target = data.getCombatProcessor().getTarget(); 24 | final Entity lastTarget = data.getCombatProcessor().getLastTarget(); 25 | 26 | final boolean exempt = target == lastTarget; 27 | 28 | if (!exempt) { 29 | if (increaseBuffer() > 1) { 30 | fail(); 31 | } 32 | } 33 | } 34 | } else if (packet.isFlying()) { 35 | resetBuffer(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraU.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 8 | import org.bukkit.entity.EntityType; 9 | 10 | @CheckInfo(name = "Aura", description = "Checks for invalid hit-swings.", type = "U") 11 | 12 | public class AuraU extends Check { 13 | private int swings; 14 | private int hits; 15 | 16 | public AuraU(PlayerData data) { 17 | super(data); 18 | } 19 | 20 | public void handle(Packet packet) { 21 | if (packet.isReceiving()) { 22 | if (packet.getPacketId() == 43) { 23 | ++this.swings; 24 | if (this.swings >= 100) { 25 | if (this.hits > 75) { 26 | this.fail(); 27 | } 28 | 29 | this.swings = 0; 30 | this.hits = 0; 31 | } 32 | } else if (packet.getPacketId() == 14) { 33 | WrappedPacketInUseEntity wrappedPacketInUseEntity = new WrappedPacketInUseEntity(packet.getRawPacket()); 34 | if (wrappedPacketInUseEntity.getEntity().getType() == EntityType.PLAYER) { 35 | ++this.hits; 36 | } 37 | } 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/aura/AuraV.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.aura; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 8 | 9 | @CheckInfo(name = "Aura", type = "V", description = "Invalid post useEntity.") 10 | public class AuraV extends Check { 11 | 12 | private long lastFlying; 13 | private boolean sent; 14 | 15 | public AuraV(final PlayerData data) { 16 | super(data); 17 | } 18 | 19 | @Override 20 | public void handle(final Packet packet) { 21 | if (packet.isFlying()) { 22 | final long now = System.currentTimeMillis(); 23 | final long delay = now - lastFlying; 24 | 25 | if (sent) { 26 | if (delay > 40L && delay < 100L) { 27 | if (increaseBuffer() > 3) { 28 | fail("delay=" + delay); 29 | } 30 | } else { 31 | decreaseBufferBy(.125); 32 | } 33 | sent = false; 34 | } 35 | 36 | lastFlying = now; 37 | } else if (packet.isUseEntity()) { 38 | final WrappedPacketInUseEntity wrapper = new WrappedPacketInUseEntity(packet.getRawPacket()); 39 | 40 | check: { 41 | if (wrapper.getAction() != WrappedPacketInUseEntity.EntityUseAction.ATTACK) break check; 42 | final long delay = System.currentTimeMillis()- lastFlying; 43 | if (delay < 10) { 44 | sent = true; 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerA.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import io.github.retrooper.packetevents.utils.player.ClientVersion; 9 | import lombok.val; 10 | 11 | @CheckInfo(name = "AutoClicker", type = "A", description = "Checks for concurrent clicks") 12 | public class AutoClickerA extends Check { 13 | private long lastSwing, lastDelay; 14 | 15 | public AutoClickerA(PlayerData data) { 16 | super(data); 17 | } 18 | 19 | @Override 20 | public void handle(Packet packet) { 21 | if (packet.isArmAnimation() && !isExempt(ExemptType.AUTOCLICKER)) { 22 | if(data.getVersion().isNewerThanOrEquals(ClientVersion.v_1_8)) { // Doesn't work in 1.7 since no click delay 23 | val now = System.currentTimeMillis(); 24 | val delay = now - this.lastSwing; 25 | if (delay > 10L && delay < 200 && data.getClickProcessor().getCps() >= 7) { 26 | if (Math.abs(delay - this.lastDelay) > 50L) { 27 | buffer = 0; 28 | } else if (delay > 35L && buffer++ > 80) { 29 | fail("Delay: " + delay); 30 | } 31 | this.lastDelay = delay; 32 | } 33 | this.lastSwing = now; 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | 4 | import dev.isnow.fox.check.Check; 5 | import dev.isnow.fox.check.api.CheckInfo; 6 | import dev.isnow.fox.data.PlayerData; 7 | import dev.isnow.fox.exempt.type.ExemptType; 8 | import dev.isnow.fox.packet.Packet; 9 | import dev.isnow.fox.util.MathUtil; 10 | import dev.isnow.fox.util.type.EvictingList; 11 | 12 | @CheckInfo(name = "AutoClicker", type = "B", description = "Checks the outliers on your clicks") 13 | public class AutoClickerB extends Check { 14 | 15 | private final EvictingList tickList = new EvictingList<>(30); 16 | private double lastDeviation; 17 | private int tick; 18 | 19 | public AutoClickerB(final PlayerData data) { 20 | super(data); 21 | } 22 | 23 | @Override 24 | public void handle(final Packet packet) { 25 | if (packet.isArmAnimation()) { 26 | final boolean exempt = isExempt(ExemptType.DROP, ExemptType.AUTOCLICKER); 27 | if (!exempt) tickList.add((long) (tick * 50.0)); 28 | 29 | if (tickList.isFull()) { 30 | final double deviation = MathUtil.getStandardDeviation(tickList); 31 | final double difference = Math.abs(deviation - lastDeviation); 32 | 33 | final boolean invalid = difference < 6; 34 | 35 | debug("diff: " +deviation+ "devi: " +deviation); 36 | 37 | if (invalid && !exempt) { 38 | if (increaseBuffer() > 15) { 39 | fail(deviation); 40 | } 41 | } else { 42 | decreaseBuffer(); 43 | } 44 | 45 | lastDeviation = deviation; 46 | } 47 | } else if (packet.isFlying()) { 48 | tick++; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerC.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "AutoClicker", type = "C", description = "Checks for consistent click pattern") 10 | public class AutoClickerC extends Check { 11 | 12 | private double avgSpeed, avgDeviation; 13 | private int ticks; 14 | 15 | 16 | public AutoClickerC(PlayerData data) { 17 | super(data); 18 | } 19 | 20 | @Override 21 | public void handle(Packet packet) { 22 | if (packet.isArmAnimation() && !isExempt(ExemptType.AUTOCLICKER)) { 23 | if (ticks > 10 || ticks == 0) { 24 | return; 25 | } 26 | double speed = ticks * 50; 27 | avgSpeed = ((avgSpeed * 14) + speed) / 15; 28 | 29 | double deviation = Math.abs(speed - avgSpeed); 30 | avgDeviation = ((avgDeviation * 9) + deviation) / 10; 31 | 32 | if (avgDeviation < 10) { 33 | if (++buffer > 8) { 34 | fail("dev=" + deviation); 35 | decreaseBufferBy(3); 36 | } 37 | } else { 38 | buffer *= 0.75; 39 | } 40 | ticks = 0;//brb 41 | } else if (packet.isFlying()) { 42 | ticks++; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerD.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 9 | 10 | @CheckInfo(name = "AutoClicker", description = "Checks for high click speed.", type = "D") 11 | public final class AutoClickerD extends Check { 12 | 13 | private int ticks, cps; 14 | 15 | public AutoClickerD(final PlayerData data) { 16 | super(data); 17 | } 18 | 19 | @Override 20 | public void handle(final Packet packet) { 21 | if (packet.isFlying()) { 22 | if (++ticks >= 20) { 23 | debug("cps=" + cps); 24 | if (cps > 26 && !isExempt(ExemptType.AUTOCLICKER)) { 25 | fail("cps=" + cps); 26 | } 27 | ticks = cps = 0; 28 | } 29 | } else if (packet.isUseEntity()) { 30 | final WrappedPacketInUseEntity wrapper = new WrappedPacketInUseEntity(packet.getRawPacket()); 31 | if (wrapper.getAction() == WrappedPacketInUseEntity.EntityUseAction.ATTACK) { 32 | ++cps; 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerE.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.MathUtil; 9 | 10 | import java.util.ArrayDeque; 11 | import java.util.Deque; 12 | 13 | @CheckInfo(name = "AutoClicker", type = "E", description = "Checks if stats match") 14 | public class AutoClickerE extends Check { 15 | private final Deque samples = new ArrayDeque<>(); 16 | private double lastKurtosis, lastSkewness, lastDeviation; 17 | private int ticks; 18 | public AutoClickerE(PlayerData data) { 19 | super(data); 20 | } 21 | 22 | @Override 23 | public void handle(Packet packet) { 24 | if (packet.isArmAnimation() && !isExempt(ExemptType.AUTOCLICKER) && ticks != 0) { 25 | if (ticks > 50) samples.clear(); 26 | else samples.add(ticks * 50L); 27 | 28 | if (samples.size() == 30) { 29 | final double deviation = MathUtil.getStandardDeviation(samples); 30 | final double skewness = MathUtil.getSkewness(samples); 31 | final double kurtosis = MathUtil.getKurtosis(samples); 32 | 33 | final boolean invalid = deviation == lastDeviation && skewness == lastSkewness && kurtosis == lastKurtosis; 34 | 35 | if (invalid) { 36 | if (increaseBuffer() > 3) { 37 | fail(); 38 | } 39 | } else { 40 | resetBuffer(); 41 | } 42 | 43 | lastDeviation = deviation; 44 | lastSkewness = skewness; 45 | lastKurtosis = kurtosis; 46 | 47 | samples.clear(); 48 | } 49 | 50 | ticks = 0; 51 | }else if (packet.isFlying()) { 52 | ticks++; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerF.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | 4 | import dev.isnow.fox.check.Check; 5 | import dev.isnow.fox.check.api.CheckInfo; 6 | import dev.isnow.fox.data.PlayerData; 7 | import dev.isnow.fox.exempt.type.ExemptType; 8 | import dev.isnow.fox.packet.Packet; 9 | import dev.isnow.fox.util.MathUtil; 10 | 11 | import java.util.ArrayDeque; 12 | import java.util.Deque; 13 | 14 | @CheckInfo(name = "AutoClicker", type = "F", description = "Checks for invalid kurtosis") 15 | public class AutoClickerF extends Check { 16 | private final Deque samples = new ArrayDeque<>(); 17 | private int ticks; 18 | 19 | public AutoClickerF(PlayerData data) { 20 | super(data); 21 | } 22 | 23 | @Override 24 | public void handle(Packet packet) { 25 | if (packet.isArmAnimation() && !isExempt(ExemptType.AUTOCLICKER)) { 26 | if (ticks > 50 || ticks == 0) samples.clear(); 27 | else samples.add(ticks * 50); 28 | 29 | if (samples.size() == 30) { 30 | final double kurtosis = MathUtil.getKurtosis(samples); 31 | 32 | final boolean invalid = Double.isNaN(kurtosis); 33 | 34 | debug(invalid); 35 | if (invalid) { 36 | if (increaseBuffer() > 1) { 37 | fail("kurtosis=" + kurtosis); 38 | } 39 | } else { 40 | resetBuffer(); 41 | } 42 | 43 | samples.clear(); 44 | } 45 | 46 | ticks = 0; 47 | } else if (packet.isFlying()) { 48 | ticks++; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerG.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.MathUtil; 9 | import dev.isnow.fox.util.type.Pair; 10 | 11 | import java.util.ArrayDeque; 12 | import java.util.List; 13 | 14 | @CheckInfo(name = "AutoClicker", type = "G", description = "Checks for outliers and high dupl", experimental = true) 15 | public class AutoClickerG extends Check { 16 | private final ArrayDeque samples = new ArrayDeque<>(); 17 | private int ticks; 18 | 19 | public AutoClickerG(PlayerData data) { 20 | super(data); 21 | } 22 | 23 | @Override 24 | public void handle(Packet packet) { 25 | if (packet.isArmAnimation()) { 26 | final boolean digging = isExempt(ExemptType.AUTOCLICKER); 27 | if (ticks < 4 && data.getClickProcessor().getCps() > 10 && !digging && ticks != 0) { 28 | samples.add(ticks); 29 | } 30 | if (samples.size() == 20) { 31 | final Pair, List> outlierPair = MathUtil.getOutliers(samples); 32 | 33 | final int outliers = outlierPair.getX().size() + outlierPair.getY().size(); 34 | final int duplicates = (int) (samples.size() - samples.stream().distinct().count()); 35 | debug("outliers=" + outliers + ", dupl=" + duplicates); 36 | if (outliers < 2 && duplicates > 16) { 37 | if ((buffer += 10) > 50) { 38 | fail("outliers=" + outliers + ", duplicates=" + duplicates); 39 | } 40 | } else { 41 | buffer = Math.max(buffer - 15, 0); 42 | } 43 | samples.clear(); 44 | } 45 | ticks = 0; 46 | } else if (packet.isFlying()) { 47 | ticks++; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerH.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.MathUtil; 9 | 10 | import java.util.ArrayDeque; 11 | 12 | @CheckInfo(name = "AutoClicker", type = "H", description = "Checks for poor randomization", experimental = true) 13 | public class AutoClickerH extends Check { 14 | private final ArrayDeque samples = new ArrayDeque<>(); 15 | private double lastDeviation; 16 | 17 | private int ticks; 18 | 19 | 20 | public AutoClickerH(PlayerData data) { 21 | super(data); 22 | } 23 | 24 | @Override 25 | public void handle(Packet packet) { 26 | if (packet.isArmAnimation() && !isExempt(ExemptType.AUTOCLICKER) && ticks != 0) { 27 | samples.add(ticks); 28 | 29 | if (samples.size() == 30) { 30 | final double deviation = MathUtil.getStandardDeviation(samples); 31 | final double difference = Math.abs(deviation - lastDeviation); 32 | 33 | final boolean invalid = difference < 0.5; 34 | 35 | debug("std=" + difference); 36 | if (invalid) { 37 | if (increaseBuffer() > 5) { 38 | fail("deviation=" + deviation + " difference=" + difference); 39 | } 40 | } else { 41 | decreaseBufferBy(2); 42 | } 43 | 44 | lastDeviation = deviation; 45 | 46 | samples.clear(); 47 | } 48 | ticks = 0; 49 | } else if (packet.isFlying()) { 50 | ticks++; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerI.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.MathUtil; 9 | 10 | import java.util.ArrayDeque; 11 | 12 | @CheckInfo(name = "AutoClicker", type = "I", description = "Checks for low debounce time", experimental = true) 13 | public class AutoClickerI extends Check { 14 | private final ArrayDeque samples = new ArrayDeque<>(); 15 | private int ticks; 16 | public AutoClickerI(PlayerData data) { 17 | super(data); 18 | } 19 | 20 | @Override 21 | public void handle(Packet packet) { 22 | if (packet.isArmAnimation() && !isExempt(ExemptType.AUTOCLICKER)) { 23 | if (ticks < 4 && data.getClickProcessor().getCps() > 8 && ticks != 0) { 24 | samples.add(ticks); 25 | } 26 | 27 | if (samples.size() == 30) { 28 | final double std = MathUtil.getStandardDeviation(samples); 29 | final double skewness = MathUtil.getSkewness(samples); 30 | 31 | String debug = String.format( 32 | "skewness=%.2f, std=%.2f, buffer=%.2f, cps=%.2f", 33 | skewness, std, buffer, data.getClickProcessor().getCps() 34 | ); 35 | 36 | debug(debug); 37 | 38 | if (skewness < 0 && std < 3) { 39 | if (buffer++ > 4) { 40 | fail(debug); 41 | } 42 | } else { 43 | resetBuffer(); 44 | } 45 | samples.clear(); 46 | } 47 | 48 | ticks = 0; 49 | } else if (packet.isFlying()) { 50 | ticks++; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerJ.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.MathUtil; 9 | import dev.isnow.fox.util.type.Pair; 10 | 11 | import java.util.ArrayDeque; 12 | import java.util.List; 13 | 14 | //Copied from https://github.com/ElevatedDev/Frequency/blob/master/src/main/java/xyz/elevated/frequency/check/impl/autoclicker/AutoClickerC.java 15 | @CheckInfo(name = "AutoClicker", type = "J", description = "Checks for low patterns") 16 | public class AutoClickerJ extends Check { 17 | 18 | public AutoClickerJ(PlayerData data) { 19 | super(data); 20 | } 21 | 22 | private int ticks; 23 | 24 | private final ArrayDeque samples = new ArrayDeque<>(); 25 | 26 | @Override 27 | public void handle(Packet packet) { 28 | if (packet.isArmAnimation()) { 29 | final boolean valid = ticks < 4 && !isExempt(ExemptType.AUTOCLICKER) && ticks != 0; 30 | if(valid) samples.add(ticks); 31 | 32 | if(samples.size() == 15) { 33 | final Pair, List> outlierPair = MathUtil.getOutliers(samples); 34 | 35 | final double skewness = MathUtil.getSkewness(samples); 36 | final double kurtosis = MathUtil.getKurtosis(samples); 37 | final double outliers = outlierPair.getX().size() + outlierPair.getY().size(); 38 | 39 | String debug = String.format( 40 | "sk=%.2f, ku=%.2f, ou=%.2f", 41 | skewness, kurtosis, outliers 42 | ); 43 | 44 | debug(debug); 45 | 46 | if (skewness < 0.75 && kurtosis < 0.0 && outliers < 2) { 47 | if (++buffer > 1) { 48 | fail(debug); 49 | } 50 | } else { 51 | buffer = 0; 52 | } 53 | 54 | samples.clear(); 55 | } 56 | 57 | ticks = 0; 58 | } else if (packet.isFlying()) { 59 | ticks++; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerK.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import com.google.common.collect.Lists; 4 | import dev.isnow.fox.check.Check; 5 | import dev.isnow.fox.check.api.CheckInfo; 6 | import dev.isnow.fox.data.PlayerData; 7 | import dev.isnow.fox.exempt.type.ExemptType; 8 | import dev.isnow.fox.packet.Packet; 9 | import dev.isnow.fox.util.MathUtil; 10 | import dev.isnow.fox.util.type.Pair; 11 | 12 | import java.util.Deque; 13 | import java.util.List; 14 | 15 | @CheckInfo(name = "AutoClicker", type = "K", description = "Checks for rounded cps") 16 | public class AutoClickerK extends Check { 17 | public AutoClickerK(PlayerData data) { 18 | super(data); 19 | } 20 | 21 | private final Deque samples = Lists.newLinkedList(); 22 | 23 | 24 | private int ticks; 25 | 26 | @Override 27 | public void handle(Packet packet) { 28 | if(packet.isArmAnimation()) { 29 | final boolean valid = ticks < 4 && !isExempt(ExemptType.AUTOCLICKER) && ticks != 0; 30 | 31 | if(valid) samples.add(ticks); 32 | 33 | if(samples.size() == 15) { 34 | final Pair, List> outlierPair = MathUtil.getOutliers(samples); 35 | 36 | // Get the deviation outliers the the cps from the math util 37 | final double deviation = MathUtil.getStandardDeviation(samples); 38 | final double outliers = outlierPair.getX().size() + outlierPair.getY().size(); 39 | final double cps = data.getClickProcessor().getCps(); 40 | 41 | final String debug = String.format( 42 | "deviation=%.2f, outliers=%.2f, cps%.2f", 43 | deviation, outliers, cps 44 | ); 45 | 46 | debug(debug); 47 | 48 | if (deviation < 0.3 && outliers < 2 && cps % 1.0 == 0.0) { 49 | buffer += 0.25; 50 | 51 | if (buffer > 0.75) { 52 | fail(debug); 53 | } 54 | } else { 55 | buffer = Math.max(buffer - 0.2, 0); 56 | } 57 | 58 | samples.clear(); 59 | } 60 | 61 | ticks = 0; 62 | } else if(packet.isFlying()) { 63 | ticks++; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerL.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import com.google.common.collect.Lists; 4 | import dev.isnow.fox.check.Check; 5 | import dev.isnow.fox.check.api.CheckInfo; 6 | import dev.isnow.fox.data.PlayerData; 7 | import dev.isnow.fox.exempt.type.ExemptType; 8 | import dev.isnow.fox.packet.Packet; 9 | import dev.isnow.fox.util.MathUtil; 10 | import dev.isnow.fox.util.type.Pair; 11 | 12 | import java.util.Deque; 13 | import java.util.List; 14 | 15 | @CheckInfo(name = "AutoClicker", type = "L", description = "Checks for abnormal clicking") 16 | public class AutoClickerL extends Check { 17 | public AutoClickerL(PlayerData data) { 18 | super(data); 19 | } 20 | 21 | private int movements = 0; 22 | private final Deque samples = Lists.newLinkedList(); 23 | 24 | @Override 25 | public void handle(Packet packet) { 26 | if (packet.isArmAnimation()) { 27 | final boolean valid = movements < 4 && !isExempt(ExemptType.AUTOCLICKER) && movements != 0; 28 | 29 | if (valid) samples.add(movements); 30 | 31 | // Sample size is assigned to 15 32 | if (samples.size() == 15) { 33 | final Pair, List> outlierPair = MathUtil.getOutliers(samples); 34 | 35 | final double skewness = MathUtil.getSkewness(samples); 36 | final double kurtosis = MathUtil.getKurtosis(samples); 37 | final double outliers = outlierPair.getX().size() + outlierPair.getY().size(); 38 | 39 | String debug = String.format( 40 | "sk=%.2f, ku=%.2f, ou=%.2f", 41 | skewness, kurtosis, outliers 42 | ); 43 | debug(debug); 44 | 45 | // See if skewness and kurtosis is exceeding a specific limit. 46 | if (skewness < 0.035 && kurtosis < 0.1 && outliers < 2) fail(debug); 47 | 48 | samples.clear(); 49 | } 50 | movements = 0; 51 | } else if (packet.isFlying()) { 52 | ++movements; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/autoclicker/AutoClickerM.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.autoclicker; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.MathUtil; 9 | import dev.isnow.fox.util.type.Pair; 10 | 11 | import java.util.ArrayDeque; 12 | import java.util.List; 13 | 14 | 15 | @CheckInfo(name = "AutoClicker", experimental = true, description = "Checks for invalid consistency while clicking.", type = "M") 16 | public final class AutoClickerM extends Check { 17 | 18 | private final ArrayDeque samples = new ArrayDeque<>(); 19 | private int ticks; 20 | 21 | public AutoClickerM(final PlayerData data) { 22 | super(data); 23 | } 24 | 25 | @Override 26 | public void handle(final Packet packet) { 27 | if (packet.isArmAnimation() && !isExempt(ExemptType.AUTOCLICKER)) { 28 | if (ticks < 4) { 29 | samples.add(ticks); 30 | } 31 | 32 | if (samples.size() == 20) { 33 | final Pair, List> outlierPair = MathUtil.getOutliers(samples); 34 | 35 | final int outliers = outlierPair.getX().size() + outlierPair.getY().size(); 36 | final int duplicates = (int) (samples.size() - samples.stream().distinct().count()); 37 | 38 | debug("outliers=" + outliers + " dupl=" + duplicates); 39 | 40 | if (outliers < 3 && duplicates > 18) { 41 | if ((buffer += 20) > 60) { 42 | fail("outliers=" + outliers + " dupl=" + duplicates); 43 | } 44 | } else { 45 | buffer = Math.max(buffer - 8, 0); 46 | } 47 | samples.clear(); 48 | } 49 | 50 | ticks = 0; 51 | } else if (packet.isFlying()) { 52 | ++ticks; 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/hitbox/HitBoxB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.hitbox; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 8 | import org.bukkit.entity.Player; 9 | 10 | @CheckInfo(name = "HitBox", experimental = true, description = "Checks for hitting outside the entity hitbox.", type = "B") 11 | public final class HitBoxB extends Check { 12 | 13 | public HitBoxB(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(Packet packet) { 19 | if (packet.isUseEntityInteractAt()) { 20 | WrappedPacketInUseEntity interactAt = new WrappedPacketInUseEntity(packet.getRawPacket()); 21 | if (interactAt.getEntity() instanceof Player) { 22 | if (Math.abs(interactAt.getTarget().get().x) > 0.400001 || Math.abs(interactAt.getTarget().get().z) > 0.400001) { 23 | fail("x:" + Math.abs(interactAt.getTarget().get().x) + " z:" + Math.abs(interactAt.getTarget().get().z)); 24 | } 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/combat/velocity/VelocityA.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.combat.velocity; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Velocity", type = "A", description = "Checks for invalid vertical.") 10 | public final class VelocityA extends Check { 11 | public VelocityA(final PlayerData data) { 12 | super(data); 13 | } 14 | 15 | @Override 16 | public void handle(final Packet packet) { 17 | if (packet.isFlying()) { 18 | final int ticksSinceVelocity = data.getVelocityProcessor().getTicksSinceVelocity(); 19 | if (ticksSinceVelocity != 1) return; 20 | 21 | final double deltaY = data.getPositionProcessor().getDeltaY(); 22 | final double expectedDeltaY = data.getVelocityProcessor().getVelocityY(); 23 | 24 | final double difference = Math.abs(deltaY - expectedDeltaY); 25 | final double percentage = (deltaY * 100.0) / expectedDeltaY; 26 | 27 | final boolean exempt = isExempt(ExemptType.LIQUID, ExemptType.PISTON, ExemptType.CLIMBABLE, 28 | ExemptType.UNDERBLOCK, ExemptType.TELEPORT, ExemptType.FLYING, ExemptType.JUMP, ExemptType.NEAR_WALL); 29 | final boolean invalid = difference > 1E-10 && expectedDeltaY > 1E-2; 30 | 31 | if (invalid && !exempt) { 32 | if (increaseBuffer() > 2) { 33 | fail(); 34 | } 35 | } else { 36 | decreaseBufferBy(0.25); 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/flight/FlightA.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.flight; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Flight", type = "A", description = "Predicts invalid movements.") 10 | public final class FlightA extends Check { 11 | 12 | public FlightA(final PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(Packet packet) { 18 | if (packet.isPosition()) { 19 | final double deltaY = data.getPositionProcessor().getDeltaY(); 20 | final double lastdeltaY = data.getPositionProcessor().getLastDeltaY(); 21 | 22 | final boolean onGround = data.getPositionProcessor().getClientAirTicks() < 3 || data.getPositionProcessor().getAirTicks() < 4; 23 | 24 | final double prediction = Math.abs((lastdeltaY - 0.08) * 0.9800000190734863F) < 0.005 ? -0.08 * 0.9800000190734863F : (lastdeltaY - 0.08) * 0.9800000190734863F; 25 | final double difference = Math.abs(deltaY - prediction); 26 | 27 | final boolean exempt = isExempt(ExemptType.CHUNK, 28 | ExemptType.CLIMBABLE, 29 | ExemptType.FLYING, 30 | ExemptType.VELOCITY_ON_TICK, 31 | ExemptType.LIQUID, 32 | ExemptType.SLIME, 33 | ExemptType.TELEPORT_DELAY, 34 | ExemptType.NEARSTAIRS); 35 | final boolean invalid = !exempt && difference > 0.001D && !onGround; 36 | 37 | debug("posY=" + data.getPositionProcessor().getY() + " dY=" + deltaY + " at=" + onGround); 38 | 39 | if (invalid) { 40 | if (increaseBuffer() > 5) { 41 | fail(prediction); 42 | } 43 | } else { 44 | decreaseBufferBy(1); 45 | } 46 | 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/flight/FlightB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.flight; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Flight", type = "B", description = "Checks for invalid gravity.") 10 | public final class FlightB extends Check { 11 | private double minDelta; 12 | 13 | public FlightB(PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(Packet packet) { 19 | if (packet.isPosition()) { 20 | if (this.isExempt(ExemptType.CHUNK, ExemptType.FLYING, ExemptType.GETTINGCOMBOED,ExemptType.PEARL, ExemptType.ICE, ExemptType.PLACING, ExemptType.SLIME, ExemptType.VOID, ExemptType.RESPAWN, ExemptType.VEHICLE, ExemptType.TELEPORT, ExemptType.GHOST_BLOCK, ExemptType.CREATIVE, ExemptType.COMBAT, ExemptType.UPWARDS_VEL)) { 21 | return; 22 | } 23 | 24 | final double dY = this.data.getPositionProcessor().getDeltaY(); 25 | this.minDelta = Math.min(this.minDelta, dY); 26 | if (this.data.getPositionProcessor().getAirTicks() > 20) { 27 | if (dY > this.minDelta) { 28 | fail("DeltaY: " + dY + " MinDelta: " + this.minDelta); 29 | } 30 | } 31 | else { 32 | this.minDelta = 0.0; 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/flight/FlightC.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.flight; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Flight", type = "C", description = "Checks if player isn't falling in air.") 10 | public final class FlightC extends Check { 11 | 12 | private double stableY; 13 | 14 | public FlightC(PlayerData data) { 15 | super(data); 16 | } 17 | 18 | @Override 19 | public void handle(Packet packet) { 20 | if (packet.isPosition()) { 21 | if (this.isExempt(ExemptType.FLYING, ExemptType.TELEPORT_DELAY, ExemptType.CREATIVE, ExemptType.PLACING)) { 22 | return; 23 | } 24 | this.stableY = this.data.getPositionProcessor().getY() == this.data.getPositionProcessor().getLastY() && this.data.getPositionProcessor().isInAir() ? (this.stableY += 1.0) : 0.0; 25 | if (this.stableY > 2.0) { 26 | fail(this.stableY); 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/flight/FlightD.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.flight; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Flight", type = "D", description = "Checks for too fast accel.") 10 | public final class FlightD extends Check 11 | { 12 | public FlightD(final PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(final Packet packet) { 18 | if (packet.isPosition()) { 19 | final int serverAirTicks = this.data.getPositionProcessor().getAirTicks(); 20 | final int clientAirTicks = this.data.getPositionProcessor().getClientAirTicks(); 21 | final double deltaY = this.data.getPositionProcessor().getDeltaY(); 22 | final double lastDeltaY = this.data.getPositionProcessor().getLastDeltaY(); 23 | final double acceleration = deltaY - lastDeltaY; 24 | final boolean exempt = this.isExempt(ExemptType.LAGGINGHARD, ExemptType.BUKKIT_PLACING, ExemptType.VELOCITY_ON_TICK, ExemptType.PISTON, ExemptType.VEHICLE, ExemptType.TELEPORT, ExemptType.LIQUID, ExemptType.BOAT, ExemptType.FLYING, ExemptType.SLIME, ExemptType.CLIMBABLE); 25 | final boolean invalid = acceleration > 0.0 && (serverAirTicks > 8 || clientAirTicks > 8); 26 | 27 | debug("deltaY: " + deltaY + "accel: " +acceleration+ "clientAir: " + clientAirTicks + "serverAir: " + clientAirTicks + "lastDeltaY" +lastDeltaY); 28 | 29 | if (invalid && !exempt) { 30 | if (increaseBuffer() > 5) { 31 | fail(); 32 | } 33 | } 34 | else { 35 | this.decreaseBufferBy(0.1); 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/flight/FlightE.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.flight; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Flight", type = "E", description = "Predicts flying using elon musk api + ai") 10 | public final class FlightE extends Check { 11 | 12 | public FlightE(final PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(Packet packet) { 18 | if (packet.isFlying()) { 19 | 20 | double yDelta = data.getPositionProcessor().getDeltaY(); 21 | boolean isInAir = data.getPositionProcessor().isInAir(); 22 | double ticks = data.getPositionProcessor().getAirTicks(); 23 | boolean exempt = isExempt(ExemptType.NEARSTAIRS, ExemptType.FLYING, ExemptType.CHUNK, ExemptType.CREATIVE, ExemptType.TELEPORT_DELAY) 24 | && (data.getPositionProcessor().getSinceTeleportTicks() > 40); 25 | 26 | debug("inAir:" + isInAir + " ticks:" + data.getPositionProcessor().getAirTicks()); 27 | 28 | if (isInAir && ticks > 15 && !exempt && yDelta >= 0) { 29 | if (increaseBuffer() > 2) { 30 | fail(ticks); 31 | } 32 | } 33 | else { 34 | decreaseBufferBy(0.35); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/ghostblock/GhostBlockA.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.ghostblock; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.config.Config; 6 | import dev.isnow.fox.data.PlayerData; 7 | import dev.isnow.fox.data.processor.PositionProcessor; 8 | import dev.isnow.fox.exempt.type.ExemptType; 9 | import dev.isnow.fox.packet.Packet; 10 | import dev.isnow.fox.util.PlayerUtil; 11 | import org.bukkit.potion.PotionEffectType; 12 | 13 | @CheckInfo(name="GhostBlock", type="A", description="Checks for too many ascention ticks.", experimental = true) 14 | public final class GhostBlockA 15 | extends Check { 16 | public GhostBlockA(PlayerData data) { 17 | super(data); 18 | } 19 | 20 | @Override 21 | public void handle(Packet packet) { 22 | if (packet.isPosition()) { 23 | final PositionProcessor processor = data.getPositionProcessor(); 24 | 25 | final double deltaY = processor.getDeltaY(); 26 | 27 | final int airTicksModifier = PlayerUtil.getPotionLevel(data.getPlayer(), PotionEffectType.JUMP); 28 | final int airTicksLimit = 8 + airTicksModifier; 29 | final int clientAirTicks = data.getPositionProcessor().getAirTicks(); 30 | 31 | final boolean exempt = isExempt(ExemptType.VELOCITY, ExemptType.PISTON, ExemptType.VEHICLE, 32 | ExemptType.TELEPORT, ExemptType.LIQUID, ExemptType.FLYING, ExemptType.CLIMBABLE, ExemptType.SLIME); 33 | 34 | final boolean invalid = deltaY > 0 && clientAirTicks > airTicksLimit; 35 | 36 | if (invalid && !exempt) { 37 | if (increaseBuffer() > 2) { 38 | if (Config.STRICTAF_GHOSTBLOCK_MODE && Config.GHOST_BLOCK_ENABLED) { 39 | data.dragDown(); 40 | data.getPlayer().sendMessage("Lagged Back for ghost blocks. [REALTRIPPY]"); 41 | } 42 | } else { 43 | decreaseBufferBy(0.01); 44 | } 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/motion/MotionB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.motion; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Motion", type = "B", description = "Checks if client fall speed doesn't match server side.") 10 | public final class MotionB extends Check { 11 | 12 | public MotionB(final PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(final Packet packet) { 18 | if (packet.isPosition()) { 19 | final boolean onGround = data.getPositionProcessor().isOnSolidGround(); 20 | if (onGround) { 21 | final double deltaY2 = data.getPositionProcessor().getDeltaY(); 22 | final boolean exempt = isExempt(ExemptType.CHUNK, 23 | ExemptType.FLYING, 24 | ExemptType.VEHICLE, 25 | ExemptType.SLIME, 26 | ExemptType.TELEPORT_DELAY, 27 | ExemptType.NEARSLABS, 28 | ExemptType.NEARSTAIRS, 29 | ExemptType.VOID, 30 | ExemptType.JOINED, 31 | ExemptType.LAGGING, 32 | ExemptType.VOID); 33 | if (deltaY2 <= -4.5 && !exempt) { 34 | fail(deltaY2); 35 | 36 | } 37 | } 38 | } 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/motion/MotionD.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.motion; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.BlockUtil; 9 | import io.github.retrooper.packetevents.PacketEvents; 10 | import io.github.retrooper.packetevents.utils.player.ClientVersion; 11 | import org.bukkit.Material; 12 | 13 | @CheckInfo(name = "Motion", type = "D", description = "Checks for invalid motion of liquids.") 14 | public final class MotionD extends Check { 15 | 16 | public MotionD(PlayerData data) { 17 | super(data); 18 | } 19 | 20 | @Override 21 | public void handle(Packet packet) { 22 | if(packet.isFlying()) { 23 | if (BlockUtil.isLiquid(data.getPlayer().getLocation().subtract(0, 0.1, 0).getBlock()) 24 | && !BlockUtil.isLiquid(data.getPlayer().getLocation().clone().add(0, 0.2, 0).getBlock()) 25 | && !data.getVelocityProcessor().isTakingVelocity() 26 | && data.getPositionProcessor().getBlocksBelow().stream().noneMatch(block -> block.getType() == Material.WATER_LILY) 27 | && data.getPositionProcessor().getWebTicks() == 0) { 28 | 29 | if(PacketEvents.get().getPlayerUtils().getClientVersion(data.getPlayer()).isNewerThanOrEquals(ClientVersion.v_1_13)) { 30 | return; 31 | } 32 | 33 | if (!data.getPositionProcessor().isOnGround() && increaseBuffer() > 9 && !isExempt(ExemptType.FLYING)) { 34 | fail("DeltaY:" + data.getPositionProcessor().getDeltaY()); 35 | } 36 | else { 37 | decreaseBufferBy(0.5); 38 | } 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/motion/MotionE.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.motion; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.PlayerUtil; 9 | import org.bukkit.potion.PotionEffectType; 10 | import org.bukkit.util.Vector; 11 | 12 | @CheckInfo(name = "Motion", type = "E", description = "Checks for sprinting backwards.") 13 | public final class MotionE extends Check { 14 | public MotionE(final PlayerData data) { 15 | super(data); 16 | } 17 | 18 | @Override 19 | public void handle(final Packet packet) { 20 | if (packet.isFlying()) { 21 | final boolean onGround = data.getPositionProcessor().isOnGround(); 22 | final boolean sprinting = data.getActionProcessor().isSprinting(); 23 | 24 | final double yaw = data.getRotationProcessor().getYaw(); 25 | final Vector direction = new Vector(-Math.sin(yaw * Math.PI / 180.0F) * (float) 1 * 0.5F, 0, Math.cos(yaw * Math.PI / 180.0F) * (float) 1 * 0.5F); 26 | 27 | final double deltaX = data.getPositionProcessor().getDeltaX(); 28 | final double deltaZ = data.getPositionProcessor().getDeltaZ(); 29 | 30 | final double deltaXZ = data.getPositionProcessor().getDeltaXZ(); 31 | 32 | final Vector move = new Vector(deltaX, 0.0, deltaZ); 33 | final double delta = move.distanceSquared(direction); 34 | 35 | final boolean exempt = isExempt(ExemptType.LIQUID, ExemptType.WEB, ExemptType.VELOCITY, ExemptType.CHUNK, ExemptType.UNDERBLOCK, ExemptType.ICE); 36 | final boolean invalid = delta > getLimit() && deltaXZ > 0.1 && sprinting && onGround; 37 | 38 | if (invalid && !exempt) { 39 | if (increaseBuffer() > 4) { 40 | fail(); 41 | } 42 | } else { 43 | resetBuffer(); 44 | } 45 | } 46 | } 47 | 48 | private double getLimit() { 49 | return data.getPlayer().getWalkSpeed() > 0.2f ? .23 * 1 + ((data.getPlayer().getWalkSpeed() / 0.2f) * 0.36) : 0.23 + (PlayerUtil.getPotionLevel(data.getPlayer(), PotionEffectType.SPEED) * 0.062f); 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/motion/MotionF.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.motion; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.PacketEvents; 8 | import io.github.retrooper.packetevents.packetwrappers.play.in.helditemslot.WrappedPacketInHeldItemSlot; 9 | import io.github.retrooper.packetevents.packetwrappers.play.out.helditemslot.WrappedPacketOutHeldItemSlot; 10 | 11 | @CheckInfo(name = "Motion", type = "F", description = "Checks if player isn't slowing down while blocking.") 12 | public class MotionF extends Check { 13 | public MotionF(PlayerData data) { 14 | super(data); 15 | } 16 | 17 | private int lastSlot; 18 | private int savedSlot; 19 | private boolean nextTick; 20 | 21 | @Override 22 | public void handle(Packet packet) { 23 | if (packet.isFlyingType() && nextTick) { 24 | nextTick = false; 25 | WrappedPacketOutHeldItemSlot slotChange = new WrappedPacketOutHeldItemSlot(savedSlot); 26 | PacketEvents.getAPI().getPlayerUtils().sendPacket(data.getPlayer(), slotChange); 27 | } 28 | if (packet.isSlot()) 29 | lastSlot = new WrappedPacketInHeldItemSlot(packet.getRawPacket()).getCurrentSelectedSlot(); 30 | if (packet.isPosition()) { 31 | if (data.getActionProcessor().isSprinting() && data.getActionProcessor().isBlocking()) { 32 | data.getActionProcessor().setBlocking(false); 33 | savedSlot = lastSlot; 34 | WrappedPacketOutHeldItemSlot slotChange = new WrappedPacketOutHeldItemSlot(getNewSlot()); 35 | PacketEvents.getAPI().getPlayerUtils().sendPacket(data.getPlayer(), slotChange); 36 | nextTick = true; 37 | } 38 | } 39 | } 40 | 41 | private int getNewSlot() { 42 | if (lastSlot == 8) 43 | return 0; 44 | return lastSlot + 1; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/motion/MotionG.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.motion; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Motion", description = "Checks for duplicate position packet.", type = "G", experimental = true) 10 | public final class MotionG 11 | extends Check { 12 | public MotionG(PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(Packet packet) { 18 | if (packet.isPosition()) { 19 | boolean invalid; 20 | double deltaY = this.data.getPositionProcessor().getDeltaY(); 21 | double lastDeltaY = this.data.getPositionProcessor().getLastDeltaY(); 22 | boolean exempt = this.isExempt(ExemptType.UNDERBLOCK, ExemptType.PISTON, ExemptType.CREATIVE, ExemptType.SLIME, ExemptType.TELEPORT, ExemptType.CHUNK, ExemptType.VEHICLE); 23 | boolean bl = invalid = deltaY == -lastDeltaY && deltaY != 0.0; 24 | 25 | debug("deltaY: " + deltaY + "lastDeltaY: " +lastDeltaY); 26 | 27 | if (invalid && !exempt) { 28 | if (increaseBuffer() > 5) { 29 | fail("deltaY:" + deltaY + " lastDeltaY:" + lastDeltaY); 30 | } 31 | } else { 32 | this.resetBuffer(); 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/movement/speed/SpeedD.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.movement.speed; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Speed", type = "D", description = "Checks for flaws in speeds by checking packets.") 10 | public final class SpeedD extends Check 11 | { 12 | public SpeedD(final PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(final Packet packet) { 18 | if (packet.isFlying()) { 19 | final double deltaY = this.data.getPositionProcessor().getDeltaY(); 20 | final int groundTicks = this.data.getPositionProcessor().getGroundTicks(); 21 | final int airTicks = this.data.getPositionProcessor().getClientAirTicks(); 22 | final boolean exempt = this.isExempt(ExemptType.SLIME); 23 | final boolean invalid = deltaY == 0.0 && groundTicks == 1 && airTicks == 0; 24 | if (invalid && !exempt) { 25 | if (increaseBuffer() > 5) { 26 | fail(); 27 | } 28 | } 29 | else { 30 | this.resetBuffer(); 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsA.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.badpackets; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.exempt.type.ExemptType; 9 | import dev.isnow.fox.packet.Packet; 10 | 11 | @CheckInfo(name = "BadPackets", type = "A", description = "Checks if the player pitch is an impossible value.") 12 | public final class BadPacketsA extends Check { 13 | public BadPacketsA(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | if (packet.isFlying()) { 20 | final float pitch = data.getRotationProcessor().getPitch(); 21 | 22 | if (Math.abs(pitch)> 90.0f && !isExempt(ExemptType.CLIMBABLE)) { 23 | fail(); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsB.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.badpackets; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying; 10 | 11 | @CheckInfo(name = "BadPackets", type = "B", description = "Checks for disablers.") 12 | public final class BadPacketsB extends Check { 13 | public BadPacketsB(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | if(packet.isFlying()) { 20 | WrappedPacketInFlying wrapped = new WrappedPacketInFlying(packet.getRawPacket()); 21 | if (wrapped.getYaw() > 1200.0f && (wrapped.getYaw() % 360.0f > 1200.0f)) { 22 | fail("deltaYaw: " + wrapped.getYaw() ); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsC.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.badpackets; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | import io.github.retrooper.packetevents.packetwrappers.play.in.abilities.WrappedPacketInAbilities; 10 | 11 | import java.util.Optional; 12 | 13 | @CheckInfo(name = "BadPackets", type = "C", description = "Checks for fake abilities.") 14 | public final class BadPacketsC extends Check { 15 | 16 | private Optional allowFlight; 17 | private boolean flying; 18 | 19 | public BadPacketsC(final PlayerData data) { 20 | super(data); 21 | } 22 | 23 | @Override 24 | public void handle(final Packet packet) { 25 | if (packet.isOutgoingAbilities()) { 26 | final WrappedPacketInAbilities wrapper = new WrappedPacketInAbilities(packet.getRawPacket()); 27 | 28 | allowFlight = wrapper.isFlightAllowed(); 29 | flying = wrapper.isFlying(); 30 | } else if (packet.isIncomingAbilities()) { 31 | final WrappedPacketInAbilities wrapper = new WrappedPacketInAbilities(packet.getRawPacket()); 32 | 33 | final boolean flying = wrapper.isFlying(); 34 | final Optional allowFlight = wrapper.isFlightAllowed(); 35 | 36 | if (this.flying != flying || this.allowFlight != allowFlight) fail(); 37 | if(!allowFlight.isPresent()) { 38 | return; 39 | } 40 | if (!allowFlight.get() && flying) fail(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsD.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.badpackets; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "BadPackets", type = "D", description = "Detects invalid game speed") 10 | public class BadPacketsD extends Check { 11 | public BadPacketsD(PlayerData data) { 12 | super(data); 13 | } 14 | 15 | private long balance = 0L; 16 | private long lastFlying = 0L; 17 | 18 | @Override 19 | public void handle(Packet packet) { 20 | if (packet.isFlying()) { 21 | final long now = packet.getTimeStamp(); 22 | handle: { 23 | if (isExempt(ExemptType.JOINED)) break handle; 24 | if (lastFlying == 0L) break handle; 25 | 26 | final long delay = now - lastFlying; 27 | 28 | balance += 50L - delay; 29 | 30 | if (balance > 5L) { 31 | if (increaseBuffer() > 5) { 32 | fail("balance: " + balance); 33 | } 34 | 35 | balance = 0; 36 | } else { 37 | decreaseBufferBy(0.001); 38 | } 39 | } 40 | 41 | this.lastFlying = now; 42 | } else if (packet.isTeleport()) { 43 | if (isExempt(ExemptType.JOINED)) return; 44 | if (lastFlying == 0L) return; 45 | 46 | balance -= 50L; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsE.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.badpackets; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.PacketEvents; 8 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 9 | import io.github.retrooper.packetevents.utils.player.ClientVersion; 10 | 11 | @CheckInfo(name = "BadPackets", type = "E", description = "Checks for attacking and digging.") 12 | public class BadPacketsE extends Check { 13 | 14 | public BadPacketsE(PlayerData data) { 15 | super(data); 16 | } 17 | 18 | @Override 19 | public void handle(Packet packet) { 20 | if (packet.isUseEntity()) { 21 | if(PacketEvents.get().getPlayerUtils().getClientVersion(data.getPlayer()).isNewerThan(ClientVersion.v_1_8)) { 22 | return; 23 | } 24 | final WrappedPacketInUseEntity wrapper = new WrappedPacketInUseEntity(packet.getRawPacket()); 25 | if (wrapper.getAction() == WrappedPacketInUseEntity.EntityUseAction.ATTACK) { 26 | final boolean sword = this.data.getPlayer().getItemInHand().getType().toString().contains("SWORD"); 27 | final boolean invalid = this.data.getActionProcessor().isSendingDig(); 28 | if (invalid && sword) { 29 | if (increaseBuffer() > 5.0) { 30 | } 31 | } 32 | else { 33 | setBuffer(Math.max(getBuffer() - 1.0, 0.0)); 34 | } 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsF.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.badpackets; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | 10 | @CheckInfo(name = "BadPackets", type = "F", description = "Checks if player is sending flyings but not responding transactions.") 11 | public final class BadPacketsF extends Check { 12 | 13 | public BadPacketsF(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsG.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.badpackets; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 10 | 11 | @CheckInfo(name = "BadPackets", type = "G", description = "Checks if player attacked themselves.") 12 | public final class BadPacketsG extends Check { 13 | public BadPacketsG(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | if (packet.isUseEntity()) { 20 | final WrappedPacketInUseEntity wrapper = new WrappedPacketInUseEntity(packet.getRawPacket()); 21 | 22 | if (data.getPlayer().getEntityId() == wrapper.getEntityId()) { 23 | fail(); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsH.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.badpackets; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.exempt.type.ExemptType; 9 | import dev.isnow.fox.packet.Packet; 10 | 11 | @CheckInfo(name = "BadPackets", type = "H", description = "Detects retarded clients.") 12 | public final class BadPacketsH extends Check { 13 | public BadPacketsH(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | if (packet.isFlying()) { 20 | final double deltaY = data.getPositionProcessor().getDeltaY(); 21 | 22 | final int groundTicks = data.getPositionProcessor().getGroundTicks(); 23 | final int airTicks = data.getPositionProcessor().getAirTicks(); 24 | 25 | final boolean exempt = isExempt(ExemptType.SLIME); 26 | final boolean invalid = deltaY == 0.0 && groundTicks == 1 && airTicks == 0; 27 | 28 | if (invalid && !exempt) { 29 | if (increaseBuffer() > 8) { 30 | fail(); 31 | } 32 | } else { 33 | resetBuffer(); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsI.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.badpackets; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying; 10 | 11 | @CheckInfo(name = "BadPackets", type = "I", description = "Checks for no position packet in 20 ticks.") 12 | public final class BadPacketsI extends Check { 13 | 14 | private int streak; 15 | 16 | public BadPacketsI(final PlayerData data) { 17 | super(data); 18 | } 19 | 20 | @Override 21 | public void handle(final Packet packet) { 22 | if (packet.isFlying()) { 23 | final WrappedPacketInFlying wrapper = new WrappedPacketInFlying(packet.getRawPacket()); 24 | 25 | if (wrapper.isPosition() || data.getPlayer().isInsideVehicle()) { 26 | streak = 0; 27 | return; 28 | } 29 | 30 | if (++streak > 20) { 31 | fail(); 32 | } 33 | } else if (packet.isSteerVehicle()) { 34 | streak = 0; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsJ.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.badpackets; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 10 | 11 | @CheckInfo(name = "BadPackets", type = "J", description = "Checks for attack no-swing.") 12 | public final class BadPacketsJ extends Check { 13 | public BadPacketsJ(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | if (packet.isUseEntity()) { 20 | final WrappedPacketInUseEntity wrapper = new WrappedPacketInUseEntity(packet.getRawPacket()); 21 | 22 | if (wrapper.getAction() == WrappedPacketInUseEntity.EntityUseAction.ATTACK) { 23 | if (increaseBuffer() > 2) { 24 | fail(); 25 | } 26 | } 27 | } else if (packet.isArmAnimation()) { 28 | resetBuffer(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsK.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.badpackets; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | import io.github.retrooper.packetevents.PacketEvents; 10 | import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; 11 | import io.github.retrooper.packetevents.utils.player.ClientVersion; 12 | 13 | @CheckInfo(name = "BadPackets", type = "K", description = "Checks for retards not swinging.") 14 | public final class BadPacketsK extends Check { 15 | 16 | private boolean swung; 17 | 18 | public BadPacketsK(final PlayerData data) { 19 | super(data); 20 | } 21 | 22 | @Override 23 | public void handle(final Packet packet) { 24 | if(PacketEvents.get().getPlayerUtils().getClientVersion(data.getPlayer()).isNewerThan(ClientVersion.v_1_8)) { 25 | return; 26 | } 27 | if (packet.isUseEntity()) { 28 | final WrappedPacketInUseEntity wrapper = new WrappedPacketInUseEntity(packet.getRawPacket()); 29 | 30 | if (wrapper.getAction() == WrappedPacketInUseEntity.EntityUseAction.ATTACK) { 31 | if (!swung) fail(); 32 | } 33 | } 34 | 35 | else if (packet.isArmAnimation()) { 36 | swung = true; 37 | } 38 | 39 | else if (packet.isFlying()) { 40 | swung = false; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsL.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.badpackets; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "BadPackets", type = "L", description = "Checks for autistic people [0 delta & pitch]") 10 | public final class BadPacketsL extends Check { 11 | 12 | public BadPacketsL(final PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(Packet packet) { 18 | if(packet.isPosLook() && data.getRotationProcessor().getDeltaPitch() == 0 && data.getRotationProcessor().getDeltaYaw() == 0 && !isExempt(ExemptType.TELEPORT_DELAY)) { 19 | if(increaseBuffer() > 5) { 20 | fail("Autistic People"); 21 | } 22 | } else { 23 | decreaseBufferBy(0.15); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/badpackets/BadPacketsM.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.badpackets; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | import io.github.retrooper.packetevents.packetwrappers.play.in.clientcommand.WrappedPacketInClientCommand; 10 | 11 | @CheckInfo(name = "BadPackets", type = "M", description = "Checks if player is trying to respawn while not dead.") 12 | public final class BadPacketsM extends Check { 13 | public BadPacketsM(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | if (packet.isClientCommand()) { 20 | final WrappedPacketInClientCommand wrapper = new WrappedPacketInClientCommand(packet.getRawPacket()); 21 | 22 | if (wrapper.getClientCommand() == WrappedPacketInClientCommand.ClientCommand.PERFORM_RESPAWN) { 23 | if (data.getPlayer().getHealth() > 0.0 && increaseBuffer() > 2) { 24 | fail(); 25 | } 26 | else { 27 | setBuffer(0); 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/crasher/CrasherA.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.crasher; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.steervehicle.WrappedPacketInSteerVehicle; 8 | 9 | @CheckInfo(name = "Crasher", description = "Checks for disablers.", type = "A") 10 | public final class CrasherA extends Check { 11 | 12 | public CrasherA(final PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(final Packet packet) { 18 | if (packet.isSteerVehicle()) { 19 | final WrappedPacketInSteerVehicle wrapper = new WrappedPacketInSteerVehicle(packet.getRawPacket()); 20 | 21 | final float forwardValue = Math.abs(wrapper.getForwardValue()); 22 | final float sideValue = Math.abs(wrapper.getSideValue()); 23 | 24 | final boolean invalid = forwardValue > .98F || sideValue > .98F; 25 | 26 | if (invalid) { 27 | fail(forwardValue); 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/crasher/CrasherB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.crasher; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.steervehicle.WrappedPacketInSteerVehicle; 8 | 9 | @CheckInfo(name = "Crasher", description = "Checks for disablers.", type = "B") 10 | public final class CrasherB extends Check { 11 | 12 | public CrasherB(final PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(final Packet packet) { 18 | if (packet.isSteerVehicle()) { 19 | final WrappedPacketInSteerVehicle wrapper = new WrappedPacketInSteerVehicle(packet.getRawPacket()); 20 | 21 | final boolean unmount = wrapper.isDismount(); 22 | 23 | final boolean invalid = data.getPlayer().getVehicle() == null && !unmount; 24 | 25 | if (invalid) { 26 | if (++buffer > 5) { 27 | fail("Invalid Vehicle"); 28 | buffer /= 2; 29 | } 30 | } else { 31 | buffer = 0; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/crasher/CrasherC.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.crasher; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.config.Config; 6 | import dev.isnow.fox.data.PlayerData; 7 | import dev.isnow.fox.manager.AlertManager; 8 | import dev.isnow.fox.packet.Packet; 9 | import dev.isnow.fox.util.ColorUtil; 10 | import io.github.retrooper.packetevents.packetwrappers.play.in.custompayload.WrappedPacketInCustomPayload; 11 | 12 | @CheckInfo(name = "Crasher", description = "Checks for spamming data.", type = "C") 13 | public final class CrasherC extends Check { 14 | 15 | public CrasherC(final PlayerData data) { 16 | super(data); 17 | } 18 | 19 | @Override 20 | public void handle(Packet packet) { 21 | if (packet.isCustomPayload()) { 22 | WrappedPacketInCustomPayload wrappedPacketInCustomPayload = new WrappedPacketInCustomPayload(packet.getRawPacket()); 23 | if (wrappedPacketInCustomPayload.getData().length > 15000) { 24 | AlertManager.sendAntiExploitAlert("Checks for spamming data.", "Data Spam"); 25 | data.getPlayer().kickPlayer(ColorUtil.translate(Config.ANTICRASHKICKEDMESSAGE)); 26 | } 27 | 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/crasher/CrasherD.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.crasher; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying; 8 | 9 | @CheckInfo(name = "Crasher", description = "Checks for disablers.", type = "D") 10 | public final class CrasherD extends Check { 11 | 12 | public CrasherD(final PlayerData data) { 13 | super(data); 14 | } 15 | 16 | @Override 17 | public void handle(final Packet packet) { 18 | if(packet.isFlying()) { 19 | WrappedPacketInFlying wrapped = new WrappedPacketInFlying(packet.getRawPacket()); 20 | if (wrapped.getYaw() > 1200.0f && (wrapped.getYaw() % 360.0f > 1200.0f)) { 21 | fail("deltaYaw: " + wrapped.getYaw() ); 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/fastplace/FastPlaceA.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.fastplace; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | import dev.isnow.fox.util.MathUtil; 10 | 11 | import java.util.LinkedList; 12 | import java.util.Queue; 13 | 14 | @CheckInfo(name = "FastPlace", type = "A", description = "Checks if player placing blocks too fast.") 15 | public final class FastPlaceA extends Check { 16 | 17 | private final Queue delays = new LinkedList<>(); 18 | 19 | private int movements; 20 | 21 | 22 | public FastPlaceA(final PlayerData data) { 23 | super(data); 24 | } 25 | 26 | @Override 27 | public void handle(final Packet packet) { 28 | if(packet.isBlockPlace() && !isBridging()) { 29 | if (movements < 10) { 30 | if (delays.add(movements) && delays.size() == 35) { 31 | double avg = MathUtil.getAverage(delays); 32 | double stDev = MathUtil.getStandardDeviation(delays); 33 | 34 | if (avg < 4 && stDev < 0.15) { 35 | if (increaseBuffer() > 2) { 36 | fail(); 37 | } 38 | } 39 | 40 | delays.clear(); 41 | } 42 | } 43 | 44 | movements = 0; 45 | } 46 | if(packet.isFlying() && !isBridging()) { 47 | ++movements; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/ground/GroundA.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.ground; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying; 9 | 10 | @CheckInfo(name = "Ground", type = "A", description = "Checks for invalid ground.") 11 | public final class GroundA extends Check { 12 | 13 | public GroundA(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | @Override 18 | public void handle(final Packet packet) { 19 | if (packet.isPosition()) { 20 | final WrappedPacketInFlying wrapper = new WrappedPacketInFlying(packet.getRawPacket()); 21 | 22 | final boolean clientGround = wrapper.isOnGround(); 23 | final boolean serverGround = wrapper.getY() % 0.015625 == 0.0; 24 | 25 | final boolean exempt = isExempt(ExemptType.NEARSTAIRS, ExemptType.BOAT, ExemptType.LIQUID, ExemptType.CLIMBABLE, ExemptType.VEHICLE, ExemptType.TELEPORT_DELAY, ExemptType.CHUNK, ExemptType.SLIME, ExemptType.FLYING, ExemptType.PISTON); 26 | final boolean invalid = clientGround != serverGround; 27 | 28 | if (invalid && !exempt) { 29 | if (increaseBuffer() > 3) { 30 | fail(); 31 | } 32 | } else { 33 | decreaseBufferBy(0.25); 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/ground/GroundB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.ground; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Ground", type = "B", description = "Checks for spoofing ground distance.") 10 | public final class GroundB extends Check { 11 | 12 | private double serverFallDistance; 13 | 14 | public GroundB(final PlayerData data) { 15 | super(data); 16 | } 17 | 18 | @Override 19 | public void handle(final Packet packet) { 20 | if (packet.isPosition()) { 21 | final double deltaY = data.getPositionProcessor().getDeltaY(); 22 | 23 | final boolean inAir = data.getPositionProcessor().isInAir(); 24 | final boolean nearStair = data.getPositionProcessor().isNearStair(); 25 | final boolean inLiquid = data.getPositionProcessor().isInLiquid(); 26 | 27 | if (deltaY < 0.0 && !inAir && !nearStair && !inLiquid) { 28 | serverFallDistance -= deltaY; 29 | } else { 30 | serverFallDistance = 0.0; 31 | } 32 | 33 | final double serverFallDistance = this.serverFallDistance; 34 | final double clientFallDistance = data.getPlayer().getFallDistance(); 35 | 36 | final boolean exempt = isExempt(ExemptType.FLYING, ExemptType.CREATIVE, ExemptType.WEB, ExemptType.CLIMBABLE,ExemptType.LIQUID, ExemptType.BOAT, ExemptType.VOID, ExemptType.VEHICLE, ExemptType.CHUNK, ExemptType.PISTON); 37 | final boolean invalid = Math.abs(serverFallDistance - clientFallDistance) - clientFallDistance >= 1.0 && inAir; 38 | 39 | if (invalid && !exempt) { 40 | if (increaseBuffer() > 3) { 41 | fail(); 42 | } 43 | } else { 44 | decreaseBufferBy(0.25); 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/ground/GroundC.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.ground; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | 9 | @CheckInfo(name = "Ground", type = "C", description = "Checks for invalid vertical ground motion.") 10 | public final class GroundC extends Check { 11 | public GroundC(final PlayerData data) { 12 | super(data); 13 | } 14 | 15 | @Override 16 | public void handle(final Packet packet) { 17 | if (packet.isPosition()) { 18 | final int groundTicks = data.getPositionProcessor().getGroundTicks(); 19 | 20 | final double deltaY = data.getPositionProcessor().getDeltaY(); 21 | final double lastY = data.getPositionProcessor().getLastY(); 22 | 23 | final boolean step = deltaY % 0.015625 == 0.0 && lastY % 0.015625 == 0.0; 24 | 25 | final boolean exempt = isExempt(ExemptType.LONG_BUKKIT_PLACING, ExemptType.TELEPORT, ExemptType.BOAT, ExemptType.WEB, ExemptType.LIQUID, ExemptType.PISTON, ExemptType.CHUNK); 26 | final boolean invalid = groundTicks > 5 && deltaY != 0.0 && !step; 27 | 28 | if (invalid && !exempt) { 29 | if (increaseBuffer() > 1) { 30 | fail(); 31 | } 32 | } else { 33 | decreaseBufferBy(0.05); 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/inventory/InventoryA.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.inventory; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.exempt.type.ExemptType; 9 | import dev.isnow.fox.packet.Packet; 10 | import io.github.retrooper.packetevents.packetwrappers.play.in.helditemslot.WrappedPacketInHeldItemSlot; 11 | 12 | @CheckInfo(name = "Inventory", type = "A", description = "Checks for slot change to same slot.") 13 | public final class InventoryA extends Check { 14 | 15 | private int lastSlot = -1; 16 | private boolean server; 17 | 18 | public InventoryA(final PlayerData data) { 19 | super(data); 20 | } 21 | 22 | @Override 23 | public void handle(final Packet packet) { 24 | if (packet.isIncomingHeldItemSlot() && !isExempt(ExemptType.JOINED)) { 25 | final WrappedPacketInHeldItemSlot wrapper = new WrappedPacketInHeldItemSlot(packet.getRawPacket()); 26 | 27 | final int slot = wrapper.getCurrentSelectedSlot(); 28 | 29 | final boolean invalid = slot == lastSlot; 30 | final boolean exempt = server; 31 | 32 | if (invalid && !exempt) { 33 | fail(); 34 | } 35 | 36 | lastSlot = slot; 37 | server = false; 38 | } else if (packet.isOutgoingHeldItemSlot()) { 39 | server = true; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/inventory/InventoryB.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.inventory; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.exempt.type.ExemptType; 9 | import dev.isnow.fox.packet.Packet; 10 | import dev.isnow.fox.util.PlayerUtil; 11 | 12 | @CheckInfo(name = "Inventory", type = "B", description = "Checks if player is moving while interacting with inventory.") 13 | public final class InventoryB extends Check { 14 | public InventoryB(final PlayerData data) { 15 | super(data); 16 | } 17 | 18 | @Override 19 | public void handle(final Packet packet) { 20 | if (packet.isWindowClick()) { 21 | final boolean onGround = data.getPositionProcessor().isOnGround(); 22 | 23 | final double deltaXZ = data.getPositionProcessor().getDeltaXZ(); 24 | final double lastDeltaXZ = data.getPositionProcessor().getLastDeltaXZ(); 25 | 26 | final double acceleration = deltaXZ - lastDeltaXZ; 27 | 28 | final boolean exempt = isExempt(ExemptType.WEB, ExemptType.FLYING, ExemptType.PISTON, ExemptType.LIQUID, ExemptType.CLIMBABLE, ExemptType.VELOCITY, ExemptType.CREATIVE); 29 | 30 | final boolean invalidDelta = deltaXZ > PlayerUtil.getBaseSpeed(data.getPlayer(), 0.2F) && onGround; 31 | final boolean invalidAcceleration = acceleration >= 0.0 && deltaXZ > PlayerUtil.getBaseSpeed(data.getPlayer(), 0.1F); 32 | 33 | final boolean invalid = invalidDelta || invalidAcceleration; 34 | 35 | if (invalid && !exempt) { 36 | if (increaseBuffer() > 2) { 37 | fail(); 38 | } 39 | } else { 40 | decreaseBufferBy(0.5); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/inventory/InventoryC.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.inventory; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | import io.github.retrooper.packetevents.packetwrappers.play.in.windowclick.WrappedPacketInWindowClick; 10 | 11 | @CheckInfo(name = "Inventory", type = "C", description = "Checks if player is clicking windows too fast.") 12 | public final class InventoryC extends Check { 13 | public InventoryC(final PlayerData data) { 14 | super(data); 15 | } 16 | 17 | private long lastClick; 18 | private int lastClickSlot; 19 | 20 | @Override 21 | public void handle(final Packet packet) { 22 | if (packet.isWindowClick()) { 23 | WrappedPacketInWindowClick wrapped = new WrappedPacketInWindowClick(packet.getRawPacket()); 24 | if (wrapped.getWindowButton() == 0) { 25 | 26 | int slot = wrapped.getWindowSlot(); 27 | if(lastClickSlot != 0 && slot == lastClickSlot) { 28 | return; 29 | } 30 | lastClickSlot = slot; 31 | if (slot < 9 || slot > 35) { 32 | return; 33 | } 34 | 35 | long now = System.currentTimeMillis(); 36 | 37 | long delay = now - lastClick; 38 | 39 | if (delay > 11L && delay < 90L && increaseBuffer() > 15) { 40 | fail("Delay: " + delay); 41 | } 42 | else { 43 | decreaseBufferBy(0.10); 44 | } 45 | 46 | this.lastClick = System.currentTimeMillis(); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/inventory/InventoryD.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.check.impl.player.inventory; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.check.api.CheckInfo; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.packet.Packet; 9 | import io.github.retrooper.packetevents.packetwrappers.play.in.clientcommand.WrappedPacketInClientCommand; 10 | 11 | @CheckInfo(name = "Inventory", type = "D", description = "Checks if player is swinging or attacking while opening inventory.") 12 | public final class InventoryD extends Check { 13 | 14 | private boolean attacking, swinging; 15 | 16 | public InventoryD(final PlayerData data) { 17 | super(data); 18 | } 19 | 20 | @Override 21 | public void handle(final Packet packet) { 22 | if (packet.isClientCommand()) { 23 | final WrappedPacketInClientCommand wrapper = new WrappedPacketInClientCommand(packet.getRawPacket()); 24 | 25 | if (wrapper.getClientCommand() != WrappedPacketInClientCommand.ClientCommand.OPEN_INVENTORY_ACHIEVEMENT) return; 26 | 27 | if (attacking || swinging) { 28 | if (increaseBuffer() > 4) { 29 | fail(); 30 | } 31 | } else { 32 | resetBuffer(); 33 | } 34 | 35 | } else if (packet.isFlying()) { 36 | attacking = false; 37 | swinging = false; 38 | } else if (packet.isArmAnimation()) { 39 | swinging = true; 40 | } else if (packet.isUseEntity()) { 41 | attacking = true; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/payload/PayloadB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.payload; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.config.Config; 6 | import dev.isnow.fox.data.PlayerData; 7 | import dev.isnow.fox.manager.AlertManager; 8 | import dev.isnow.fox.packet.Packet; 9 | import dev.isnow.fox.util.ColorUtil; 10 | import io.github.retrooper.packetevents.packetwrappers.play.in.custompayload.WrappedPacketInCustomPayload; 11 | 12 | @CheckInfo(name = "Payload", description = "Checks for spamming payloads.", type = "B") 13 | public final class PayloadB extends Check { 14 | 15 | public PayloadB(final PlayerData data) { 16 | super(data); 17 | } 18 | 19 | @Override 20 | public void handle(Packet packet) { 21 | if (packet.isCustomPayload()) { 22 | WrappedPacketInCustomPayload wrappedPacketInCustomPayload = new WrappedPacketInCustomPayload(packet.getRawPacket()); 23 | String payload = wrappedPacketInCustomPayload.getChannelName(); 24 | if ((payload.equals("MC|BOpen") || payload.equals("MC|BEdit")) && (this.buffer += 2) > 4) { 25 | if (buffer > 2) { 26 | AlertManager.sendAntiExploitAlert("Checks for clients spamming payloads.", "Payload Spam"); 27 | data.getPlayer().kickPlayer(ColorUtil.translate(Config.PAYLOADKICK)); 28 | } 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/timer/TimerA.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.timer; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.MovingStats; 9 | 10 | @CheckInfo(name = "Timer", type = "A", description = "Detects game speed modifications.") 11 | public final class TimerA extends Check { 12 | 13 | private final MovingStats movingStats = new MovingStats(20); 14 | 15 | private long lastFlying = 0L; 16 | private long allowance = 0; 17 | 18 | public TimerA(final PlayerData data) { 19 | super(data); 20 | } 21 | 22 | @Override 23 | public void handle(final Packet packet) { 24 | if (packet.isFlying()) { 25 | final long now = now(); 26 | 27 | final boolean exempt = this.isExempt(ExemptType.LAGGINGHARD, ExemptType.RESPAWN, ExemptType.TELEPORT, ExemptType.JOINED, ExemptType.VEHICLE); 28 | 29 | debug(exempt); 30 | handle: { 31 | if (exempt) break handle; 32 | 33 | final long delay = now - lastFlying; 34 | if (delay < 1) break handle; 35 | 36 | movingStats.add(delay); 37 | 38 | final double threshold = 7.07; 39 | final double deviation = movingStats.getStdDev(threshold); 40 | 41 | if (deviation < threshold && !Double.isNaN(deviation)) { 42 | allowance += 50; 43 | allowance -= delay; 44 | 45 | if (allowance > Math.ceil(threshold)) fail(); 46 | } else { 47 | allowance = 0; 48 | } 49 | } 50 | 51 | this.lastFlying = now; 52 | } else if (packet.isTeleport()) { 53 | movingStats.add(125L); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/timer/TimerB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.timer; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.packet.Packet; 8 | import dev.isnow.fox.util.MathUtil; 9 | import dev.isnow.fox.util.type.EvictingList; 10 | 11 | @CheckInfo(name = "Timer", type = "B", description = "Checks packet delay between packets.") 12 | public final class TimerB extends Check { 13 | 14 | private final EvictingList samples = new EvictingList<>(50); 15 | private long lastFlying; 16 | 17 | public TimerB(final PlayerData data) { 18 | super(data); 19 | } 20 | 21 | @Override 22 | public void handle(final Packet packet) { 23 | if (packet.isFlying()) { 24 | final long now = now(); 25 | 26 | final boolean exempt = this.isExempt(ExemptType.TELEPORT, ExemptType.JOINED, ExemptType.VEHICLE); 27 | 28 | debug(exempt); 29 | handle: 30 | { 31 | if (exempt) break handle; 32 | 33 | final long delay = now - lastFlying; 34 | 35 | if (delay > 0) { 36 | samples.add(delay); 37 | } 38 | 39 | if (samples.isFull()) { 40 | final double average = MathUtil.getAverage(samples); 41 | final double deviation = MathUtil.getStandardDeviation(samples); 42 | 43 | final double speed = 50.0 / average; 44 | 45 | final boolean invalid = deviation < 40.0 && speed < 0.6 && !Double.isNaN(deviation); 46 | 47 | if (invalid) { 48 | if (increaseBuffer() > 30) { 49 | fail("Speed: " + speed); 50 | multiplyBuffer(0.50); 51 | } 52 | } else { 53 | decreaseBufferBy(10); 54 | } 55 | } 56 | } 57 | 58 | this.lastFlying = now; 59 | } else if (packet.isTeleport()) { 60 | samples.add(125L); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/check/impl/player/timer/TimerC.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.check.impl.player.timer; 2 | 3 | import dev.isnow.fox.check.Check; 4 | import dev.isnow.fox.check.api.CheckInfo; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import dev.isnow.fox.util.MathUtil; 8 | import dev.isnow.fox.util.type.EvictingList; 9 | 10 | @CheckInfo(name = "Timer", type = "C", description = "Checks for game speed which is too slow.") 11 | public class TimerC extends Check { 12 | 13 | private final EvictingList samples = new EvictingList<>(50); 14 | private long lastFlyingTime; 15 | 16 | public TimerC(PlayerData data) { 17 | super(data); 18 | } 19 | 20 | @Override 21 | public void handle(Packet packet) { 22 | if (packet.isFlying()) { 23 | final long now = now(); 24 | final long delta = now - lastFlyingTime; 25 | samples.add(delta); 26 | if (samples.isFull()) { 27 | final double average = samples.stream().mapToDouble(value -> value).average().orElse(1.0); 28 | final double speed = 50 / average; 29 | final double deviation = MathUtil.getStandardDeviation(samples); 30 | if (speed <= 0.75 && deviation < 50) { 31 | if (increaseBuffer() > 10) { 32 | fail(String.format("Speed: %.2f Deviation: %.2f", speed, deviation)); 33 | } 34 | } 35 | else { 36 | decreaseBufferBy(2); 37 | } 38 | } 39 | lastFlyingTime = now; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/CommandInfo.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.command; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.TYPE) 10 | public @interface CommandInfo { 11 | String name(); 12 | String purpose(); 13 | String syntax() default ""; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/FoxCommand.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.command; 2 | 3 | import dev.isnow.fox.util.ColorUtil; 4 | import org.bukkit.ChatColor; 5 | import org.bukkit.command.Command; 6 | import org.bukkit.command.CommandSender; 7 | 8 | public abstract class FoxCommand implements Comparable { 9 | 10 | protected abstract boolean handle(final CommandSender sender, final Command command, final String label, final String[] args); 11 | 12 | public void sendLineBreak(final CommandSender sender) { 13 | sender.sendMessage(ColorUtil.translate("&8&m--------------------------------------------------")); 14 | } 15 | 16 | public void sendRetardedNewLine(final CommandSender sender) { 17 | sender.sendMessage(""); 18 | } 19 | 20 | public void sendPrefix(final CommandSender sender) { 21 | sender.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "fox" + ChatColor.GRAY + "]" + " "); 22 | } 23 | 24 | public void sendMessage(final CommandSender sender, final String message) { 25 | sender.sendMessage(ColorUtil.translate(message)); 26 | } 27 | 28 | public CommandInfo getCommandInfo() { 29 | if (this.getClass().isAnnotationPresent(CommandInfo.class)) { 30 | return this.getClass().getAnnotation(CommandInfo.class); 31 | } else { 32 | System.err.println("CommandInfo annotation hasn't been added to the class " + this.getClass().getSimpleName() + "."); 33 | } 34 | return null; 35 | } 36 | 37 | @Override 38 | public int compareTo(FoxCommand o) { 39 | return 0; 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Alerts.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.command.impl; 4 | 5 | import dev.isnow.fox.command.CommandInfo; 6 | import dev.isnow.fox.command.FoxCommand; 7 | import dev.isnow.fox.config.Config; 8 | import dev.isnow.fox.data.PlayerData; 9 | import dev.isnow.fox.manager.AlertManager; 10 | import dev.isnow.fox.manager.PlayerDataManager; 11 | import dev.isnow.fox.util.ColorUtil; 12 | import org.bukkit.command.Command; 13 | import org.bukkit.command.CommandExecutor; 14 | import org.bukkit.command.CommandSender; 15 | import org.bukkit.entity.Player; 16 | 17 | @CommandInfo(name = "alerts", purpose = "Toggles cheat alerts.") 18 | public final class Alerts extends FoxCommand implements CommandExecutor { 19 | 20 | @Override 21 | protected boolean handle(CommandSender sender, Command command, String label, String[] args) { 22 | if (sender instanceof Player && sender.hasPermission("fox.alerts")) { 23 | final Player player = (Player) sender; 24 | final PlayerData data = PlayerDataManager.getInstance().getPlayerData(player); 25 | 26 | if (data != null) { 27 | if (AlertManager.toggleAlerts(data) == AlertManager.ToggleAlertType.ADD) { 28 | sendMessage(sender, ColorUtil.translate(Config.ALERTSON)); 29 | } else { 30 | sendMessage(sender, ColorUtil.translate(Config.ALERTSOFF)); 31 | } 32 | return true; 33 | } 34 | 35 | } else { 36 | sendMessage(sender, "Only players can execute this command."); 37 | } 38 | return false; 39 | } 40 | 41 | @Override 42 | public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { 43 | if(commandSender instanceof Player) { 44 | handle(commandSender, command, s, strings); 45 | } 46 | return true; 47 | } 48 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Checks.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.command.impl; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.command.CommandInfo; 7 | import dev.isnow.fox.command.FoxCommand; 8 | import dev.isnow.fox.data.PlayerData; 9 | import dev.isnow.fox.manager.PlayerDataManager; 10 | import dev.isnow.fox.util.ColorUtil; 11 | import org.bukkit.Bukkit; 12 | import org.bukkit.command.Command; 13 | import org.bukkit.command.CommandSender; 14 | import org.bukkit.entity.Player; 15 | 16 | @CommandInfo(name = "checks", syntax = "", purpose = "Get the players registered checks.") 17 | public final class Checks extends FoxCommand { 18 | 19 | @Override 20 | protected boolean handle(final CommandSender sender, final Command command, final String label, final String[] args) { 21 | if (args.length == 2) { 22 | final Player player = Bukkit.getPlayer(args[1]); 23 | 24 | if (player != null) { 25 | final PlayerData playerData = PlayerDataManager.getInstance().getPlayerData(player); 26 | 27 | if (playerData != null) { 28 | sendLineBreak(sender); 29 | sendMessage(sender, ColorUtil.translate("&cThere are " + playerData.getChecks().size() + " registered checks for " + player.getName() + "\n" + " \n")); 30 | for (final Check check : playerData.getChecks()) { 31 | sendMessage(sender, ColorUtil.translate("&c" + check.getCheckInfo().name() + " (" + check.getCheckInfo().type() + ")")); 32 | } 33 | sendLineBreak(sender); 34 | return true; 35 | } 36 | } 37 | } 38 | return false; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Crash.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.command.impl; 2 | 3 | import dev.isnow.fox.command.CommandInfo; 4 | import dev.isnow.fox.command.FoxCommand; 5 | import dev.isnow.fox.util.ColorUtil; 6 | import net.minecraft.server.v1_8_R3.EntityItem; 7 | import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; 8 | import org.bukkit.Bukkit; 9 | import org.bukkit.command.Command; 10 | import org.bukkit.command.CommandSender; 11 | import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; 12 | import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; 13 | import org.bukkit.entity.Player; 14 | 15 | @CommandInfo(name = "crash", syntax = "", purpose = "Crashes player's client.") 16 | public class Crash extends FoxCommand { 17 | @Override 18 | protected boolean handle(CommandSender sender, Command command, String label, String[] args) { 19 | if(args.length == 2) { 20 | Player p = Bukkit.getPlayer(args[1]); 21 | if(p == null) { 22 | sender.sendMessage(ColorUtil.translate("&cThis player does not exist!")); 23 | return true; 24 | } 25 | for(int ia = 0; ia < 10000; ia++) { 26 | EntityItem spawned = new EntityItem(((CraftWorld)p.getWorld()).getHandle()); 27 | spawned.setLocation(p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ(), 0, 0); 28 | spawned.setItemStack(null); 29 | PacketPlayOutSpawnEntity packet_item = new PacketPlayOutSpawnEntity(spawned, 2); 30 | ((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet_item); 31 | } 32 | sender.sendMessage(ColorUtil.translate("&cPlayer got trolled!")); 33 | return true; 34 | } 35 | return false; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Debug.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.command.impl; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.command.CommandInfo; 7 | import dev.isnow.fox.command.FoxCommand; 8 | import dev.isnow.fox.data.PlayerData; 9 | import dev.isnow.fox.manager.PlayerDataManager; 10 | import org.bukkit.command.Command; 11 | import org.bukkit.command.CommandSender; 12 | import org.bukkit.entity.Player; 13 | 14 | @CommandInfo(name = "debug", purpose = "Allows the player to debug checks.", syntax = " ") 15 | public final class Debug extends FoxCommand { 16 | @Override 17 | protected boolean handle(final CommandSender sender, final Command command, final String label, final String[] args) { 18 | if (args.length == 3) { 19 | final PlayerData data = PlayerDataManager.getInstance().getPlayerData(((Player) sender)); 20 | 21 | final String checkName = args[1]; 22 | final String checkType = args[2]; 23 | 24 | if (data != null && checkName != null && checkType != null) { 25 | Check check = null; 26 | 27 | for (final Check c : data.getChecks()) { 28 | if (c.getCheckInfo().name().equalsIgnoreCase(checkName) 29 | && c.getCheckInfo().type().equalsIgnoreCase(checkType)) { 30 | check = c; 31 | break; 32 | } 33 | } 34 | 35 | if (check != null) { 36 | if (check.isDebug()) { 37 | check.setDebug(false); 38 | sendMessage(sender, String.format("Disabled debugging for the check %s (Type %s)", check.getCheckInfo().name(), check.getCheckInfo().type())); 39 | } else { 40 | check.setDebug(true); 41 | sendMessage(sender, String.format("Enabled debugging for the check %s (Type %s)", check.getCheckInfo().name(), check.getCheckInfo().type())); 42 | } 43 | } else { 44 | sendMessage(sender, "Check does not exist."); 45 | } 46 | 47 | return true; 48 | } 49 | } 50 | return false; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Demo.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.command.impl; 2 | 3 | import dev.isnow.fox.command.CommandInfo; 4 | import dev.isnow.fox.command.FoxCommand; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.manager.PlayerDataManager; 7 | import org.bukkit.Bukkit; 8 | import org.bukkit.command.Command; 9 | import org.bukkit.command.CommandSender; 10 | import org.bukkit.entity.Player; 11 | 12 | @CommandInfo(name = "demo", purpose = "Make a demo screen popup for a player", syntax = "") 13 | public class Demo extends FoxCommand { 14 | @Override 15 | protected boolean handle(CommandSender sender, Command command, String label, String[] args) { 16 | if (args.length == 2) { 17 | final Player player = Bukkit.getPlayer(args[1]); 18 | assert player != null; 19 | final PlayerData data = PlayerDataManager.getInstance().getPlayerData(player); 20 | data.sendDemo(player); 21 | return true; 22 | } 23 | return false; 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Exempt.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.command.impl; 4 | 5 | import dev.isnow.fox.command.CommandInfo; 6 | import dev.isnow.fox.command.FoxCommand; 7 | import dev.isnow.fox.data.PlayerData; 8 | import dev.isnow.fox.manager.PlayerDataManager; 9 | import org.bukkit.Bukkit; 10 | import org.bukkit.command.Command; 11 | import org.bukkit.command.CommandSender; 12 | import org.bukkit.entity.Player; 13 | 14 | @CommandInfo(name = "exempt", syntax = "", purpose = "Exempts a player from anti-cheat detections.") 15 | public final class Exempt extends FoxCommand { 16 | 17 | @Override 18 | protected boolean handle(final CommandSender sender, final Command command, final String label, final String[] args) { 19 | if (args.length == 2) { 20 | final Player player = Bukkit.getPlayer(args[1]); 21 | 22 | if (player != null) { 23 | final PlayerData playerData = PlayerDataManager.getInstance().getPlayerData(player); 24 | 25 | if (playerData != null) { 26 | if (playerData.isExempt()) { 27 | sendMessage(sender, "&8Un-exempted '&c" + player.getName() + "&8' from Fox."); 28 | playerData.setExempt(false); 29 | } else { 30 | sendMessage(sender, "&8Exempted '&c" + player.getName() + "&8' from Fox."); 31 | playerData.setExempt(true); 32 | } 33 | return true; 34 | } 35 | } 36 | else { 37 | sendMessage(sender, "&cUnknown player."); 38 | return true; 39 | } 40 | } 41 | return false; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/ForceBot.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.command.impl; 2 | 3 | import dev.isnow.fox.command.CommandInfo; 4 | import dev.isnow.fox.command.FoxCommand; 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.manager.PlayerDataManager; 7 | import dev.isnow.fox.util.BotTypes; 8 | import dev.isnow.fox.util.BotUtils; 9 | import dev.isnow.fox.util.ColorUtil; 10 | import org.bukkit.Bukkit; 11 | import org.bukkit.command.Command; 12 | import org.bukkit.command.CommandSender; 13 | import org.bukkit.entity.Player; 14 | 15 | @CommandInfo(name = "forcebot", syntax = " ", purpose = "Creates a bot next to the player, MODES: NORMAL, WATCHDOG, FOLLOW") 16 | public class ForceBot extends FoxCommand { 17 | @Override 18 | protected boolean handle(CommandSender sender, Command command, String label, String[] args) { 19 | if(!(sender instanceof Player)) { 20 | sender.sendMessage(ColorUtil.translate("&cThis command must be executed in-game!")); 21 | return true; 22 | } 23 | if(args.length >= 3) { 24 | Player target = Bukkit.getPlayer(args[1]); 25 | if(target == null) { 26 | sender.sendMessage(ColorUtil.translate("&cThis player does not exist!")); 27 | return true; 28 | } 29 | BotTypes botType; 30 | try { 31 | botType = BotTypes.valueOf(args[2]); 32 | } catch (IllegalArgumentException Exception) { 33 | sender.sendMessage(ColorUtil.translate("&cThis mode does not exist!")); 34 | return true; 35 | } 36 | PlayerData attackerData = PlayerDataManager.getInstance().getPlayerData((Player) sender); 37 | PlayerData victimData = PlayerDataManager.getInstance().getPlayerData(target); 38 | if(victimData.getCombatProcessor().getTarget() == null) { 39 | sender.sendMessage(ColorUtil.translate("&cThis player doesnt have any targets!")); 40 | return true; 41 | } 42 | if(victimData.getBotProcessor().hasBot) { 43 | sender.sendMessage(ColorUtil.translate("&cThis player is already being checked by a bot!")); 44 | return true; 45 | } 46 | BotUtils.spawnBotEntity(victimData, attackerData, botType); 47 | sender.sendMessage(ColorUtil.translate("&aSUCESS! &aSending this bot to the player!")); 48 | return true; 49 | } 50 | return false; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Gui.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.command.impl; 2 | 3 | import dev.isnow.fox.Fox; 4 | import dev.isnow.fox.command.CommandInfo; 5 | import dev.isnow.fox.command.FoxCommand; 6 | import dev.isnow.fox.util.ColorUtil; 7 | import org.bukkit.Sound; 8 | import org.bukkit.command.Command; 9 | import org.bukkit.command.CommandSender; 10 | import org.bukkit.entity.Player; 11 | 12 | @CommandInfo(name = "gui", syntax = "", purpose = "Opens Interactive GUI") 13 | public class Gui extends FoxCommand { 14 | @Override 15 | protected boolean handle(CommandSender sender, Command command, String label, String[] args) { 16 | if(args.length >= 2) { 17 | return false; 18 | } 19 | if(!(sender instanceof Player)) { 20 | sender.sendMessage(ColorUtil.translate("&cOnly players are allowed to execute this command!")); 21 | return true; 22 | } 23 | Player p = (Player) sender; 24 | Fox.INSTANCE.getGuiManager().openMainMenu(p); 25 | p.playSound(p.getLocation(), Sound.NOTE_PLING, 1, 1); 26 | return true; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Help.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.command.impl; 2 | 3 | import dev.isnow.fox.command.CommandInfo; 4 | import dev.isnow.fox.command.CommandManager; 5 | import dev.isnow.fox.command.FoxCommand; 6 | import org.bukkit.ChatColor; 7 | import org.bukkit.command.Command; 8 | import org.bukkit.command.CommandSender; 9 | 10 | @CommandInfo(name = "help", purpose = "Prints every command.") 11 | public class Help extends FoxCommand { 12 | @Override 13 | protected boolean handle(CommandSender sender, Command command, String label, String[] args) { 14 | for (final FoxCommand Foxcommand : CommandManager.getInstance().commands) { 15 | final String commandName = Foxcommand.getCommandInfo().name(); 16 | if (commandName.equals(args[0])) { 17 | sender.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "Fox" + ChatColor.GRAY + "]" + " Usage: /fox " + 18 | Foxcommand.getCommandInfo().name() + " " + 19 | Foxcommand.getCommandInfo().syntax()); 20 | return true; 21 | } 22 | } 23 | return false; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/KB.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.command.impl; 2 | 3 | import dev.isnow.fox.command.CommandInfo; 4 | import dev.isnow.fox.command.FoxCommand; 5 | import dev.isnow.fox.config.Config; 6 | import dev.isnow.fox.data.PlayerData; 7 | import dev.isnow.fox.manager.PlayerDataManager; 8 | import dev.isnow.fox.util.ColorUtil; 9 | import org.bukkit.Bukkit; 10 | import org.bukkit.command.Command; 11 | import org.bukkit.command.CommandSender; 12 | import org.bukkit.entity.Player; 13 | import org.bukkit.util.Vector; 14 | 15 | @CommandInfo(name = "kb", syntax = "", purpose = "Test player for anti-kb") 16 | public final class KB extends FoxCommand 17 | { 18 | @Override 19 | protected boolean handle(final CommandSender sender, final Command command, final String label, final String[] args) { 20 | if (args.length == 2) { 21 | final Player player = Bukkit.getPlayer(args[1]); 22 | if (player != null) { 23 | final PlayerData playerData = PlayerDataManager.getInstance().getPlayerData(player); 24 | if (playerData != null) { 25 | player.setVelocity(new Vector(4, 8, 1)); 26 | this.sendMessage(sender, ColorUtil.translate(Config.KBTEST.replaceAll("%player%", playerData.getPlayer().getName()))); 27 | return true; 28 | } 29 | } 30 | } 31 | return false; 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Logs.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.command.impl; 4 | 5 | import dev.isnow.fox.check.Check; 6 | import dev.isnow.fox.command.CommandInfo; 7 | import dev.isnow.fox.command.FoxCommand; 8 | import dev.isnow.fox.data.PlayerData; 9 | import dev.isnow.fox.manager.PlayerDataManager; 10 | import dev.isnow.fox.util.ColorUtil; 11 | import org.bukkit.Bukkit; 12 | import org.bukkit.command.Command; 13 | import org.bukkit.command.CommandSender; 14 | import org.bukkit.entity.Player; 15 | 16 | @CommandInfo(name = "logs", purpose = "Shows all violations a player has made.", syntax = "") 17 | public final class Logs extends FoxCommand { 18 | @Override 19 | protected boolean handle(final CommandSender sender, final Command command, final String label, final String[] args) { 20 | if (args.length == 2) { 21 | final Player player = Bukkit.getPlayer(args[1]); 22 | 23 | if (player != null) { 24 | final PlayerData playerData = PlayerDataManager.getInstance().getPlayerData(player); 25 | 26 | if (playerData != null) { 27 | sendLineBreak(sender); 28 | sendMessage(sender, ColorUtil.translate("&cViolations for &c" + playerData.getPlayer().getName() + "&a.")); 29 | 30 | for (final Check check : playerData.getChecks()) { 31 | if (check.getVl() > 0) { 32 | sendMessage(sender, String.format("&c %s &8(&c%s&8) VL:&c %s", check.getCheckInfo().name(), check.getCheckInfo().type(), check.getVl())); 33 | } 34 | } 35 | 36 | sendLineBreak(sender); 37 | 38 | return true; 39 | } 40 | } 41 | } 42 | 43 | return false; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Reload.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.command.impl; 2 | 3 | import dev.isnow.fox.Fox; 4 | import dev.isnow.fox.command.CommandInfo; 5 | import dev.isnow.fox.command.FoxCommand; 6 | import dev.isnow.fox.config.Config; 7 | import org.bukkit.ChatColor; 8 | import org.bukkit.command.Command; 9 | import org.bukkit.command.CommandSender; 10 | import org.bukkit.entity.Player; 11 | @CommandInfo(name = "reload", purpose = "Reloads the configs.") 12 | 13 | public class Reload extends FoxCommand { 14 | @Override 15 | protected boolean handle(CommandSender sender, Command command, String label, String[] args) { 16 | Player p = (Player) sender; 17 | p.sendMessage(ChatColor.GRAY + "Reloading Config"); 18 | Config.MAX_VIOLATIONS.clear(); 19 | Config.ENABLED_CHECKS.clear(); 20 | Fox.INSTANCE.getPlugin().reloadConfig(); 21 | Fox.INSTANCE.reloadConfig(); 22 | p.sendMessage(ChatColor.RED + "Successfully reloaded configs! (Experimental)"); 23 | 24 | return true; 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/command/impl/Scare.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.command.impl; 2 | 3 | import dev.isnow.fox.command.CommandInfo; 4 | import dev.isnow.fox.command.FoxCommand; 5 | import dev.isnow.fox.config.Config; 6 | import org.bukkit.Bukkit; 7 | import org.bukkit.command.Command; 8 | import org.bukkit.command.CommandSender; 9 | import org.bukkit.entity.Player; 10 | 11 | @CommandInfo(name = "scare", syntax = "", purpose = "Make player shit themselfs") 12 | public class Scare extends FoxCommand { 13 | protected boolean handle(CommandSender sender, Command command, String label, String[] args) { 14 | if (args.length == 2) { 15 | Player p = Bukkit.getPlayer(args[1]); 16 | final Player player = Bukkit.getPlayer(args[1]); 17 | if (p == null) { 18 | sendMessage(sender, "&cFailed To send!"); 19 | return true; 20 | } 21 | sendGameState(p, 10, 0.0F); 22 | sendMessage(sender, Config.SCARE.replaceAll("%player%", player.getName())); 23 | return true; 24 | } 25 | return false; 26 | } 27 | 28 | public void sendGameState(Player player, int type, float state) { 29 | try { 30 | Object entityPlayer = player.getClass().getMethod("getHandle", new Class[0]).invoke(player); 31 | Object playerConnection = entityPlayer.getClass().getField("playerConnection").get(entityPlayer); 32 | Object packet = getNMSClass("PacketPlayOutGameStateChange").getConstructor(new Class[] { int.class, float.class }).newInstance(Integer.valueOf(type), Float.valueOf(state)); 33 | playerConnection.getClass().getMethod("sendPacket", new Class[] { getNMSClass("Packet") }).invoke(playerConnection, packet); 34 | } catch (IllegalAccessException|IllegalArgumentException|java.lang.reflect.InvocationTargetException|NoSuchMethodException|SecurityException|NoSuchFieldException|InstantiationException e) { 35 | e.printStackTrace(); 36 | } 37 | } 38 | 39 | public Class getNMSClass(String name) { 40 | try { 41 | return Class.forName("net.minecraft.server." + getVersion() + "." + name); 42 | } catch (ClassNotFoundException e) { 43 | e.printStackTrace(); 44 | return null; 45 | } 46 | } 47 | 48 | public String getVersion() { 49 | return Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/config/ConfigValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.config; 4 | 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | public final class ConfigValue { 9 | @Setter 10 | private Object value; 11 | @Getter 12 | private final ValueType type; 13 | @Getter 14 | private final String name; 15 | 16 | public ConfigValue(final ValueType type, final String name) { 17 | this.type = type; 18 | this.name = name; 19 | } 20 | 21 | public boolean getBoolean() { 22 | return (boolean) value; 23 | } 24 | 25 | public double getDouble() { 26 | return (double) value; 27 | } 28 | 29 | public int getInt() { 30 | return (int) value; 31 | } 32 | 33 | public long getLong() { 34 | return (long) value; 35 | } 36 | 37 | public String getString() { 38 | return (String) value; 39 | } 40 | 41 | public enum ValueType { 42 | INTEGER, 43 | DOUBLE, 44 | BOOLEAN, 45 | STRING, 46 | LONG 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/data/processor/BotProcessor.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.data.processor; 2 | 3 | import dev.isnow.fox.data.PlayerData; 4 | import dev.isnow.fox.util.BotTypes; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter@Setter 9 | public class BotProcessor{ 10 | 11 | public int botID, rayCastEntityID, entityAReportedFlags, botTicks, entityATotalAttacks, movedBotTicks, randomBotSwingTicks, randomBotDamageTicks, rayCastFailHitTimes; 12 | public boolean hasBot, moveBot, WaitingForBot, hasRaycastBot, hasHitRaycast; 13 | public BotTypes botType; 14 | public double EntityAFollowDistance, rayCastEntityRoation; 15 | public float EntityAMovementOffset, EntityAStartYaw, rayCastStartYaw; 16 | public long lastEntitySpawn, entityHitTime, lastEntityBotHit, lastRaycastSpawn, lastRaycastGood, raycastEntity2HitTimes; 17 | public PlayerData forcedUser; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/data/processor/ClickProcessor.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.data.processor; 4 | 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import dev.isnow.fox.util.MathUtil; 8 | import dev.isnow.fox.util.type.EvictingList; 9 | import lombok.Getter; 10 | 11 | @Getter 12 | public final class ClickProcessor { 13 | 14 | private final PlayerData data; 15 | private long lastSwing = -1; 16 | private long delay; 17 | private int movements; 18 | private double cps, rate; 19 | private final EvictingList clicks = new EvictingList<>(10); 20 | 21 | public ClickProcessor(final PlayerData data) { 22 | this.data = data; 23 | } 24 | 25 | public void handleArmAnimation() { 26 | if (!data.getActionProcessor().isDigging() && !data.getActionProcessor().isPlacing()) { 27 | if (lastSwing > 0) { 28 | delay = System.currentTimeMillis() - lastSwing; 29 | } 30 | lastSwing = System.currentTimeMillis(); 31 | } 32 | 33 | final boolean exempt = data.getExemptProcessor().isExempt(ExemptType.PLACING, ExemptType.DIGGING); 34 | 35 | click: { 36 | if (exempt || movements > 5) break click; 37 | 38 | clicks.add(movements); 39 | } 40 | 41 | if (clicks.size() > 5) { 42 | final double cps = MathUtil.getCps(clicks); 43 | final double rate = cps * movements; 44 | 45 | this.cps = cps; 46 | this.rate = rate; 47 | } 48 | 49 | movements = 0; 50 | } 51 | 52 | public void handleFlying() { 53 | movements++; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/data/processor/GhostBlockProcessor.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.data.processor; 4 | 5 | import dev.isnow.fox.config.Config; 6 | import dev.isnow.fox.data.PlayerData; 7 | import dev.isnow.fox.exempt.type.ExemptType; 8 | import dev.isnow.fox.util.PlayerUtil; 9 | import lombok.Getter; 10 | 11 | 12 | @Getter 13 | public final class GhostBlockProcessor { 14 | 15 | private final PlayerData data; 16 | 17 | private boolean onGhostBlock, yGround, lastYGround; 18 | 19 | private int ghostTicks, buffer; 20 | 21 | public GhostBlockProcessor(final PlayerData data) { 22 | this.data = data; 23 | } 24 | 25 | public void handleFlying() { 26 | if (!Config.GHOST_BLOCK_ENABLED) return; 27 | 28 | onGhostBlock = false; 29 | 30 | if(Config.GHOST_BLOCK_MODE== Mode.FOX) { 31 | if(PlayerUtil.isOnBoat(data) || data.getExemptProcessor().isExempt(ExemptType.VEHICLE, ExemptType.WEB, ExemptType.CLIMBABLE, ExemptType.LIQUID, ExemptType.SLIME, ExemptType.TELEPORT, ExemptType.VELOCITY)) { 32 | return; 33 | } 34 | 35 | final boolean isBridingUp = data.getPositionProcessor().isPlacementUnder() && data.getPositionProcessor().getDeltaY() > 0.0; 36 | 37 | final boolean onGhostBlock = data.getPositionProcessor().isOnGround() && data.getPositionProcessor().getY() % 0.015625 < 0.03 && data.getPositionProcessor().isInAir(); 38 | 39 | final double deltaY = data.getPositionProcessor().getDeltaY(); 40 | final double lastDeltaY = data.getPositionProcessor().getLastDeltaY(); 41 | 42 | final int airTicks = data.getPositionProcessor().getAirTicks(); 43 | 44 | double predictedY = (lastDeltaY - 0.08) * 0.98F; 45 | if (Math.abs(predictedY) < 0.005) predictedY = 0.0; 46 | 47 | final boolean underGhostBlock = data.getPositionProcessor().getSinceBlockNearHeadTicks() > 3 48 | && Math.abs(deltaY - ((-0.08) * 0.98F)) < 1E-5 49 | && Math.abs(deltaY - predictedY) > 1E-5; 50 | 51 | this.onGhostBlock = onGhostBlock || underGhostBlock; 52 | 53 | if (onGhostBlock && airTicks > 5 && !isBridingUp) { 54 | data.dragDown(); 55 | data.getPlayer().sendMessage("Lagged Back for ghost blocks. [5170]"); 56 | } 57 | } 58 | } 59 | 60 | public enum Mode { 61 | FOX 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/exempt/ExemptProcessor.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.exempt; 4 | 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.exempt.type.ExemptType; 7 | import lombok.RequiredArgsConstructor; 8 | 9 | import java.util.Arrays; 10 | import java.util.function.Function; 11 | 12 | @RequiredArgsConstructor 13 | public final class ExemptProcessor { 14 | 15 | private final PlayerData data; 16 | 17 | public boolean isExempt(final ExemptType exemptType) { 18 | return exemptType.getException().apply(data); 19 | } 20 | 21 | public boolean isExempt(final ExemptType... exemptTypes) { 22 | return Arrays.stream(exemptTypes).anyMatch(this::isExempt); 23 | } 24 | 25 | public boolean isExempt(final Function exception) { 26 | return exception.apply(data); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/manager/AFKManager.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.manager; 2 | 3 | import org.bukkit.entity.Player; 4 | 5 | import java.util.HashMap; 6 | 7 | public class AFKManager 8 | { 9 | private final HashMap afkList; 10 | private final HashMap afkAmount; 11 | public static AFKManager INSTANCE; 12 | 13 | public AFKManager() { 14 | INSTANCE = this; 15 | this.afkList = new HashMap<>(); 16 | this.afkAmount = new HashMap<>(); 17 | } 18 | 19 | public boolean isAFK(final Player p) { 20 | if (this.afkList.containsKey(p)) { 21 | if (p.getLocation().getYaw() == this.afkList.get(p)) { 22 | return true; 23 | } 24 | this.afkList.remove(p); 25 | if (this.afkAmount.containsKey(p)) { 26 | this.afkAmount.remove(p); 27 | } 28 | } 29 | this.afkList.put(p, (int)p.getLocation().getYaw()); 30 | return false; 31 | } 32 | 33 | public void updatePlayer(final Player p) { 34 | if (this.isAFK(p)) { 35 | if (this.afkAmount.containsKey(p)) { 36 | this.afkAmount.put(p, this.afkAmount.get(p) + 1); 37 | } 38 | else { 39 | this.afkAmount.put(p, 1); 40 | } 41 | } 42 | } 43 | 44 | public void removePlayer(final Player p) { 45 | if (this.afkList.containsKey(p)) { 46 | this.afkList.remove(p); 47 | } 48 | if (this.afkAmount.containsKey(p)) { 49 | this.afkAmount.remove(p); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/manager/PlayerDataManager.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.manager; 4 | 5 | import dev.isnow.fox.data.PlayerData; 6 | import lombok.Getter; 7 | import org.bukkit.entity.Player; 8 | 9 | import java.util.*; 10 | import java.util.concurrent.ConcurrentHashMap; 11 | 12 | public final class PlayerDataManager { 13 | 14 | 15 | public List suspectedPlayers = new ArrayList<>(); 16 | 17 | @Getter 18 | private static final PlayerDataManager instance = new PlayerDataManager(); 19 | 20 | private final Map playerDataMap = new ConcurrentHashMap<>(); 21 | 22 | public PlayerData getPlayerData(final Player player) { 23 | return playerDataMap.get(player.getUniqueId()); 24 | } 25 | 26 | public void add(final Player player) { 27 | playerDataMap.put(player.getUniqueId(), new PlayerData(player)); 28 | } 29 | 30 | public boolean has(final Player player) { 31 | return this.playerDataMap.containsKey(player.getUniqueId()); 32 | } 33 | 34 | public void remove(final Player player) { 35 | playerDataMap.remove(player.getUniqueId()); 36 | } 37 | 38 | public Collection getAllData() { 39 | return playerDataMap.values(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/packet/PacketData.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.packet; 2 | 3 | import io.github.retrooper.packetevents.utils.vector.Vector3d; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | public class PacketData{ 8 | 9 | @Setter@Getter 10 | Vector3d vector; 11 | @Setter@Getter 12 | float yaw; 13 | @Setter@Getter 14 | float pitch; 15 | 16 | public PacketData(Vector3d vector, float yaw, float pitch) { 17 | this.vector = vector; 18 | this.yaw = yaw; 19 | this.pitch = pitch; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/packet/processor/SendingPacketProcessor.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.packet.processor; 4 | 5 | import dev.isnow.fox.data.PlayerData; 6 | import dev.isnow.fox.packet.Packet; 7 | import io.github.retrooper.packetevents.packetwrappers.play.out.entityvelocity.WrappedPacketOutEntityVelocity; 8 | import io.github.retrooper.packetevents.packetwrappers.play.out.position.WrappedPacketOutPosition; 9 | 10 | public final class SendingPacketProcessor { 11 | 12 | public void handle(final PlayerData data, final Packet packet) { 13 | if (packet.isVelocity()) { 14 | final WrappedPacketOutEntityVelocity wrapper = new WrappedPacketOutEntityVelocity(packet.getRawPacket()); 15 | 16 | if (wrapper.getEntityId() == data.getPlayer().getEntityId()) { 17 | data.getVelocityProcessor().handle(wrapper.getVelocity().getX(), wrapper.getVelocity().getY(), wrapper.getVelocity().getZ()); 18 | } 19 | } 20 | if (packet.isTeleport()) { 21 | final WrappedPacketOutPosition wrapper = new WrappedPacketOutPosition(packet.getRawPacket()); 22 | 23 | data.getPositionProcessor().handleTeleport(wrapper); 24 | } 25 | data.getChecks().forEach(check -> check.handle(packet)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/update/UpdateChecker.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.update; 4 | 5 | import lombok.Getter; 6 | import org.bukkit.Bukkit; 7 | 8 | import java.io.BufferedReader; 9 | import java.io.IOException; 10 | import java.io.InputStreamReader; 11 | import java.net.HttpURLConnection; 12 | import java.net.URL; 13 | 14 | @Getter 15 | public final class UpdateChecker { 16 | 17 | private URL apiUrl; 18 | private String currentVersion = "B13"; 19 | private String latestVersion; 20 | 21 | public UpdateChecker() { 22 | try { 23 | apiUrl = new URL("https://pastebin.com/raw/QPjtQiJP"); 24 | } catch (final Exception ignored) { 25 | } 26 | 27 | try { 28 | if(isUpdateAvailable()) { 29 | Bukkit.getConsoleSender().sendMessage("fox UPDATE IS AVAILABLE! NEWEST VERSION: " + latestVersion); 30 | } 31 | } catch(IOException e) { 32 | return; 33 | } 34 | } 35 | 36 | public boolean isUpdateAvailable() throws IOException { 37 | final HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection(); 38 | 39 | connection.setConnectTimeout(5000); 40 | connection.connect(); 41 | 42 | latestVersion = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); 43 | 44 | return !latestVersion.equalsIgnoreCase(currentVersion); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/BotTypes.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util; 2 | 3 | public enum BotTypes { 4 | NORMAL, 5 | WATCHDOG, 6 | FOLLOW 7 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/ColorUtil.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.util; 4 | 5 | import lombok.experimental.UtilityClass; 6 | import org.bukkit.ChatColor; 7 | 8 | @UtilityClass 9 | public class ColorUtil { 10 | 11 | public String translate(final String string) { 12 | return ChatColor.translateAlternateColorCodes('&', string); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/MovingStats.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.util; 4 | 5 | import java.io.Serializable; 6 | 7 | 8 | public final class MovingStats implements Serializable { 9 | 10 | 11 | private final double[] elements; 12 | 13 | 14 | private int currentElement; 15 | private int windowCount; 16 | 17 | private double variance; 18 | 19 | public MovingStats(final int size) { 20 | this.elements = new double[size]; 21 | this.variance = size * 2.5; 22 | 23 | 24 | for (int i = 0, len = this.elements.length; i < len; i++) { 25 | this.elements[i] = size * 2.5 / size; 26 | } 27 | } 28 | 29 | public void add(double sum) { 30 | sum /= this.elements.length; 31 | 32 | this.variance -= this.elements[currentElement]; 33 | this.variance += sum; 34 | 35 | 36 | this.elements[currentElement] = sum; 37 | 38 | 39 | this.currentElement = (currentElement + 1) % this.elements.length; 40 | } 41 | 42 | public double getStdDev(final double required) { 43 | final double stdDev = Math.sqrt(variance); 44 | 45 | 46 | if (stdDev < required) { 47 | 48 | if (++windowCount > this.elements.length) { 49 | return stdDev; 50 | } 51 | } else { 52 | 53 | if (windowCount > 0) { 54 | windowCount = 0; 55 | } 56 | 57 | return required; 58 | } 59 | 60 | 61 | return Double.NaN; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/ServerUtil.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.util; 4 | 5 | import io.github.retrooper.packetevents.PacketEvents; 6 | import io.github.retrooper.packetevents.utils.server.ServerVersion; 7 | import lombok.experimental.UtilityClass; 8 | import org.bukkit.Location; 9 | import org.bukkit.block.Block; 10 | 11 | @UtilityClass 12 | public class ServerUtil { 13 | 14 | public double getTPS() { 15 | return Math.min(20.0, PacketEvents.get().getServerUtils().getTPS()); 16 | } 17 | 18 | public ServerVersion getServerVersion() { 19 | return PacketEvents.get().getServerUtils().getVersion(); 20 | } 21 | 22 | public boolean isLowerThan1_8() { 23 | return getServerVersion().isLowerThan(ServerVersion.v_1_8); 24 | } 25 | 26 | public static Block getBlockAsync(Location loc) { 27 | if (loc.getWorld().isChunkLoaded(loc.getBlockX() >> 4, loc.getBlockZ() >> 4)) 28 | return loc.getBlock(); 29 | return null; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/TimeUtils.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | public class TimeUtils { 7 | public static long CurrentMS() { 8 | return System.currentTimeMillis(); 9 | } 10 | 11 | public static boolean Passed(long from, long required) { 12 | return System.currentTimeMillis() - from > required; 13 | } 14 | 15 | public static boolean elapsed(long time, long needed) { 16 | return Math.abs(System.currentTimeMillis() - time) >= needed; 17 | } 18 | 19 | public static String GetDate() { 20 | Date now = new Date(); 21 | SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); 22 | return format.format(now); 23 | } 24 | 25 | public static long Remainder(long start, long required) { 26 | return required + start - System.currentTimeMillis(); 27 | } 28 | 29 | public static long elapsed(final long time) { 30 | return Math.abs(System.currentTimeMillis() - time); 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/Verbose.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util; 2 | 3 | public class Verbose { 4 | private int verbose; 5 | private long lastFlagTime; 6 | 7 | public boolean flag(int amount) { 8 | lastFlagTime = System.currentTimeMillis(); 9 | return (verbose++) > amount; 10 | } 11 | 12 | public boolean flag(int amount, long reset) { 13 | if (!TimeUtils.Passed(lastFlagTime, reset)) { 14 | lastFlagTime = System.currentTimeMillis(); 15 | return (verbose++) > amount; 16 | } 17 | verbose = 0; 18 | lastFlagTime = System.currentTimeMillis(); 19 | return false; 20 | } 21 | 22 | public int getVerbose() { 23 | return verbose; 24 | } 25 | 26 | public void setVerbose(int verbose) { 27 | this.verbose = verbose; 28 | } 29 | 30 | public void takeaway() { 31 | verbose = verbose > 0 ? verbose - 1 : 0; 32 | } 33 | 34 | public void takeaway(int amount) { 35 | verbose = verbose > 0 ? verbose - amount : 0; 36 | } 37 | 38 | public boolean flag(int amount, long reset, int toAdd) { 39 | if (!TimeUtils.elapsed(lastFlagTime, reset)) { 40 | lastFlagTime = System.currentTimeMillis(); 41 | return (verbose += toAdd) > amount; 42 | } 43 | verbose = 0; 44 | lastFlagTime = System.currentTimeMillis(); 45 | return false; 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/WrappedBlockUtil.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util; 2 | 3 | import dev.isnow.fox.util.type.AABB; 4 | import dev.isnow.fox.util.type.WrappedBlock; 5 | import org.bukkit.block.Block; 6 | import org.bukkit.entity.HumanEntity; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.util.Vector; 9 | public abstract class WrappedBlockUtil { 10 | 11 | public final Block obBlock; 12 | public float strength; 13 | public AABB hitbox; 14 | public AABB[] collisionBoxes; 15 | public boolean solid; 16 | public float slipperiness; 17 | public int clientVersion; 18 | 19 | public WrappedBlockUtil(Block obBlock, int clientVersion) { 20 | this.obBlock = obBlock; 21 | this.clientVersion = clientVersion; 22 | } 23 | 24 | 25 | public abstract Object getNMS(); 26 | 27 | public abstract void sendPacketToPlayer(Player p); 28 | 29 | //Returns the amount of damage to apply to this block at this tick, 30 | //given that an entity is currently mining it. 31 | public abstract float getDamage(HumanEntity entity); 32 | 33 | public abstract boolean isMaterialAlwaysDestroyable(); 34 | 35 | public float getStrength() { 36 | return strength; 37 | } 38 | 39 | public Block getBukkitBlock() { 40 | return obBlock; 41 | } 42 | 43 | public AABB getHitBox() { 44 | return hitbox; 45 | } 46 | 47 | public AABB[] getCollisionBoxes() { 48 | return collisionBoxes; 49 | } 50 | 51 | public boolean isColliding(AABB other) { 52 | for (AABB cBox : collisionBoxes) { 53 | if (cBox.isColliding(other)) 54 | return true; 55 | } 56 | return false; 57 | } 58 | 59 | public static WrappedBlock getWrappedBlock(Block b, int clientVersion) { 60 | return new WrappedBlock(b, clientVersion); 61 | } 62 | 63 | public float getSlipperiness() { 64 | return slipperiness; 65 | } 66 | 67 | public boolean isSolid() { 68 | return solid; 69 | } 70 | 71 | public Vector getFlowDirection() { 72 | return new Vector(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/WrappedEntityHumanUtil.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util; 2 | 3 | import org.bukkit.block.Block; 4 | 5 | public interface WrappedEntityHumanUtil { 6 | 7 | boolean canHarvestBlock(Block block); 8 | 9 | /** 10 | * Returns how strong the player is against the specified block at this moment 11 | */ 12 | float getCurrentPlayerStrVsBlock(Block block, boolean flag); 13 | 14 | void releaseItem(); 15 | 16 | boolean usingItem(); 17 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/WrappedEntityUtil.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util; 2 | 3 | import dev.isnow.fox.util.type.AABB; 4 | import dev.isnow.fox.util.type.WrappedEntity; 5 | import org.bukkit.Location; 6 | import org.bukkit.entity.Entity; 7 | import org.bukkit.util.Vector; 8 | 9 | public abstract class WrappedEntityUtil { 10 | 11 | public AABB collisionBox; 12 | public float collisionBorderSize; 13 | public float length; 14 | public float width; 15 | public float height; 16 | public Location location; 17 | 18 | public static WrappedEntity getWrappedEntity(Entity entity) { 19 | return WrappedEntity.getWrappedEntity(entity); 20 | } 21 | 22 | public AABB getCollisionBox(Vector entityPos) { 23 | Vector move = entityPos.clone().subtract(location.toVector()); 24 | AABB box = getCollisionBox().clone(); 25 | box.translate(move); 26 | return box; 27 | } 28 | 29 | public AABB getHitbox(Vector entityPos) { 30 | AABB box = getCollisionBox(entityPos); 31 | box.expand(collisionBorderSize, collisionBorderSize, collisionBorderSize); 32 | return box; 33 | } 34 | 35 | public AABB getCollisionBox() { 36 | return collisionBox; 37 | } 38 | 39 | public AABB getHitbox() { 40 | AABB hitbox = collisionBox.clone(); 41 | hitbox.expand(collisionBorderSize, collisionBorderSize, collisionBorderSize); 42 | return hitbox; 43 | } 44 | 45 | public float getLength() { 46 | return length; 47 | } 48 | 49 | public float getWidth() { 50 | return width; 51 | } 52 | 53 | public float getHeight() { 54 | return height; 55 | } 56 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/WrappedItemStackUtil.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util; 2 | 3 | import dev.isnow.fox.util.type.WrappedItemStack; 4 | import org.bukkit.block.Block; 5 | import org.bukkit.inventory.ItemStack; 6 | 7 | public abstract class WrappedItemStackUtil { 8 | 9 | public static WrappedItemStack getWrappedItemStack(ItemStack obiItemStack) { 10 | return new WrappedItemStack(obiItemStack); 11 | } 12 | 13 | public abstract float getDestroySpeed(Block obbBlock); 14 | 15 | public abstract boolean canDestroySpecialBlock(Block obbBlock); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/reach/CollisionBox.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.reach; 2 | 3 | 4 | 5 | import dev.isnow.fox.util.reach.reach.SimpleCollisionBox; 6 | 7 | import java.util.List; 8 | 9 | public interface CollisionBox { 10 | boolean isCollided(SimpleCollisionBox other); 11 | 12 | boolean isIntersected(SimpleCollisionBox other); 13 | 14 | CollisionBox copy(); 15 | 16 | CollisionBox offset(double x, double y, double z); 17 | 18 | void downCast(List list); 19 | 20 | boolean isNull(); 21 | 22 | boolean isFullBlock(); 23 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/reach/reach/GetBoundingBox.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.reach.reach; 2 | 3 | public class GetBoundingBox { 4 | public static SimpleCollisionBox getBoundingBoxFromPosAndSize(double centerX, double minY, double centerZ, double width, double height) { 5 | double minX = centerX - (width / 2); 6 | double maxX = centerX + (width / 2); 7 | double maxY = minY + height; 8 | double minZ = centerZ - (width / 2); 9 | double maxZ = centerZ + (width / 2); 10 | 11 | return new SimpleCollisionBox(minX, minY, minZ, maxX, maxY, maxZ, false); 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/reach/reach/VanillaMath.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.reach.reach; 2 | 3 | public class VanillaMath { 4 | private static final float[] SIN = new float[65536]; 5 | 6 | static { 7 | for (int i = 0; i < SIN.length; ++i) { 8 | SIN[i] = (float) StrictMath.sin((double) i * 3.141592653589793 * 2.0 / 65536.0); 9 | } 10 | } 11 | 12 | public static float sin(float f) { 13 | return SIN[(int) (f * 10430.378f) & 0xFFFF]; 14 | } 15 | 16 | public static float cos(float f) { 17 | return SIN[(int) (f * 10430.378f + 16384.0f) & 0xFFFF]; 18 | } 19 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/CollideEntry.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.type; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import org.bukkit.block.Block; 6 | import org.bukkit.util.NumberConversions; 7 | 8 | @AllArgsConstructor @Getter 9 | public class CollideEntry { 10 | private final Block block; 11 | private final BoundingBox boundingBox; 12 | 13 | public boolean isChunkLoaded() { 14 | return block.getLocation().getWorld().isChunkLoaded( 15 | NumberConversions.floor(block.getLocation().getX()) >> 4, 16 | NumberConversions.floor(block.getLocation().getZ()) >> 4); 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/ConcurrentEvictingList.java: -------------------------------------------------------------------------------- 1 | 2 | package dev.isnow.fox.util.type; 3 | 4 | import lombok.Getter; 5 | 6 | import java.util.Collection; 7 | import java.util.concurrent.ConcurrentLinkedDeque; 8 | 9 | @Getter 10 | public final class ConcurrentEvictingList extends ConcurrentLinkedDeque { 11 | 12 | private final int maxSize; 13 | 14 | public ConcurrentEvictingList(final int maxSize) { 15 | this.maxSize = maxSize; 16 | } 17 | 18 | public ConcurrentEvictingList(final Collection c, final int maxSize) { 19 | super(c); 20 | this.maxSize = maxSize; 21 | } 22 | 23 | @Override 24 | public boolean add(final T t) { 25 | if (size() >= getMaxSize()) removeFirst(); 26 | return super.add(t); 27 | } 28 | 29 | public boolean isFull() { 30 | return size() >= getMaxSize(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/CustomLocation.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.util.type; 4 | 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import org.bukkit.Location; 8 | import org.bukkit.World; 9 | import org.bukkit.util.Vector; 10 | 11 | @Getter 12 | @Setter 13 | public final class CustomLocation { 14 | 15 | private World world; 16 | private double x, y, z; 17 | private float yaw, pitch; 18 | private boolean onGround; 19 | private long timeStamp; 20 | 21 | public CustomLocation(final World world, final double x, final double y, final double z, final float yaw, final float pitch, final boolean onGround) { 22 | this.world = world; 23 | this.x = x; 24 | this.y = y; 25 | this.z = z; 26 | this.yaw = yaw; 27 | this.pitch = pitch; 28 | this.onGround = onGround; 29 | this.timeStamp = System.nanoTime() / 10000; 30 | } 31 | 32 | public Vector toVector() { 33 | return new Vector(x, y, z); 34 | } 35 | 36 | public CustomLocation offset(final double x, final double y, final double z, final float yaw, final float pitch) { 37 | return new CustomLocation(world, this.x + x, this.y + y, this.z + z, this.yaw + yaw, this.pitch + pitch, this.onGround); 38 | } 39 | 40 | public CustomLocation clone() { 41 | return new CustomLocation(world, x, y, z, yaw, pitch, onGround); 42 | } 43 | 44 | public static CustomLocation fromBukkit(final Location location) { 45 | return new CustomLocation(location.getWorld(), location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), false); 46 | } 47 | 48 | public Location toBukkit(){ return new Location(world, x, y, z); } 49 | 50 | public Vector getDirection() { 51 | final Vector vector = new Vector(); 52 | final double rotX = this.getYaw(); 53 | final double rotY = this.getPitch(); 54 | vector.setY(-Math.sin(Math.toRadians(rotY))); 55 | final double xz = Math.cos(Math.toRadians(rotY)); 56 | vector.setX(-xz * Math.sin(Math.toRadians(rotX))); 57 | vector.setZ(xz * Math.cos(Math.toRadians(rotX))); 58 | return vector; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/EntityHelper.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.type; 2 | 3 | import net.minecraft.server.v1_8_R3.EntityPlayer; 4 | import net.minecraft.server.v1_8_R3.EntityZombie; 5 | 6 | public class EntityHelper { 7 | public EntityZombie entityZombie, entityPlayer2; 8 | public EntityPlayer entityPlayer; 9 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/EvictingList.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.util.type; 4 | 5 | import lombok.Getter; 6 | 7 | import java.util.Collection; 8 | import java.util.LinkedList; 9 | 10 | public final class EvictingList extends LinkedList { 11 | 12 | @Getter 13 | private final int maxSize; 14 | 15 | public EvictingList(final int maxSize) { 16 | this.maxSize = maxSize; 17 | } 18 | 19 | public EvictingList(final Collection c, final int maxSize) { 20 | super(c); 21 | this.maxSize = maxSize; 22 | } 23 | 24 | @Override 25 | public boolean add(final T t) { 26 | if (size() >= getMaxSize()) removeFirst(); 27 | return super.add(t); 28 | } 29 | 30 | public boolean isFull() { 31 | return size() >= getMaxSize(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/EvictingMap.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.util.type; 4 | 5 | import lombok.Getter; 6 | import lombok.RequiredArgsConstructor; 7 | 8 | import java.util.Deque; 9 | import java.util.HashMap; 10 | import java.util.LinkedList; 11 | import java.util.Map; 12 | 13 | @RequiredArgsConstructor 14 | public final class EvictingMap extends HashMap { 15 | @Getter private final int size; 16 | private final Deque storedKeys = new LinkedList<>(); 17 | 18 | @Override 19 | public boolean remove(final Object key, final Object value) { 20 | storedKeys.remove(key); 21 | return super.remove(key, value); 22 | } 23 | 24 | @Override 25 | public V putIfAbsent(final K key, final V value) { 26 | if(!storedKeys.contains(key) || !get(key).equals(value)) 27 | checkAndRemove(); 28 | return super.putIfAbsent(key, value); 29 | } 30 | 31 | @Override 32 | public V put(final K key, final V value) { 33 | checkAndRemove(); 34 | storedKeys.addLast(key); 35 | return super.put(key, value); 36 | } 37 | 38 | @Override 39 | public void putAll(final Map m) { 40 | m.forEach(this::put); 41 | } 42 | 43 | @Override 44 | public void clear() { 45 | storedKeys.clear(); 46 | super.clear(); 47 | } 48 | 49 | @Override 50 | public V remove(final Object key) { 51 | storedKeys.remove(key); 52 | return super.remove(key); 53 | } 54 | 55 | private boolean checkAndRemove() { 56 | if(storedKeys.size() >= size) { 57 | final K key = storedKeys.removeFirst(); 58 | 59 | remove(key); 60 | return true; 61 | } 62 | return false; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/HitboxExpansion.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.type; 2 | 3 | import lombok.Getter; 4 | import org.bukkit.entity.Entity; 5 | 6 | @Getter 7 | public enum HitboxExpansion { 8 | 9 | PLAYER("Player", 0.41), 10 | CREEPER("Creeper", 0.4), 11 | SKELETON("Skeleton", 0.4), 12 | SPIDER("Spider", 0.8), 13 | GIANT("Giant", 2.5), 14 | ZOMBIE("Zombie", 0.4), 15 | SLIME("Slime", 1.12), //Works for large slimes only for now. 16 | GHAST("Ghast", 2.1), 17 | PIG_ZOMBIE("PigZombie", 0.4), 18 | ENDERMAN("Enderman", 0.4), 19 | CAVE_SPIDER("CaveSpider", 0.45), 20 | SILVERFISH("Silverfish", 0.3), 21 | BLAZE("Blaze", 0.4), 22 | MAGMA_CUBE("LavaSlime", 1.12), 23 | ENDER_DRAGON("EnderDragon", 8.1), 24 | WITHER("WitherBoss", 0.55), 25 | BAT("Bat", 0.35), 26 | WITCH("Witch", 0.4), 27 | ENDERMITE("Endermite", 0.3), 28 | GUARDIAN("Guardian",0.525), 29 | PIG("Pig", 0.55), //Works for both baby and grown pigs. 30 | SHEEP("Sheep", 0.55), 31 | COW("Cow", 0.55), 32 | CHICKEN("Chicken", 0.3), //Works for both baby and grown chickens. 33 | SQUID("Squid", 0.5), 34 | WOLF("Wolf", 0.5), //Works for both baby and grown wolves. 35 | MUSHROOM_COW("MushroomCow", 0.55), 36 | SNOWMAN("SnowMan", 0.45), 37 | OCELOT("Ozelot", 0.4), 38 | IRON_GOLEM("VillagerGolem", 0.8), 39 | HORSE("EntityHorse", 0.7982), 40 | RABBIT("Rabbit", 0.3), //Works for both baby and grown rabbits. 41 | VILLAGER("Villager", 0.4); 42 | 43 | private final double expansion; 44 | private final String name; 45 | 46 | HitboxExpansion(final String name, final double expansion) { 47 | this.name = name; 48 | this.expansion = expansion; 49 | } 50 | 51 | public static double getExpansion(final Entity entity) { 52 | for (HitboxExpansion hitboxExpansion : values()) { 53 | final String name = entity.getType().getName(); 54 | if (name != null) { 55 | if (name.equalsIgnoreCase(hitboxExpansion.getName())) { 56 | return hitboxExpansion.getExpansion(); 57 | } 58 | } 59 | } 60 | return 0.4D; 61 | } 62 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/LimitedDouble.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.type; 2 | 3 | public class LimitedDouble { 4 | final float min; 5 | final float max; 6 | float value; 7 | 8 | public LimitedDouble(final float min, final float max, final float value) { 9 | this.value = 0.0f; 10 | this.min = min; 11 | this.max = max; 12 | this.value = value; 13 | this.fix(); 14 | } 15 | 16 | public LimitedDouble(final float n, final float max) { 17 | this.value = 0.0f; 18 | this.min = n; 19 | this.max = max; 20 | this.value = n; 21 | } 22 | 23 | public void addValue(final float n) { 24 | this.value += n; 25 | this.fix(); 26 | } 27 | 28 | public void reset() { 29 | this.value = this.min; 30 | } 31 | 32 | public float getValue() { 33 | return this.value; 34 | } 35 | 36 | public void setValue(final float value) { 37 | this.value = value; 38 | this.fix(); 39 | } 40 | 41 | public float getMin() { 42 | return this.min; 43 | } 44 | 45 | public float getMax() { 46 | return this.max; 47 | } 48 | 49 | void fix() { 50 | this.value = Math.min(this.max, Math.max(this.min, this.value)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/Pair.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.util.type; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | 8 | @Data @AllArgsConstructor 9 | public final class Pair { 10 | private X x; 11 | private Y y; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/RayTrace.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.type; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.util.Vector; 5 | 6 | public class RayTrace { 7 | 8 | public final Vector origin; 9 | public final Vector direction; 10 | 11 | public RayTrace(final Vector origin, final Vector direction) { 12 | this.origin = origin; 13 | this.direction = direction; 14 | } 15 | 16 | public Vector getPointAtDistance(double distance) { 17 | Vector dir = new Vector(direction.getX(), direction.getY(), direction.getZ()); 18 | Vector orig = new Vector(origin.getX(), origin.getY(), origin.getZ()); 19 | return orig.add(dir.multiply(distance)); 20 | } 21 | 22 | public RayTrace(final Player player) { 23 | this.origin = player.getEyeLocation().toVector(); 24 | this.direction = player.getEyeLocation().getDirection(); 25 | } 26 | 27 | public double origin(int i) { 28 | switch (i) { 29 | case 0: 30 | return origin.getX(); 31 | case 1: 32 | return origin.getY(); 33 | case 2: 34 | return origin.getZ(); 35 | default: 36 | return 0; 37 | } 38 | } 39 | 40 | public double direction(int i) { 41 | switch (i) { 42 | case 0: 43 | return direction.getX(); 44 | case 1: 45 | return direction.getY(); 46 | case 2: 47 | return direction.getZ(); 48 | default: 49 | return 0; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/Velocity.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package dev.isnow.fox.util.type; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | @Getter @Setter 10 | @AllArgsConstructor 11 | public final class Velocity { 12 | private int index; 13 | private double velocityX, velocityY, velocityZ; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/VpnInfo.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.type; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | @Getter@Setter 7 | public class VpnInfo { 8 | 9 | String country = "N/A"; 10 | Boolean isVpn = true; 11 | 12 | public VpnInfo(String country, boolean isVPN) { 13 | this.isVpn = isVPN; 14 | this.country = country; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/WrappedEntity.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.type; 2 | 3 | import dev.isnow.fox.util.WrappedEntityUtil; 4 | import net.minecraft.server.v1_8_R3.AxisAlignedBB; 5 | import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; 6 | import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity; 7 | import org.bukkit.entity.Entity; 8 | import org.bukkit.util.Vector; 9 | 10 | public class WrappedEntity extends WrappedEntityUtil { 11 | 12 | protected net.minecraft.server.v1_8_R3.Entity nmsEntity; 13 | 14 | public WrappedEntity(Entity entity) { 15 | super(); 16 | nmsEntity = ((CraftEntity) entity).getHandle(); 17 | AxisAlignedBB bb = nmsEntity.getBoundingBox(); 18 | collisionBox = new AABB(new Vector(bb.a, bb.b, bb.c), new Vector(bb.d, bb.e, bb.f)); 19 | collisionBorderSize = nmsEntity.ao(); 20 | location = entity.getLocation(); 21 | length = nmsEntity.width; 22 | width = nmsEntity.width; 23 | height = nmsEntity.length; 24 | } 25 | 26 | public static WrappedEntity getWrappedEntity(Entity entity) { 27 | if(entity instanceof CraftHumanEntity) 28 | return new WrappedEntityHuman(entity); 29 | else 30 | return new WrappedEntity(entity); 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/WrappedEntityHuman.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.type; 2 | 3 | import dev.isnow.fox.util.WrappedEntityHumanUtil; 4 | import net.minecraft.server.v1_8_R3.EntityHuman; 5 | import org.bukkit.block.Block; 6 | import org.bukkit.entity.Entity; 7 | 8 | public class WrappedEntityHuman extends WrappedEntity implements WrappedEntityHumanUtil { 9 | 10 | public WrappedEntityHuman(Entity entity) { 11 | super(entity); 12 | } 13 | 14 | @Override 15 | public boolean canHarvestBlock(Block block) { 16 | Object obj = WrappedBlock.getWrappedBlock(block, 8).getNMS(); 17 | net.minecraft.server.v1_8_R3.Block b = (net.minecraft.server.v1_8_R3.Block) obj; 18 | return ((EntityHuman) nmsEntity).b(b); 19 | } 20 | 21 | @Override 22 | public float getCurrentPlayerStrVsBlock(Block block, boolean flag) { 23 | Object obj = WrappedBlock.getWrappedBlock(block, 8).getNMS(); 24 | net.minecraft.server.v1_8_R3.Block b = (net.minecraft.server.v1_8_R3.Block) obj; 25 | return ((EntityHuman) nmsEntity).a(b); 26 | } 27 | 28 | @Override 29 | public void releaseItem() { 30 | ((EntityHuman) nmsEntity).bU(); 31 | } 32 | 33 | @Override 34 | public boolean usingItem() { 35 | return ((EntityHuman) nmsEntity).bS(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/isnow/fox/util/type/WrappedItemStack.java: -------------------------------------------------------------------------------- 1 | package dev.isnow.fox.util.type; 2 | 3 | import dev.isnow.fox.util.WrappedItemStackUtil; 4 | import org.bukkit.block.Block; 5 | import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | public class WrappedItemStack extends WrappedItemStackUtil { 9 | private net.minecraft.server.v1_8_R3.ItemStack itemStack; 10 | 11 | public WrappedItemStack(ItemStack obiItemStack) { 12 | itemStack = CraftItemStack.asNMSCopy(obiItemStack); 13 | } 14 | 15 | @Override 16 | public float getDestroySpeed(Block obbBlock) { 17 | net.minecraft.server.v1_8_R3.Block block = 18 | (net.minecraft.server.v1_8_R3.Block) WrappedBlock.getWrappedBlock(obbBlock, 8).getNMS(); 19 | if(itemStack == null) 20 | return 1F; 21 | return itemStack.a(block); 22 | } 23 | 24 | @Override 25 | public boolean canDestroySpecialBlock(Block obbBlock) { 26 | net.minecraft.server.v1_8_R3.Block block = 27 | (net.minecraft.server.v1_8_R3.Block) WrappedBlock.getWrappedBlock(obbBlock, 8).getNMS(); 28 | if(itemStack == null) 29 | return false; 30 | return itemStack.b(block); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: Fox 2 | version: 0.1-ALPHA 3 | main: dev.isnow.fox.FoxPlugin 4 | authors: ["5170", RealTrippy] 5 | description: Fox AntiCheat 6 | 7 | commands: 8 | fox: 9 | description: Commands for Fox Anticheat. 10 | usage: /fox 11 | aliases: [foxac, fac, fag] 12 | permission: fox.commands 13 | alerts: 14 | description: toggle alerts 15 | usage: /alerts 16 | aliases: 17 | - notify 18 | permission: fox.alerts 19 | vanish: 20 | description: Become invisable 21 | usage: /vanish [Player] 22 | aliases: 23 | - v 24 | - becomeinvisable 25 | permission: fox.vanish 26 | softdepend: 27 | - ProtocolLib 28 | - ProtocolSupport 29 | - ViaVersion 30 | - Geyser-Spigot --------------------------------------------------------------------------------