Skip to content

Commit

Permalink
Adding all files back
Browse files Browse the repository at this point in the history
  • Loading branch information
funkemunky committed Sep 5, 2020
1 parent 9a5b387 commit 09b946c
Show file tree
Hide file tree
Showing 200 changed files with 15,531 additions and 0 deletions.
28 changes: 28 additions & 0 deletions API/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>Kauri</artifactId>
<groupId>dev.brighten.anticheat</groupId>
<version>2.9.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>API</artifactId>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>

</project>
20 changes: 20 additions & 0 deletions API/src/main/java/dev/brighten/api/KauriAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package dev.brighten.api;

import dev.brighten.api.handlers.ExemptHandler;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

public class KauriAPI {

public static KauriAPI INSTANCE;

public ExemptHandler exemptHandler;
public ScheduledExecutorService service;

public KauriAPI() {
INSTANCE = this;
exemptHandler = new ExemptHandler();
service = Executors.newSingleThreadScheduledExecutor();
}
}
6 changes: 6 additions & 0 deletions API/src/main/java/dev/brighten/api/check/CheckType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package dev.brighten.api.check;

public enum CheckType {
AIM, HITBOX, AUTOCLICKER, BADPACKETS, KILLAURA, SPEED, FLIGHT, VELOCITY, GENERAL, HAND, NOFALL, BLOCK,
EXPLOIT, INVENTORY
}
16 changes: 16 additions & 0 deletions API/src/main/java/dev/brighten/api/check/KauriCheck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package dev.brighten.api.check;

public interface KauriCheck {
String getName();
String getDescription();
boolean isEnabled();
boolean isExecutable();
boolean isDeveloper();
CheckType getCheckType();
float getVl();
float getPunishVl();
void setEnabled(boolean enabled);
void setExecutable(boolean executable);
void setVl(float vl);
void setPunishVl(float pvl);
}
63 changes: 63 additions & 0 deletions API/src/main/java/dev/brighten/api/handlers/ExemptHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package dev.brighten.api.handlers;

import dev.brighten.api.KauriAPI;
import dev.brighten.api.check.CheckType;
import dev.brighten.api.check.KauriCheck;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;

public class ExemptHandler {

private static List<Exemption> exemptList = new ArrayList<>();

public Exemption addExemption(UUID uuid, KauriCheck... checks) {
Exemption exemption = exemptList.stream()
.filter(exempt -> exempt.uuid.equals(uuid))
.findFirst().orElseGet(() -> new Exemption(uuid, checks));

exemption.addChecks(checks);

exemptList.add(exemption);

return exemption;
}

//Adds temporary exception.
public Exemption addExemption(UUID uuid, long millisLater, Consumer<Exemption> onRemove, KauriCheck... checks) {
Exemption exemption = addExemption(uuid, checks);

KauriAPI.INSTANCE.service.schedule(() -> {
if(exemption.getChecks().size() == checks.length) {
exemptList.remove(exemption);
} else Arrays.stream(checks)
.filter(check -> exemption.getChecks().contains(check))
.forEach(check -> exemption.getChecks().remove(check));

onRemove.accept(exemption);
}, millisLater, TimeUnit.MILLISECONDS);

return exemption;
}

public boolean isExempt(UUID uuid, KauriCheck... checks) {
Exemption exemption = getExemption(uuid);

return Arrays.stream(checks).anyMatch(check -> exemption.getChecks().contains(check));
}

public boolean isExempt(UUID uuid, CheckType... types) {
return getExemption(uuid).getChecks().stream().
anyMatch(check ->
Arrays.stream(types).anyMatch(type -> check.getCheckType().equals(type)));
}

public Exemption getExemption(UUID uuid) {
return exemptList.stream().filter(exempt -> exempt.uuid.equals(uuid)).findFirst()
.orElseGet(() -> addExemption(uuid));
}
}
29 changes: 29 additions & 0 deletions API/src/main/java/dev/brighten/api/handlers/Exemption.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package dev.brighten.api.handlers;

import dev.brighten.api.check.KauriCheck;
import lombok.Getter;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

public class Exemption {
public final UUID uuid;
@Getter
private final Set<KauriCheck> checks;

public Exemption(UUID uuid, KauriCheck... checks) {
this.uuid = uuid;
this.checks = new HashSet<>(Arrays.asList(checks));
}

public Exemption(UUID uuid) {
this.uuid = uuid;
checks = new HashSet<>();
}

public void addChecks(KauriCheck... checks) {
this.checks.addAll(Arrays.asList(checks));
}
}
20 changes: 20 additions & 0 deletions API/src/main/java/dev/brighten/api/listener/KauriFlagEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package dev.brighten.api.listener;

import cc.funkemunky.api.events.AtlasEvent;
import cc.funkemunky.api.events.Cancellable;
import dev.brighten.api.check.KauriCheck;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.bukkit.entity.Player;

@RequiredArgsConstructor
public class KauriFlagEvent extends AtlasEvent implements Cancellable {

@Getter
@Setter
private boolean cancelled;
public final Player player;
public final KauriCheck check;
public final String information;
}
60 changes: 60 additions & 0 deletions Free/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>Kauri</artifactId>
<groupId>dev.brighten.anticheat</groupId>
<version>2.9.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>Free</artifactId>
<version>${parent.version}</version>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>false</minimizeJar>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<dependencies>
<dependency>
<groupId>dev.brighten.anticheat</groupId>
<artifactId>Impl</artifactId>
<version>${parent.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
42 changes: 42 additions & 0 deletions Free/src/main/java/dev/brighten/anticheat/check/FreeChecks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package dev.brighten.anticheat.check;

import cc.funkemunky.api.utils.Init;
import cc.funkemunky.api.utils.Priority;
import dev.brighten.anticheat.check.api.Check;
import dev.brighten.anticheat.check.api.CheckRegister;
import dev.brighten.anticheat.check.impl.combat.autoclicker.AutoclickerA;
import dev.brighten.anticheat.check.impl.combat.hitbox.ReachA;
import dev.brighten.anticheat.check.impl.movement.fly.FlyA;
import dev.brighten.anticheat.check.impl.movement.nofall.NoFallA;
import dev.brighten.anticheat.check.impl.movement.speed.SpeedA;
import dev.brighten.anticheat.check.impl.packets.badpackets.*;

@Init(priority = Priority.LOWEST)
public class FreeChecks implements CheckRegister {

public FreeChecks() {
registerChecks();
}

@Override
public void registerChecks() {
Check.register(new AutoclickerA());
Check.register(new FlyA());
Check.register(new NoFallA());
Check.register(new ReachA());
Check.register(new SpeedA());
Check.register(new BadPacketsA());
Check.register(new BadPacketsB());
Check.register(new BadPacketsC());
Check.register(new BadPacketsD());
Check.register(new BadPacketsE());
Check.register(new BadPacketsF());
Check.register(new BadPacketsG());
Check.register(new BadPacketsH());
Check.register(new BadPacketsI());
Check.register(new BadPacketsK());
Check.register(new BadPacketsL());
Check.register(new BadPacketsM());
//Check.register(new BadPacketsN());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package dev.brighten.anticheat.check.impl.combat.autoclicker;

import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInArmAnimationPacket;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket;
import dev.brighten.anticheat.check.api.*;
import dev.brighten.api.check.CheckType;

@CheckInfo(name = "Autoclicker (A)", description = "A fast click check.", checkType = CheckType.AUTOCLICKER,
punishVL = 2)
@Cancellable(cancelType = CancelType.INTERACT)
public class AutoclickerA extends Check {

private int flyingTicks, cps;

@Setting(name = "cpsToFlag")
private static int cpsToFlag = 22;

@Setting(name = "cpsToBan")
private static int cpsToBan = 28;

@Packet
public void onFlying(WrappedInFlyingPacket packet, long timeStamp) {
flyingTicks++;
if(flyingTicks >= 20) {
if(cps > cpsToFlag) {
if(cps > cpsToBan) vl++;
flag("cps=%v", cps);
}
debug("cps=%v", cps);

flyingTicks = cps = 0;
}
}

@Packet
public void onArmAnimation(WrappedInArmAnimationPacket packet) {
if(!data.playerInfo.breakingBlock
&& data.playerInfo.lastBrokenBlock.hasPassed(5)
&& data.playerInfo.lastBlockPlace.hasPassed(2))
cps++;
debug("breaking=%v lastBroken=%v", data.playerInfo.breakingBlock,
data.playerInfo.lastBrokenBlock.getPassed());
}
}
Loading

0 comments on commit 09b946c

Please sign in to comment.