Skip to content

Commit

Permalink
2.10.2 small update
Browse files Browse the repository at this point in the history
- Implemented menu advertisements. A lot less intrusive.
- Fixed errors inside of BadPackets (E). Added back BadPackets (E).
- Fixed false positive in NoFall (A).
- Optimized imports.
- Added KauriVersion enum to the Kauri API.
- Fixed errors caused by KauriAPI not loading before certain calls to it.
  • Loading branch information
funkemunky committed Sep 19, 2020
1 parent e799b7d commit a29c672
Show file tree
Hide file tree
Showing 57 changed files with 235 additions and 179 deletions.
2 changes: 1 addition & 1 deletion API/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>Kauri</artifactId>
<groupId>dev.brighten.anticheat</groupId>
<version>2.10.1</version>
<version>2.10.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 2 additions & 2 deletions API/src/main/java/dev/brighten/api/KauriAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import dev.brighten.api.handlers.ExemptHandler;
import dev.brighten.api.wrappers.WrappedDataManager;
import dev.brighten.api.wrappers.WrappedKauri;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

import java.util.concurrent.Executors;
Expand All @@ -17,7 +16,8 @@ public class KauriAPI {
public ExemptHandler exemptHandler;
public ScheduledExecutorService service;
public WrappedDataManager dataManager;
private WrappedKauri kauriPlugin;
WrappedKauri kauriPlugin;


public KauriAPI() {
INSTANCE = this;
Expand Down
27 changes: 27 additions & 0 deletions API/src/main/java/dev/brighten/api/KauriVersion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package dev.brighten.api;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public enum KauriVersion {
FREE("Free", 0),
FULL("Full", 45),
ARA("Ara", 8.99f);

public final String name;
public final float price;

public static String getVersion() {
return KauriAPI.INSTANCE.kauriPlugin.getPlugin().getDescription().getVersion();
}

public static KauriVersion getPlan() {
if(KauriAPI.INSTANCE.kauriPlugin.fetchField("usingPremium"))
return FULL;

if(KauriAPI.INSTANCE.kauriPlugin.fetchField("usingAra"))
return ARA;

return FREE;
}
}
2 changes: 0 additions & 2 deletions API/src/main/java/dev/brighten/api/wrappers/Wrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import cc.funkemunky.api.reflections.types.WrappedClass;
import cc.funkemunky.api.reflections.types.WrappedField;
import cc.funkemunky.api.reflections.types.WrappedMethod;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
Expand Down
4 changes: 2 additions & 2 deletions Free/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>Kauri</artifactId>
<groupId>dev.brighten.anticheat</groupId>
<version>2.10.1</version>
<version>2.10.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -34,7 +34,7 @@
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<minimizeJar>false</minimizeJar>
<filters>
<filter>
<artifact>dev.brighten.anticheat:Impl</artifact>
Expand Down
15 changes: 3 additions & 12 deletions Free/src/main/java/dev/brighten/anticheat/Load.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,16 @@
import cc.funkemunky.api.utils.RunUtils;
import dev.brighten.anticheat.check.api.Check;
import dev.brighten.anticheat.check.api.Config;
import dev.brighten.anticheat.classloader.KauriClassLoader;
import dev.brighten.anticheat.data.DataManager;
import dev.brighten.anticheat.logs.LoggerManager;
import dev.brighten.anticheat.processing.EntityProcessor;
import dev.brighten.anticheat.processing.PacketProcessor;
import dev.brighten.anticheat.processing.keepalive.KeepaliveProcessor;
import dev.brighten.anticheat.utils.SystemUtil;
import dev.brighten.anticheat.utils.TickTimer;
import dev.brighten.anticheat.classloader.file.FileDownloader;
import dev.brighten.api.KauriAPI;
import org.bukkit.Bukkit;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Optional;
import java.util.concurrent.Executors;

public class Load {
Expand All @@ -42,6 +33,9 @@ public static void load() {
register("Loading config...");
Kauri.INSTANCE.saveDefaultConfig();

register("Loading API...");
Kauri.INSTANCE.kauriAPI = new KauriAPI();

register("Loading commands...");
Kauri.INSTANCE.commandManager = new CommandManager(Kauri.INSTANCE);

Expand All @@ -63,9 +57,6 @@ public static void load() {
register("Setting the language to " + Color.Yellow + Config.language);
Kauri.INSTANCE.msgHandler.setCurrentLang(Config.language);

register("Loading API...");
Kauri.INSTANCE.kauriAPI = new KauriAPI();

register("Registering checks...");
Check.registerChecks();

Expand Down
53 changes: 6 additions & 47 deletions Free/src/main/java/dev/brighten/anticheat/check/FreeChecks.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package dev.brighten.anticheat.check;

import cc.funkemunky.api.utils.*;
import cc.funkemunky.api.utils.Init;
import cc.funkemunky.api.utils.MiscUtils;
import cc.funkemunky.api.utils.Priority;
import cc.funkemunky.api.utils.RunUtils;
import dev.brighten.anticheat.Kauri;
import dev.brighten.anticheat.check.api.Check;
import dev.brighten.anticheat.check.api.CheckRegister;
Expand All @@ -10,13 +13,6 @@
import dev.brighten.anticheat.check.impl.movement.nofall.NoFallA;
import dev.brighten.anticheat.check.impl.movement.speed.SpeedA;
import dev.brighten.anticheat.check.impl.packets.badpackets.*;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask;

@Init(priority = Priority.LOWEST)
Expand All @@ -27,51 +23,14 @@ public class FreeChecks implements CheckRegister {
public FreeChecks() {
registerChecks();

ConfigDefault<Boolean> paidMsgingToOps =
new ConfigDefault<>(true, "misc.upgradeMessaging.messageOps", Kauri.INSTANCE);

TextComponent message = new TextComponent();
TextComponent lBracket = new TextComponent("["), kauri = new TextComponent("Kauri"),
rbracket = new TextComponent("]");
lBracket.setColor(ChatColor.DARK_GRAY);
kauri.setColor(ChatColor.GOLD);
kauri.setBold(true);
rbracket.setColor(ChatColor.DARK_GRAY);

message.addExtra(lBracket);
message.addExtra(kauri);
message.addExtra(rbracket);

TextComponent buyMessage = new TextComponent("We appreciate you using Kauri." +
" If you would like to help us out while unlocking more, please consider ");

buyMessage.setColor(ChatColor.GRAY);

TextComponent purchasing = new TextComponent("purchasing a premium package");
purchasing.setColor(ChatColor.WHITE);
purchasing.setItalic(true);
purchasing.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new BaseComponent[]{new TextComponent(Color.Yellow + Color.Italics + "Open URL")}));
purchasing.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://funkemunky.cc/shop"));

message.addExtra(buyMessage);
message.addExtra(purchasing);

msgingTask = RunUtils.taskTimerAsync(() -> {
if (!Kauri.INSTANCE.usingPremium && !Kauri.INSTANCE.usingAra) {
if (paidMsgingToOps.get()) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (!player.isOp()) continue;

player.spigot().sendMessage(message);
}
}

MiscUtils.printToConsole("&fWe appreciate you using Kauri. If you would like to help us out " +
"while unlocking more, please consider purchasing a " +
"premium package at &e&ohttps://funkemunky.cc/shop" );
} else msgingTask.cancel();
}, Kauri.INSTANCE, 20 * 30, 20 * 240);
}, Kauri.INSTANCE, 40, 18000);
}

@Override
Expand All @@ -85,7 +44,7 @@ public void registerChecks() {
Check.register(new BadPacketsB());
Check.register(new BadPacketsC());
Check.register(new BadPacketsD());
//Check.register(new BadPacketsE());
Check.register(new BadPacketsE());
Check.register(new BadPacketsF());
Check.register(new BadPacketsG());
Check.register(new BadPacketsH());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import cc.funkemunky.api.utils.KLocation;
import cc.funkemunky.api.utils.world.EntityData;
import cc.funkemunky.api.utils.world.types.SimpleCollisionBox;
import dev.brighten.anticheat.check.api.*;
import dev.brighten.anticheat.check.api.Cancellable;
import dev.brighten.anticheat.check.api.Check;
import dev.brighten.anticheat.check.api.CheckInfo;
import dev.brighten.anticheat.check.api.Packet;
import dev.brighten.api.check.CancelType;
import dev.brighten.api.check.CheckType;
import lombok.val;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
import cc.funkemunky.api.tinyprotocol.api.ProtocolVersion;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket;
import cc.funkemunky.api.utils.Color;
import cc.funkemunky.api.utils.MathUtils;
import dev.brighten.anticheat.check.api.Cancellable;
import dev.brighten.anticheat.check.api.Check;
import dev.brighten.anticheat.check.api.CheckInfo;
import dev.brighten.anticheat.check.api.Packet;
import dev.brighten.api.check.CheckType;
import net.minecraft.server.v1_8_R3.BlockClay;

@CheckInfo(name = "Fly (A)", description = "Simple fly check.", punishVL = 10,
checkType = CheckType.FLIGHT, vlToFlag = 3, developer = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ public void onPacket(WrappedInFlyingPacket packet, long timeStamp) {
&& data.playerInfo.lastVelocity.hasPassed(4)
&& (data.playerInfo.deltaY != 0 || data.playerInfo.deltaXZ > 0)
&& data.playerInfo.blockAboveTimer.hasPassed(10)
&& flag) {
vl+= data.lagInfo.lagging
|| data.playerInfo.nearGround
|| data.blockInfo.blocksNear
? 1 : data.playerInfo.clientGround ? 2 : 3;
&& flag) { ;

if(vl > 2) {
if(++vl > 2) {
flag("ground=" + data.playerInfo.clientGround + " deltaY=" + data.playerInfo.deltaY);
}
} else vl-= vl > 0 ? 0.2f : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import cc.funkemunky.api.tinyprotocol.api.ProtocolVersion;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket;
import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutVelocityPacket;
import cc.funkemunky.api.utils.PlayerUtils;
import dev.brighten.anticheat.check.api.Cancellable;
Expand All @@ -11,7 +10,6 @@
import dev.brighten.anticheat.check.api.Packet;
import dev.brighten.anticheat.processing.TagsBuilder;
import dev.brighten.api.check.CheckType;
import org.bukkit.entity.EntityType;
import org.bukkit.potion.PotionEffectType;

@CheckInfo(name = "Speed (A)", description = "Minecraft code speed acceleration check.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInBlockDigPacket;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInBlockPlacePacket;
import cc.funkemunky.api.utils.BlockUtils;
import dev.brighten.anticheat.check.api.*;
import dev.brighten.anticheat.check.api.Cancellable;
import dev.brighten.anticheat.check.api.Check;
import dev.brighten.anticheat.check.api.CheckInfo;
import dev.brighten.anticheat.check.api.Packet;
import dev.brighten.api.check.CancelType;
import dev.brighten.api.check.CheckType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInHeldItemSlotPacket;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInTransactionPacket;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket;
import dev.brighten.anticheat.Kauri;
import dev.brighten.anticheat.check.api.Cancellable;
import dev.brighten.anticheat.check.api.Check;
import dev.brighten.anticheat.check.api.CheckInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,27 @@
import dev.brighten.anticheat.check.api.Check;
import dev.brighten.anticheat.check.api.CheckInfo;
import dev.brighten.anticheat.check.api.Packet;
import dev.brighten.anticheat.data.ObjectData;
import dev.brighten.anticheat.utils.TickTimer;
import dev.brighten.api.check.CheckType;

@CheckInfo(name = "BadPackets (E)", description = "Checks for a player not swinging their arm.",
checkType = CheckType.BADPACKETS, punishVL = 10, developer = true)
public class BadPacketsE extends Check {

private TickTimer lastSwing;
private int attackTicks;

@Override
public void setData(ObjectData data) {
super.setData(data);
lastSwing = new TickTimer( 8);
}

@Packet
public void onFlying(WrappedInUseEntityPacket packet) {
if(!packet.getAction().equals(WrappedInUseEntityPacket.EnumEntityUseAction.ATTACK)) return;

if(attackTicks++ > 3 && lastSwing.hasNotPassed(3)
&& !data.lagInfo.lagging && data.lagInfo.lastPacketDrop.hasPassed(5)) {
if(attackTicks++ > 3
&& !data.lagInfo.lagging) {
vl++;
flag("has not swung since %v ticks", lastSwing.getPassed());
flag("has not swung since %v ticks", attackTicks);
}
}

@Packet
public void onFlying(WrappedInArmAnimationPacket packet) {
lastSwing.reset();
attackTicks = 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInTransactionPacket;
import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutPositionPacket;
import cc.funkemunky.api.utils.math.RollingAverage;
import dev.brighten.anticheat.Kauri;
import dev.brighten.anticheat.check.api.Cancellable;
Expand Down
2 changes: 1 addition & 1 deletion Impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>Kauri</artifactId>
<groupId>dev.brighten.anticheat</groupId>
<version>2.10.1</version>
<version>2.10.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion Impl/src/main/java/dev/brighten/anticheat/Load.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
import dev.brighten.anticheat.check.api.Check;
import dev.brighten.anticheat.check.api.Config;
import dev.brighten.anticheat.classloader.KauriClassLoader;
import dev.brighten.anticheat.classloader.file.FileDownloader;
import dev.brighten.anticheat.data.DataManager;
import dev.brighten.anticheat.logs.LoggerManager;
import dev.brighten.anticheat.processing.EntityProcessor;
import dev.brighten.anticheat.processing.PacketProcessor;
import dev.brighten.anticheat.processing.keepalive.KeepaliveProcessor;
import dev.brighten.anticheat.utils.SystemUtil;
import dev.brighten.anticheat.utils.TickTimer;
import dev.brighten.anticheat.classloader.file.FileDownloader;
import dev.brighten.api.KauriAPI;
import org.bukkit.Bukkit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.brighten.anticheat.classloader;

import dev.brighten.anticheat.utils.SystemUtil;
import dev.brighten.anticheat.classloader.file.JarUtil;
import dev.brighten.anticheat.utils.SystemUtil;

import java.io.File;
import java.net.URL;
Expand Down
Loading

0 comments on commit a29c672

Please sign in to comment.