Enjoy Leak

This commit is contained in:
Brandon 2023-05-01 19:16:15 +01:00
commit bfa5e6904f
366 changed files with 8267584 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.classpath
.project
.settings/
target/
Edge.iml

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

13
.idea/compiler.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="Edge" />
</profile>
</annotationProcessing>
</component>
</project>

7
.idea/discord.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

7
.idea/encodings.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

30
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jitpack.io" />
<option name="name" value="jitpack.io" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="spigot-repo" />
<option name="name" value="spigot-repo" />
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.github.retrooper.packetevents:api:2.0-93cd6f39f9-1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/retrooper/packetevents/api/2.0-93cd6f39f9-1/api-2.0-93cd6f39f9-1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/github/retrooper/packetevents/api/2.0-93cd6f39f9-1/api-2.0-93cd6f39f9-1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/retrooper/packetevents/api/2.0-93cd6f39f9-1/api-2.0-93cd6f39f9-1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.github.retrooper.packetevents:spigot:2.0-93cd6f39f9-1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/retrooper/packetevents/spigot/2.0-93cd6f39f9-1/spigot-2.0-93cd6f39f9-1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/github/retrooper/packetevents/spigot/2.0-93cd6f39f9-1/spigot-2.0-93cd6f39f9-1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/retrooper/packetevents/spigot/2.0-93cd6f39f9-1/spigot-2.0-93cd6f39f9-1-sources.jar!/" />
</SOURCES>
</library>
</component>

14
.idea/misc.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="corretto-19" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

124
.idea/uiDesigner.xml Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

12
README.md Normal file
View File

@ -0,0 +1,12 @@
<img alt="Edge AntiCheat" src="https://i.ibb.co/fM2kvKR/banner-1.jpg" width="5000">
# Edge AntiCheat
Edge is a powerful advanced anticheat solution for versions 1.7.10 through latest. Our goal is to eliminate cheaters with as much efficiency and accuracy as possible.
# Links
<h1><img height="30" src="https://i.imgur.com/h7Bf0a7.png"> <a href="https://github.com/Edge-AntiCheat">
<img height="30" src="https://i.imgur.com/2Zq3Av0.png"> <a href="https://discord.edgeac.xyz">
<img height="30" src="https://i.imgur.com/J8cCOlP.png"> <a href="https://edgeac.xyz"></h1>

Binary file not shown.

BIN
libs/spigot-1.12.2.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

140
pom.xml Normal file
View File

@ -0,0 +1,140 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>cc.edgesolutions</groupId>
<artifactId>Edge</artifactId>
<version>1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<finalName>Edge</finalName>
<relocations>
<relocation>
<pattern>com.mongodb</pattern>
<shadedPattern>cc.edgesolutions.edge.utils.remapping.mongodb</shadedPattern>
</relocation>
<relocation>
<pattern>io.github.retrooper.packetevents</pattern>
<shadedPattern>cc.edgesolutions.edge.utils.remapping.packetevents</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.12.11</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api-1.12</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/spigot-1.12.2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.golfing8</groupId>
<artifactId>factionskore-main</artifactId>
<version>0.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/FactionsKore-1.3.16.jar</systemPath>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/spigot-1.8.8-R0.1-SNAPSHOT-latest.jar</systemPath>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot1.7</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/spigot-1.7.10-SNAPSHOT-b1657.jar</systemPath>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigotNMS</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/spigot-1.12.2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.github.retrooper.packetevents</groupId>
<artifactId>spigot</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-1.19</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/spigot-1.19.2-R0.1-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>3.32.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.commons</groupId>-->
<!-- <artifactId>commons-lang3</artifactId>-->
<!-- <version>3.12.0</version>-->
<!-- </dependency>-->
</dependencies>
</project>

View File

@ -0,0 +1,150 @@
package cc.edgesolutions.edge;
import cc.edgesolutions.edge.command.CommandManager;
import cc.edgesolutions.edge.command.impl.EdgeCommand;
import cc.edgesolutions.edge.command.impl.EngineCommand;
import cc.edgesolutions.edge.command.impl.impl.AlertsCommand;
import cc.edgesolutions.edge.config.ConfigManager;
import cc.edgesolutions.edge.config.impl.CompatibilityConfig;
import cc.edgesolutions.edge.config.impl.EdgeConfig;
import cc.edgesolutions.edge.config.impl.MenuConfig;
import cc.edgesolutions.edge.config.impl.MessageConfig;
import cc.edgesolutions.edge.engine.NeuralNetworkManager;
import cc.edgesolutions.edge.nms.InstanceManager;
import cc.edgesolutions.edge.profile.ProfileManager;
import cc.edgesolutions.edge.storage.impl.MongoController;
import cc.edgesolutions.edge.utils.load.DisguiseModule;
import cc.edgesolutions.edge.utils.load.FeatureModule;
import cc.edgesolutions.edge.utils.load.ListenerModule;
import cc.edgesolutions.edge.utils.load.PacketEventsModule;
import cc.edgesolutions.edge.utils.log.LogManager;
import cc.edgesolutions.edge.utils.player.brand.BrandReceiver;
import cc.edgesolutions.edge.utils.system.server.ServerOutput;
import cc.edgesolutions.edge.utils.system.server.ServerUtil;
import cc.edgesolutions.edge.utils.task.TaskHandler;
import cc.edgesolutions.edge.utils.training.TrainingManager;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.text.SimpleDateFormat;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@Getter
@Setter
public class Edge extends JavaPlugin {
@Getter
private static Edge instance;
private String userName;
private LicenseType licenseType;
private final InstanceManager instanceManager = new InstanceManager();
private final TaskHandler taskHandler = new TaskHandler();
private final ScheduledExecutorService threadService = Executors.newSingleThreadScheduledExecutor();
private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E, MMMMM d, yyyy hh:mm aaa");
private MongoController mongoController;
private EdgeConfig edgeConfig;
private MenuConfig menuConfig;
private MessageConfig messageConfig;
private CompatibilityConfig compatibilityConfig;
private LogManager logManager;
private TrainingManager trainingManager;
private NeuralNetworkManager neuralNetworkManager;
private ProfileManager profileManager;
private CommandManager commandManager;
private BrandReceiver brandReceiver;
private long uptimeStart;
@Override
public void onEnable() {
instance = this;
sendLoad();
this.uptimeStart = System.currentTimeMillis();
this.trainingManager = new TrainingManager();
this.neuralNetworkManager = new NeuralNetworkManager();
createConfigs();
this.logManager = new LogManager();
this.profileManager = new ProfileManager();
this.commandManager = new CommandManager();
commandManager.registerCommand(
new EdgeCommand(),
new EngineCommand(),
new AlertsCommand()
);
new FeatureModule().start();
new ListenerModule().start();
new DisguiseModule().start();
new PacketEventsModule().start();
this.instanceManager.start();
this.taskHandler.start();
createReceiver();
}
public void createConfigs() {
//Create Edge Dir
if (!getDataFolder().exists()) {
getDataFolder().mkdir();
}
//Edge Config
edgeConfig = new EdgeConfig("settings.yml");
edgeConfig.load();
compatibilityConfig = new CompatibilityConfig("compatibility.yml");
compatibilityConfig.load();
//Messages Config
messageConfig = new MessageConfig("messages.yml");
messageConfig.load();
//Menu Config
menuConfig = new MenuConfig("menus.yml");
menuConfig.load();
ConfigManager.setupChecksConfig();
}
public void createReceiver() {
brandReceiver = new BrandReceiver();
Bukkit.getMessenger().registerIncomingPluginChannel(
this,
ServerUtil.getVersion().isNewerThanOrEquals(ServerVersion.V_1_13) ? brandReceiver.getBrandChannel() : brandReceiver.getBrandChannelLegacy(),
brandReceiver
);
}
public void sendLoad() {
ServerOutput.sendWatermark();
ServerOutput.sendLog("&fLoading &bEdge AntiCheat &fversion &b" + getDescription().getVersion() + "&f!");
}
@Override
public void onDisable() {
profileManager.getProfileMap().clear();
}
public enum LicenseType {
PREMIUM,
ENTERPRISE,
DEVELOPER
}
}

View File

@ -0,0 +1,265 @@
package cc.edgesolutions.edge.check;
import cc.edgesolutions.edge.Edge;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.CheckType;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.config.CheckSetting;
import cc.edgesolutions.edge.config.ConfigManager;
import cc.edgesolutions.edge.config.impl.EdgeConfig;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.utils.buffer.Buffer;
import cc.edgesolutions.edge.utils.color.ColorUtil;
import cc.edgesolutions.edge.utils.log.Log;
import cc.edgesolutions.edge.utils.misc.EdgeUtil;
import cc.edgesolutions.edge.utils.system.server.ServerUtil;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import lombok.Getter;
import lombok.Setter;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadLocalRandom;
@Getter
@Setter
public abstract class EdgeCheck {
public final CheckSetting<Boolean> checkEnabled = new CheckSetting<>(this, ConfigManager.CHECKS_CONFIG, "Enabled", true);
public final CheckSetting<String> checkDisplay = new CheckSetting<>(this, ConfigManager.CHECKS_CONFIG, "Display", getInfo().name());
public final CheckSetting<Boolean> cancel = new CheckSetting<>(this, ConfigManager.CHECKS_CONFIG, "Cancel", false);
public final CheckSetting<Integer> maxVL = new CheckSetting<>(this, ConfigManager.CHECKS_CONFIG, "PunishVL", 15);
public final CheckSetting<List<String>> punishCommands = new CheckSetting<>(this, ConfigManager.CHECKS_CONFIG, "Commands", Collections.singletonList(
"kick $player $prefix&cUnfair Advantage &7[$id]"
));
public final Executor EXECUTOR = Executors.newSingleThreadExecutor();
public final Profile profile;
public CheckType checkType;
public double bufferValue;
public int vl;
public boolean recordingData;
public EdgeCheck(Profile profile) {
this.profile = profile;
if (getInfo() == null) {
throw new IllegalArgumentException("Unable to find Check annotation for class " + getClass().getName() + ".");
}
String packageName = getClass().getPackage().getName();
if (packageName.contains("combat")) {
checkType = CheckType.COMBAT;
} else if (packageName.contains("movement")) {
checkType = CheckType.MOVEMENT;
} else if (packageName.contains("world")) {
checkType = CheckType.WORLD;
} else if (packageName.contains("miscellaneous")) {
checkType = CheckType.MISCELLANEOUS;
}
}
public abstract void handle(Player player, PacketReceiveEvent event, long receivedAt);
public abstract void handle(Player player, PacketSendEvent event, long receivedAt);
public final Check getInfo() {
return getClass().getDeclaredAnnotation(Check.class);
}
public void fail(String... info) {
if (!checkEnabled.getValue()) return;
final EdgeConfig config = Edge.getInstance().getEdgeConfig();
if (!config.getAllowDevelopmental().getValue() && getInfo().releaseType() == ReleaseType.DEVELOPMENTAL) return;
/*vl = vl + 0.15;*/
if (config.getExperimentalVlAdd().getValue() && getInfo().releaseType() == ReleaseType.EXPERIMENTAL) {
//profile.getBotProcessor().setTotalVL(profile.getBotProcessor().getTotalVL() + 1);
profile.setTotalViolations(profile.getTotalViolations() + 1);
++vl;
} else {
if (getInfo().releaseType() == ReleaseType.RELEASE || getInfo().releaseType() == ReleaseType.DEVELOPMENTAL) {
//profile.getBotProcessor().setTotalVL(profile.getBotProcessor().getTotalVL() + 1);
profile.setTotalViolations(profile.getTotalViolations() + 1);
vl++;
}
}
if (Edge.getInstance().getEdgeConfig().getResetVlOnMax().getValue()) {
if (vl >= maxVL.getValue()) vl = 0;
}
String developmentalTag = (getInfo().releaseType() == ReleaseType.DEVELOPMENTAL ? Edge.getInstance().getEdgeConfig().getDevelopmental().getValue() : "");
String experimentalTag = (getInfo().releaseType() == ReleaseType.EXPERIMENTAL ? Edge.getInstance().getEdgeConfig().getExperimental().getValue() : "");
String connectionTag = (profile.getLatency() > 150 ? Edge.getInstance().getEdgeConfig().getConnection().getValue() : "");
String mlTag = (getInfo().ml() ? " &d♦" : "");
String tags = experimentalTag + developmentalTag + connectionTag + mlTag;
EXECUTOR.execute(() -> {
for (Player viewerPlayer : Bukkit.getServer().getOnlinePlayers()) {
if (!viewerPlayer.hasPermission("edge.alerts")) continue;
Profile viewer = Edge.getInstance().getProfileManager().getProfile(viewerPlayer);
if (viewer.isReceivingAlerts()) {
String alertMessage = translateViolation(
Edge.getInstance().getEdgeConfig().getAlertMessage().getValue(),
maxVL.getValue(),
config.getDebugColor().getValue(),
tags,
info
);
ComponentBuilder builder = new ComponentBuilder(ColorUtil.translate(alertMessage)); //verboseAlertMessage
builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(ColorUtil.translate(
translateViolation(
String.join("\n", config.getAlertMessageHover().getValue()),
maxVL.getValue(),
config.getDebugColor().getValue(),
tags,
info
)
))));
builder.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, Edge.getInstance().getEdgeConfig().getClickCommand().getValue().replace("$player", profile.getPlayer().getName())));
viewer.getPlayer().spigot().sendMessage(builder.create());
}
}
});
if (cancel.getValue()) {
cancel();
}
if (vl == maxVL.getValue() && maxVL.getValue() != -1) {
for (String cmd : punishCommands.getValue()) {
Bukkit.getScheduler().runTask(Edge.getInstance(), () -> {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ColorUtil.translate(cmd
.replace("$player", profile.getPlayer().getName())
.replace("$id", ThreadLocalRandom.current().nextInt(100, 10000) + "")
.replace("$check", checkDisplay.getValue())
.replace("$type", getInfo().type())
.replace("$typeFull", getInfo().typeAdvanced().equals("N/A") ? getInfo().type() : getInfo().typeAdvanced())
.replace("$vl", String.valueOf(vl))
.replace("$maxVL", String.valueOf(maxVL.getValue())))
);
});
EdgeUtil.addPunishedPlayer();
}
if (Edge.getInstance().getEdgeConfig().getPunishmentMessageEnabled().getValue()) {
Bukkit.broadcastMessage(ColorUtil.translate(String.join("\n", Edge.getInstance().getEdgeConfig().getPunishmentMessage().getValue())
.replace("$player", profile.getPlayer().getName())
.replace("$id", ThreadLocalRandom.current().nextInt(100, 10000) + "")
.replace("$check", checkDisplay.getValue())
.replace("$type", getInfo().type())
.replace("$vl", String.valueOf(vl))
.replace("$typeFull", getInfo().typeAdvanced().equals("N/A") ? getInfo().type() : getInfo().typeAdvanced())
.replace("$maxVL", String.valueOf(maxVL.getValue()))
));
}
}
Edge.getInstance().getLogManager().addToLogQueue(new Log(
UUID.randomUUID(),
profile.getPlayer().getUniqueId(),
checkDisplay.getValue(),
getInfo().type(),
checkType,
System.currentTimeMillis(),
profile.getVersion(),
info
));
}
public void sendDebug(String st) {
profile.sendDebug(st);
}
public Buffer buffer() {
return new Buffer(this);
}
private String translateViolation(String string, int maxVL, String color, String tags, String... info) {
return string
.replace("$player", profile.getPlayer().getName())
.replace("$description", getInfo().description())
.replace("$debug", color + String.join("\n" + color, info))
.replace("$ping", String.valueOf(profile.getConnectionProcessor().getTransactionPing()))
.replace("$tps", ServerUtil.getTPSDisplay())
.replace("$vl", String.valueOf(vl))
.replace("$maxVL", maxVL == -1 ? "" : String.valueOf(maxVL))
.replace("$bar", generateBar(vl, (maxVL == -1 ? 50 : maxVL)))
.replace("$checkTypeFull", (getInfo().typeAdvanced().equals("N/A") ? getInfo().type() : getInfo().typeAdvanced()))
.replace("$checkName", checkDisplay.getValue())
.replace("$checkType", getInfo().type())
.replace("$releaseType", getInfo().releaseType().name())
.replace("$tags", tags)
.replace("$version", profile.getVersion().getReleaseName())
.replace("$client", (profile.getClientBrand() == null ? "Unknown" : profile.getClientBrand()));
}
public String generateBar(double vl, double maxVL) {
final StringBuilder msg = new StringBuilder(ColorUtil.translate(Edge.getInstance().getEdgeConfig().getAlertsBarFirst().getValue()));
final int percentage = (int) (100 / (maxVL / vl));
final String fill = ColorUtil.translate(Edge.getInstance().getEdgeConfig().getAlertsBarFill().getValue());
for (int i = 0; i <= percentage / 5.5 - 1; i++) msg.append(fill);
final String empty = ColorUtil.translate(Edge.getInstance().getEdgeConfig().getAlertsBarEmpty().getValue());
for (int i = 0; i <= (100 - percentage) / 5.5 - 1; i++) msg.append(empty);
msg.append(ColorUtil.translate(Edge.getInstance().getEdgeConfig().getAlertsBarLast().getValue()));
return msg.toString();
}
private void cancel() {
switch (checkType) {
case COMBAT: {
profile.getCancelAttackTimer().reset();
break;
}
case MOVEMENT: {
profile.getCancelMoveTimer().reset();
break;
}
case WORLD: {
profile.getCancelActionTimer().reset();
break;
}
case MISCELLANEOUS: {
profile.getCancelActionTimer().reset();
break;
}
}
}
private void setBack() {
}
}

View File

@ -0,0 +1,32 @@
package cc.edgesolutions.edge.check.annotations;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Check {
String name();
String type();
String typeAdvanced() default "N/A";
String description() default "No Description";
ReleaseType releaseType() default ReleaseType.RELEASE;
boolean ban() default true;
boolean geyser() default false;
double minTps() default 19.5;
boolean ml() default false;
}

View File

@ -0,0 +1,47 @@
package cc.edgesolutions.edge.check.impl.combat.aim;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.profile.processor.RotationProcessor;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Aim", type = "A", releaseType = ReleaseType.DEVELOPMENTAL, description = "Rounded Aiming", typeAdvanced = "Round")
public class AimA extends EdgeCheck {
private double buffer1;
public AimA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isRotation(event)) {
return;
}
if (profile.getTeleportTicks() < 20 && !profile.isValidRotation()) return;
RotationProcessor rotation = profile.getRotationProcessor();
if (rotation.isRoundedAim(rotation.getPitch())) {
if (++buffer1 > 1) {
fail(
"T=pitch",
"P=" + rotation.getPitch(),
"B=" + Math.round(buffer1)
);
}
} else buffer1 = Math.max(0, buffer1 - 0.1);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,48 @@
package cc.edgesolutions.edge.check.impl.combat.aim;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.profile.processor.RotationProcessor;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Aim", type = "B", releaseType = ReleaseType.DEVELOPMENTAL, description = "Invalid GCD", typeAdvanced = "GCD")
public class AimB extends EdgeCheck {
public AimB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isUseEntity(event)) {
return;
}
if (profile.getCombatProcessor().getTarget() == null || !profile.isValidRotation()) return;
final RotationProcessor rotation = profile.getRotationProcessor();
final float deltaPitch = rotation.getDeltaPitch();
final float lastDeltaPitch = rotation.getLastDeltaPitch();
final float gcd = profile.getRotationProcessor().getPitchGCD();
// if (gcd > 0F && gcd < 131072F) {
// fail(
// "G=" + gcd,
// "P" + deltaPitch,
// "B=" + buffer().getRounded()
// );
// }
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,46 @@
package cc.edgesolutions.edge.check.impl.combat.aim;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Aim", type = "C", releaseType = ReleaseType.EXPERIMENTAL, description = "Incorrect yaw floor", typeAdvanced = "Floor")
public class AimC extends EdgeCheck {
public AimC(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isRotation(event)) {
return;
}
if (!profile.isValidRotation()) return;
float lastDeltaPitch = profile.getRotationProcessor().getLastDeltaPitch();
float lastDeltaYaw = profile.getRotationProcessor().getLastDeltaYaw();
if (lastDeltaYaw > 0 && Math.abs(Math.floor(lastDeltaYaw) - lastDeltaYaw) < 0.0000000001) {
if (buffer().addAndGet() > 1) {
fail(
"LY=" + lastDeltaYaw,
"LP=" + lastDeltaPitch,
"CV=" + Math.abs(Math.floor(lastDeltaYaw)),
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, 0.1);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,50 @@
package cc.edgesolutions.edge.check.impl.combat.aim;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@Check(name = "Aim", type = "D", releaseType = ReleaseType.EXPERIMENTAL, description = "Down/UP rotation while attacking")
public class AimD extends EdgeCheck {
public AimD(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isUseEntity(event)) {
return;
}
if (!profile.isValidRotation()) return;
final double deltaPitch = profile.getRotationProcessor().getDeltaPitch();
final Entity target = profile.getCombatProcessor().getTarget();
if (target == null) return;
double distance = profile.getReachProcessor().getDistance();
if (deltaPitch > 70 && distance > 2.5) {
fail(
"P=" + player.getName(),
"P=" + deltaPitch,
"D=" + distance,
"I=" + target.getEntityId(),
"B=" + buffer().getRounded()
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,67 @@
package cc.edgesolutions.edge.check.impl.combat.aim;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import org.bukkit.entity.Player;
@Check(name = "Aim", type = "E", releaseType = ReleaseType.EXPERIMENTAL, description = "Snap to target head", typeAdvanced = "Snap")
public class AimE extends EdgeCheck {
private int attackTicks;
public AimE(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isUseEntity(event)) {
WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event);
if (wrapper.getAction() == WrapperPlayClientInteractEntity.InteractAction.ATTACK) {
attackTicks = 0;
}
}
if (!EdgePacket.isRotation(event)) {
return;
}
if (!profile.isValidRotation()) {
return;
}
if (attackTicks < 4) {
final double deltaYaw = profile.getRotationProcessor().getDeltaYaw();
final double mouseX = profile.getRotationProcessor().getMouseX();
final double fix = Math.abs(deltaYaw - mouseX);
final double snap = Math.abs(deltaYaw - fix);
if (deltaYaw > 360) {
if ((snap > 3000 || snap < 1.01 && snap > 0.98) && fix > 4000) {
fail(
"D=" + deltaYaw,
"S=" + snap,
"F=" + fix,
"B=" + buffer().getRounded()
);
}
}
}
if (attackTicks < 20) {
attackTicks++;
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,64 @@
package cc.edgesolutions.edge.check.impl.combat.aim;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.utils.collection.EvictingList;
import cc.edgesolutions.edge.utils.player.PlayerUtils;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Aim", type = "F", description = "Sensitivity flaw", releaseType = ReleaseType.DEVELOPMENTAL, typeAdvanced = "Sensitivity")
public class AimF extends EdgeCheck {
public AimF(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isRotation(event)) {
return;
}
if (!profile.isValidRotation()) return;
final float deltaPitch = profile.getRotationProcessor().getDeltaPitch();
final float lastDeltaPitch = profile.getRotationProcessor().getLastDeltaPitch();
final float sensitivityYaw = profile.getRotationProcessor().getSensitivityYaw();
final float sensitivityPitch = profile.getRotationProcessor().getSensitivityPitch();
final EvictingList<Integer> sensitives = profile.getRotationProcessor().getSensitivitiesPitch();
final boolean cinematic = profile.getCinematicProcessor().isCinematic();
PlayerUtils.sendActionBar(profile.getPlayer(), (cinematic ? "&aCinematic" : "&cCinematic") + " &7[&aP=" + sensitivityPitch + "%&7] &7[&aY=" + sensitivityYaw + "%&7]");
if (!profile.isValidRotation()
|| cinematic) {
return;
}
// for (float sens : sensitives) {
// if (sens < 0 && sens > -66.4) {
// if (buffer().addAndGet() > 5) {
// fail(
// "S=" + sens,
// "Z=" + sensitives.size(),
// "M=" + sensitives.getMaxSize(),
// "B=" + buffer().getRounded()
// );
// }
// } else {
// bufferValue /= 2;
// }
// }
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,50 @@
package cc.edgesolutions.edge.check.impl.combat.aim;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Aim", type = "G", releaseType = ReleaseType.DEVELOPMENTAL, ban = false, description = "Snap check (2)")
public class AimG extends EdgeCheck {
public AimG(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isPosition(event)) return;
if (profile.getCombatProcessor().getAttackTimer().passed(1)
|| !profile.isValidRotation()) {
return;
}
final float deltaYaw = profile.getRotationProcessor().getDeltaYaw();
final float deltaPitch = profile.getRotationProcessor().getDeltaPitch();
final double deltaXZ = profile.getMovementProcessor().getDeltaXZ();
final double lastDeltaXZ = profile.getMovementProcessor().getLastDeltaXZ();
final double accel = Math.abs(deltaXZ - lastDeltaXZ);
if (accel < 1e-02 && deltaYaw > 30.f && deltaPitch > 15.f) {
fail(
"A=" + accel,
"Y=" + deltaYaw,
"P=" + deltaPitch,
"S=" + deltaXZ,
"B=" + buffer().getRounded()
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,35 @@
package cc.edgesolutions.edge.check.impl.combat.aim;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Aim", type = "H", description = "Invalid sensitivity")
public class AimH extends EdgeCheck {
public AimH(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isRotation(event)) {
return;
}
if (getProfile().getRotationProcessor().getSensitivityYaw() > 200.0F || getProfile().getRotationProcessor().getSensitivityPitch() > 200.0F) {
fail("Y=" + getProfile().getRotationProcessor().getSensitivityYaw(),
"P=" + getProfile().getRotationProcessor().getSensitivityPitch());
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,58 @@
package cc.edgesolutions.edge.check.impl.combat.autoclicker;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.config.CheckSetting;
import cc.edgesolutions.edge.config.ConfigManager;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@Check(name = "AutoClicker", type = "A", releaseType = ReleaseType.RELEASE, description = "High click count", typeAdvanced = "Limit")
public class AutoClickerA extends EdgeCheck {
private final CheckSetting<Integer> max = new CheckSetting<>(
this,
ConfigManager.CHECKS_CONFIG,
"Settings.Max",
20
);
public AutoClickerA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isAnimation(event)) {
return;
}
if (profile.isDigging() || profile.isPrinter()) {
return;
}
final double cps = profile.getCombatProcessor().getCps();
final double lastCps = profile.getCombatProcessor().getLastCps();
Entity target = profile.getCombatProcessor().getTarget();
if (cps >= max.getValue()) {
fail(
"C=" + cps,
"L=" + lastCps,
"T=" + (target == null ? "None" : target.getName()),
"B=" + buffer().getRounded()
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,60 @@
package cc.edgesolutions.edge.check.impl.combat.autoclicker;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.utils.collection.EvictingList;
import cc.edgesolutions.edge.utils.math.MathUtil;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "AutoClicker", type = "B", releaseType = ReleaseType.EXPERIMENTAL, description = "Standard deviation flaw", typeAdvanced = "Deviation")
public class AutoClickerB extends EdgeCheck {
private final EvictingList<Integer> data = new EvictingList<>(50);
private int delayTime;
public AutoClickerB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isAnimation(event)) {
if (profile.isDigging()) {
return;
}
if (delayTime < 5) {
data.add(delayTime);
if (data.isFull()) {
double std = MathUtil.getStandardDeviation(data);
if (std < 0.7) {
fail(
"S=" + std,
"D=" + data.size(),
"T=" + delayTime
);
}
}
}
delayTime = 0;
} else if (EdgePacket.isFlyingType(event)) {
delayTime++;
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,72 @@
package cc.edgesolutions.edge.check.impl.combat.autoclicker;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.utils.math.MathUtil;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@Check(name = "AutoClicker", type = "C", releaseType = ReleaseType.RELEASE, description = "Standard deviation flaw (2)")
public class AutoClickerC extends EdgeCheck {
private int movements;
private final List<Integer> cpsList = new ArrayList<>();
public AutoClickerC(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isAnimation(event)) {
if (profile.isDigging()) {
return;
}
if (movements < 8) {
cpsList.add(movements);
if (cpsList.size() == 40) {
double std = MathUtil.getStandardDeviation(cpsList);
if (std <= 0.3001) {
if (buffer().addAndGet() > 2) {
fail(
"S=" + std,
"M=" + movements,
"B=" + buffer().getRounded()
);
}
} else {
bufferValue -= Math.min(bufferValue, 0.125);
}
cpsList.clear();
}
}
movements = 0;
}
if (EdgePacket.isFlyingType(event)) {
if (movements < 60) {
movements++;
}
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,66 @@
package cc.edgesolutions.edge.check.impl.combat.autoclicker;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.utils.collection.EvictingList;
import cc.edgesolutions.edge.utils.math.MathUtil;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "AutoClicker", type = "D", releaseType = ReleaseType.DEVELOPMENTAL, description = "Standard deviation flaw")
public class AutoClickerD extends EdgeCheck {
private final EvictingList<Integer> data = new EvictingList<>(50);
private int delayTime;
public AutoClickerD(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isAnimation(event)) {
if (!profile.isValidMotion()
|| profile.isDigging()) {
return;
}
if (delayTime < 5) {
data.add(delayTime);
if (data.isFull()) {
final double std = MathUtil.getStandardDeviation(data);
final double duplicates = MathUtil.getDuplicates(data);
final double variance = MathUtil.getVariance(data);
final double average = MathUtil.getAverage(data);
if (std < 0.1 && duplicates > 0.5 && variance < 0.1 && average < 0.1) {
fail(
"S=" + std,
"D=" + duplicates,
"V=" + variance,
"A=" + average,
"B=" + buffer().getRounded()
);
}
}
}
delayTime = 0;
} else if (EdgePacket.isFlyingType(event)) {
delayTime++;
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,98 @@
package cc.edgesolutions.edge.check.impl.combat.autoclicker.ml;
import cc.edgesolutions.edge.Edge;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.engine.NeuralNetwork;
import cc.edgesolutions.edge.engine.impl.autoclicker.NetworkAutoClickerG;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.utils.collection.EvictingList;
import cc.edgesolutions.edge.utils.math.MathUtil;
import cc.edgesolutions.edge.utils.training.TrainingData;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
import java.util.HashMap;
@Check(name = "AutoClicker", type = "G", releaseType = ReleaseType.EXPERIMENTAL, description = "Machine learning auto-clicker prediction", ml = true, ban = false, typeAdvanced = "Neural-G")
public class MLAutoClickerG extends EdgeCheck {
private final EvictingList<Integer> data = new EvictingList<>(100);
private int delayTime;
private NetworkAutoClickerG network;
public MLAutoClickerG(Profile profile) {
super(profile);
for (NeuralNetwork network : Edge.getInstance().getNeuralNetworkManager().getNetworks()) {
if (network.getNetworkName().equals("NetworkAutoClickerG")) {
this.network = (NetworkAutoClickerG) network;
}
}
if (network == null) {
throw new NullPointerException("Could not resolve the neural network.");
}
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isAnimation(event)) {
if (profile.isDigging() || profile.isPrinter()) {
return;
}
if (delayTime < 5) {
data.add(delayTime);
if (data.isFull()) {
int duplicates = MathUtil.getDuplicates(data);
float std = (float) MathUtil.getStandardDeviation(data);
float variance = (float) MathUtil.getVariance(data);
float average = (float) MathUtil.getAverage(data);
if (isRecordingData()) {
HashMap<String, Number> checkData = new HashMap<>();
checkData.put("duplicates", duplicates);
checkData.put("std", std);
checkData.put("variance", variance);
checkData.put("average", average);
TrainingData data = new TrainingData(player.getUniqueId(), getInfo().name(), getInfo().type(), checkData);
Edge.getInstance().getTrainingManager().addDataEntry(data);
}
float[] inputs = {duplicates, std, variance, average};
float[] calculation = network.calculate(inputs);
sendDebug(String.format("probability=%d%%", (int) (calculation[0] * 100.0F)));
if (calculation[0] > 0.7F) {
fail(
"S=" + std,
"D=" + duplicates,
"V=" + variance,
"A=" + average,
"P=" + (int) (calculation[0] * 100.0F),
"B=" + buffer().getRounded()
);
}
}
}
delayTime = 0;
} else if (EdgePacket.isFlyingType(event)) {
delayTime++;
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,56 @@
package cc.edgesolutions.edge.check.impl.combat.hitbox;
import cc.edgesolutions.edge.Edge;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.utils.boundingbox.BoundingBox;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@Check(name = "HitBox", type = "A", releaseType = ReleaseType.EXPERIMENTAL, description = "Outside HitBox", typeAdvanced = "Box")
public class HitBoxA extends EdgeCheck {
public HitBoxA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isUseEntity(event)) { //isFlyingType
return;
}
if (!profile.isValidMotion()
|| profile.getCombatProcessor().getTarget() == null) {
return;
}
final Entity target = profile.getCombatProcessor().getTarget();
//Get the clients yaw and pitch
final double yaw = profile.getRotationProcessor().getYaw();
final double pitch = profile.getRotationProcessor().getPitch();
//Get the clients position
final double lastX = profile.getMovementProcessor().getLastX();
final double lastZ = profile.getMovementProcessor().getLastZ();
//Get target hitbox
BoundingBox boundingBox = Edge.getInstance().getInstanceManager().getInstance().getBoundingBox(target);
//Expand it by 10% for 1.8 clients
boundingBox.expand(0.1F, 0.1F, 0.1F);
//Get the direction the player is looking at
Vector dir = new Vector(-Math.sin(Math.toRadians(yaw)), 0, Math.cos(Math.toRadians(yaw)));
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,58 @@
package cc.edgesolutions.edge.check.impl.combat.hitbox;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.util.Vector3f;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import io.github.retrooper.packetevents.util.SpigotReflectionUtil;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.Optional;
@Check(name = "HitBox", type = "B", description = "Invalid attack vector", releaseType = ReleaseType.RELEASE, typeAdvanced = "Vector")
public class HitBoxB extends EdgeCheck {
public HitBoxB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isUseEntity(event)) {
return;
}
WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event);
Entity entity = SpigotReflectionUtil.getEntityById(wrapper.getEntityId());
if (entity instanceof Player) {
Optional<Vector3f> vec3 = wrapper.getTarget();
if (vec3.isPresent()) {
Vector3f hitbox = vec3.get();
if (Math.abs(hitbox.getX()) > 0.4001 || Math.abs(hitbox.getZ()) > 0.4001 || Math.abs(hitbox.getY()) > 2.0) {
fail(
"X=" + Math.abs(hitbox.getX()),
"Y=" + Math.abs(hitbox.getY()),
"Z=" + Math.abs(hitbox.getZ()),
"A=" + wrapper.getAction().name()
);
}
}
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,75 @@
package cc.edgesolutions.edge.check.impl.combat.hitbox;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.config.CheckSetting;
import cc.edgesolutions.edge.config.ConfigManager;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import io.github.retrooper.packetevents.util.SpigotReflectionUtil;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.text.DecimalFormat;
@Check(name = "Reach", type = "A", description = "Attack range", releaseType = ReleaseType.DEVELOPMENTAL, typeAdvanced = "Range")
public class ReachA extends EdgeCheck {
private final CheckSetting<Double> max = new CheckSetting<>(
this,
ConfigManager.CHECKS_CONFIG,
"Settings.Max",
3.01
);
public ReachA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isUseEntity(event)) {
return;
}
final WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event);
Entity target = profile.getCombatProcessor().getTarget();
if (wrapper.getAction() != WrapperPlayClientInteractEntity.InteractAction.ATTACK
|| target == null
|| SpigotReflectionUtil.getEntityById(wrapper.getEntityId()) != profile.getCombatProcessor().getLastTarget()
|| !profile.isValidMotion()) {
buffer().remove(true, 0.1);
return;
}
double distance = profile.getReachProcessor().getDistance();
String formatted = new DecimalFormat("##.##").format(distance);
if (profile.isDebugReach()) {
profile.sendDebug((distance > max.getValue() ? ChatColor.RED : ChatColor.GREEN) + "D=" + formatted);
}
if (distance > max.getValue()) {
if (buffer().addAndGet() >= 1) { //buffer.getValue()
fail(
"D=" + formatted,
"T=" + target.getName(),
"P=" + profile.getConnectionProcessor().getPingTicks(),
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, 0.05);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,65 @@
package cc.edgesolutions.edge.check.impl.combat.killaura;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import org.bukkit.entity.Player;
@Check(name = "KillAura", type = "A", releaseType = ReleaseType.RELEASE, description = "Post UseEntity", typeAdvanced = "UseEntity")
public class KillAuraA extends EdgeCheck {
private long lastFlying;
private boolean sent;
public KillAuraA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isFlyingType(event)) {
final long now = System.currentTimeMillis();
final long delay = now - lastFlying;
if (sent) {
if (delay > 40L && delay < 100L) {
if (buffer().addAndGet() > 0) {
fail(
"D=" + delay,
"LF=" + lastFlying,
"S=" + sent,
"N=" + now,
"B=" + buffer().getRounded()
);
}
} else {
buffer().remove(true, .125);
}
sent = false;
}
lastFlying = now;
} else if (EdgePacket.isUseEntity(event)) {
final WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event);
if (wrapper.getAction() != WrapperPlayClientInteractEntity.InteractAction.ATTACK) return;
final long delay = System.currentTimeMillis() - lastFlying;
if (delay < 10) {
sent = true;
}
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,65 @@
package cc.edgesolutions.edge.check.impl.combat.killaura;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import org.bukkit.entity.Player;
@Check(name = "KillAura", type = "B", releaseType = ReleaseType.EXPERIMENTAL, description = "Attacked NPC", typeAdvanced = "Entity")
public class KillAuraB extends EdgeCheck {
public KillAuraB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isUseEntity(event)) {
WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event);
//if (wrapper.getEntityId() == profile.getBotProcessor().getEntityId()) {
// profile.getBotProcessor().onHit();
//
// if (profile.isDebugBot()) {
// sendDebug(ChatColor.RED + "Landed hit successfully. " + ChatColor.RED + " Attempt " + buffer().getRounded());
// }
//
// if (buffer().addAndGet() > 3) {
// if (profile.isDebugBot()) {
// sendDebug(ChatColor.RED + "Bot attack CPS was " + profile.getCombatProcessor().getCps() + " cps.");
// }
// fail(
// "A=" + profile.getBotProcessor().getBotHits(),
// "V=" + profile.getBotProcessor().getTotalVL(),
// "T=threshold",
// "B=" + buffer().getRounded()
// );
// }
//} else buffer().remove(true, 0.25);
} else if (EdgePacket.isFlyingType(event)) {
// if (profile.getBotProcessor().getTotalVL() > 2) {
// if (!profile.getBotProcessor().isSpawned()) {
// profile.getBotProcessor().spawn();
// Bukkit.getScheduler().runTaskLater(Edge.getInstance(), () -> {
// profile.getBotProcessor().despawn();
// if (!(profile.getBotProcessor().getTotalVL() < 5)) {
// profile.getBotProcessor().setTotalVL(0);
// }
// }, 10 * 20L);
// }
// }
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,52 @@
package cc.edgesolutions.edge.check.impl.combat.killaura;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "KillAura", type = "C", releaseType = ReleaseType.EXPERIMENTAL, description = "KeepSprint", typeAdvanced = "Sprint")
public class KillAuraC extends EdgeCheck {
public KillAuraC(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
if (!profile.isValidRotation()
|| !profile.isSprinting()
|| profile.getCombatProcessor().getAttackTimer().passed(1)) { //3
buffer().reset();
return;
}
final double deltaXZ = profile.getMovementProcessor().getDeltaXZ();
final double lastDeltaXZ = profile.getMovementProcessor().getLastDeltaXZ();
final double diff = Math.abs(deltaXZ - lastDeltaXZ);
if (diff <= 0.01 && deltaXZ > profile.getMovementProcessor().getBaseSpeed()) {
if (buffer().addAndGet() > 8) {
fail(
"D=" + diff,
"DZ=" + deltaXZ,
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, 0.5);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,58 @@
package cc.edgesolutions.edge.check.impl.combat.killaura;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import org.bukkit.entity.Player;
@Check(name = "KillAura", type = "D", releaseType = ReleaseType.RELEASE, description = "Sent UseEntity without swinging", typeAdvanced = "NoSwing")
public class KillAuraD extends EdgeCheck {
private int swings, hits;
private long lastUseEntity;
public KillAuraD(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isUseEntity(event)) {
WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event);
if (wrapper.getAction() == WrapperPlayClientInteractEntity.InteractAction.ATTACK) {
final long currentTime = System.currentTimeMillis();
final long delta = currentTime - this.lastUseEntity;
this.lastUseEntity = currentTime;
if (this.hits++ > 3) {
if (this.swings == 0 && delta > 25L) {
fail(
"S=" + swings,
"D=" + delta,
"H=" + hits,
"T=" + currentTime,
"B=" + buffer().getRounded()
);
}
this.hits = this.swings = 0;
}
}
} else if (EdgePacket.isAnimation(event)) this.swings++;
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,52 @@
package cc.edgesolutions.edge.check.impl.combat.killaura;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import org.bukkit.entity.Player;
@Check(name = "KillAura", type = "E", releaseType = ReleaseType.RELEASE, description = "Missing UseEntity interact", typeAdvanced = "Interact")
public class KillAuraE extends EdgeCheck {
private boolean sentInteract;
private boolean sentInteractAt;
public KillAuraE(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (profile.getVersion().isOlderThan(ClientVersion.V_1_8)) return;
if (EdgePacket.isUseEntity(event)) {
WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event);
if (wrapper.getAction() == WrapperPlayClientInteractEntity.InteractAction.INTERACT) {
sentInteractAt = true;
} else if (wrapper.getAction() == WrapperPlayClientInteractEntity.InteractAction.INTERACT_AT) {
sentInteract = true;
}
} else if (EdgePacket.isFlyingType(event)) {
if (sentInteract != sentInteractAt)
fail(
"I=" + sentInteract,
"IA=" + sentInteractAt,
"B=" + buffer().getRounded()
);
sentInteract = false;
sentInteractAt = false;
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,67 @@
package cc.edgesolutions.edge.check.impl.combat.killaura;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import com.google.common.collect.Lists;
import org.bukkit.entity.Player;
import java.util.Collections;
import java.util.List;
@Check(name = "KillAura", type = "F", releaseType = ReleaseType.EXPERIMENTAL, description = "Invalid attack pattern", typeAdvanced = "Pattern")
public class KillAuraF extends EdgeCheck {
private final List<Long> samples = Lists.newArrayList();
private long lastAttack;
public KillAuraF(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isUseEntity(event)) return;
final WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event);
if (wrapper.getAction() != WrapperPlayClientInteractEntity.InteractAction.ATTACK) {
return;
}
final long delay = System.currentTimeMillis() - this.lastAttack;
this.samples.add(delay);
if (this.samples.size() == 10) {
Collections.sort(this.samples);
final long range = this.samples.get(this.samples.size() - 1) - this.samples.get(0);
if (range < 50L) {
if (buffer().addAndGet() > 2) { //3
fail(
"D=" + delay,
"S=" + samples.size(),
"R=" + range,
"B=" + buffer().getRounded()
);
}
} else {
buffer().remove(true, .75);
}
this.samples.clear();
}
this.lastAttack = System.currentTimeMillis();
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,57 @@
package cc.edgesolutions.edge.check.impl.combat.killaura;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "KillAura", type = "G", description = "Post ArmAnimation", releaseType = ReleaseType.RELEASE, typeAdvanced = "Animation")
public class KillAuraG extends EdgeCheck {
private long lastFlying;
private boolean sent;
public KillAuraG(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isAnimation(event)) {
final long delay = System.currentTimeMillis() - this.lastFlying;
if (delay < 10L) {
this.sent = true;
}
}
if (EdgePacket.isFlyingType(event)) {
final long delay = System.currentTimeMillis() - this.lastFlying;
if (profile.isPrinter()) return;
if (this.sent) {
if (delay > 40L && delay < 100L) {
if (buffer().addAndGet() > 0) {
fail(
"D=" + delay,
"L=" + lastFlying,
"B=" + buffer().getRounded()
);
}
} else {
buffer().remove(true, .125);
}
this.sent = false;
}
this.lastFlying = System.currentTimeMillis();
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,290 @@
package cc.edgesolutions.edge.check.impl.combat.velocity;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@Check(name = "Velocity", type = "A", releaseType = ReleaseType.DEVELOPMENTAL, description = "Invalid velocity (reverse/low velocity)")
public class VelocityA extends EdgeCheck {
private static final float[] SIN_TABLE_FAST = new float[4096], SIN_TABLE_FAST_NEW = new float[4096];
private static final float[] SIN_TABLE = new float[65536];
//TODO: add exemptions
private static final float radToIndex = roundToFloat(651.8986469044033D);
static {
for (int i = 0; i < 65536; ++i) {
SIN_TABLE[i] = (float) Math.sin((double) i * Math.PI * 2.0D / 65536.0D);
}
for (int j = 0; j < 4096; ++j) {
SIN_TABLE_FAST[j] = (float) Math.sin(((float) j + 0.5F) / 4096.0F * ((float) Math.PI * 2F));
}
for (int l = 0; l < 360; l += 90) {
SIN_TABLE_FAST[(int) ((float) l * 11.377778F) & 4095] = (float) Math.sin((float) l * 0.017453292F);
}
for (int j = 0; j < SIN_TABLE_FAST_NEW.length; ++j) {
SIN_TABLE_FAST_NEW[j] = roundToFloat(Math.sin((double) j * Math.PI * 2.0D / 4096.0D));
}
}
private Float friction;
public VelocityA(Profile profile) {
super(profile);
}
public static float sqrt(double var0) {
return (float) Math.sqrt(var0);
}
public static float sin(int type, float value) {
switch (type) {
case 0:
default: {
return SIN_TABLE[(int) (value * 10430.378F) & 65535];
}
case 1: {
return SIN_TABLE_FAST[(int) (value * 651.8986F) & 4095];
}
case 2: {
return SIN_TABLE_FAST_NEW[(int) (value * radToIndex) & 4095];
}
}
}
public static float cos(int type, float value) {
switch (type) {
case 0:
default:
return SIN_TABLE[(int) (value * 10430.378F + 16384.0F) & 65535];
case 1:
return SIN_TABLE_FAST[(int) ((value + ((float) Math.PI / 2F)) * 651.8986F) & 4095];
case 2:
return SIN_TABLE_FAST_NEW[(int) (value * radToIndex + 1024.0F) & 4095];
}
}
private static float roundToFloat(double d) {
return (float) ((double) Math.round(d * 1.0E8D) / 1.0E8D);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
WrapperPlayClientPlayerFlying flying = new WrapperPlayClientPlayerFlying(event);
if (this.profile.getVelocityProcessor().getLastConfirmedVelocityData() == null
|| profile.getCollisionProcessor().isCollideHorizontal()
|| profile.getCollisionProcessor().getClimbableTicks() > 0
|| profile.getCollisionProcessor().getLiquidTicks() > 0
|| !profile.isValidMotion()) {
return;
}
float attributeSpeed;
attributeSpeed = this.profile.getPlayer().getWalkSpeed() / 2;
if (this.profile.getAttributeProcessor().isHasSpeed()) {
attributeSpeed += this.profile.getAttributeProcessor()
.getSpeedLevel() * 0.2D * attributeSpeed;
}
if (this.profile.getAttributeProcessor().isHasSlow()) {
attributeSpeed += this.profile.getAttributeProcessor()
.getSlowLevel() * -.15D * attributeSpeed;
}
double smallest = Double.MAX_VALUE;
double velocityX = this.profile.getVelocityProcessor().getLastConfirmedVelocityData().getX();
double velocityZ = this.profile.getVelocityProcessor().getLastConfirmedVelocityData().getZ();
double deltaX = this.profile.getMovementProcessor().getDeltaX();
double deltaZ = this.profile.getMovementProcessor().getDeltaZ();
int tick = Math.abs(this.profile.getVelocityProcessor().getFlyingTicks()
- this.profile.getVelocityProcessor().getVelocityTicks());
if (tick > 1 && tick < 10) {
if (this.friction != null) {
iteration:
{
for (int fastMath = 0; fastMath <= 2; fastMath++) {
for (int f = -1; f < 2; f++) {
for (int s = -1; s < 2; s++) {
for (boolean jump : new boolean[]{true, false}) {
for (boolean sprint : new boolean[]{true, false}) {
for (boolean ground : new boolean[]{true, false}) {
for (boolean attacking : new boolean[]{true, false}) {
for (boolean sneaking : new boolean[]{true, false}) {
for (boolean using : new boolean[]{true, false}) {
float moveForward = f * 0.98F;
float moveStrafe = s * 0.98F;
double simulationX = velocityX;
double simulationZ = velocityZ;
if (profile.getVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) {
if (Math.abs(simulationX) < 0.003D) simulationX = 0.0D;
if (Math.abs(simulationZ) < 0.003D) simulationZ = 0.0D;
} else {
if (Math.abs(simulationX) < 0.005D) simulationX = 0.0D;
if (Math.abs(simulationZ) < 0.005D) simulationZ = 0.0D;
}
if (attacking) {
simulationX *= 0.6;
simulationZ *= 0.6;
}
if (using) {
moveForward *= 0.2D;
moveStrafe *= 0.2D;
}
if (sneaking) {
moveForward *= (float) 0.3D;
moveStrafe *= (float) 0.3D;
}
if (jump && sprint) {
simulationX -= sin(fastMath,
flying.getLocation().getYaw()
* 0.017453292F) * 0.2F;
simulationZ += cos(fastMath,
flying.getLocation().getYaw()
* 0.017453292F) * 0.2F;
}
if (ground) {
simulationX *= (this.friction * 0.91F);
simulationZ *= (this.friction * 0.91F);
} else {
simulationX *= (0.91F);
simulationZ *= (0.91F);
}
float friction = ground ? (this.friction * 0.91F)
: 0.91F;
float moveSpeed = attributeSpeed;
if (sprint) {
moveSpeed += moveSpeed * 0.30000001192092896D;
}
float attribute;
if (ground) {
float moveSpeedMultiplier = 0.16277136F /
(friction * friction * friction);
attribute = moveSpeed * moveSpeedMultiplier;
} else {
attribute = (float)
(sprint ? ((double) 0.02F + (double) 0.02F * 0.3D) : 0.02F);
}
double[] appliedVelocities = moveFlying(simulationX, simulationZ,
moveStrafe, moveForward, attribute,
flying.getLocation().getYaw(), fastMath);
simulationX = appliedVelocities[0];
simulationZ = appliedVelocities[1];
double offsetX = deltaX - simulationX;
double offsetZ = deltaZ - simulationZ;
double offset = offsetX * offsetX + offsetZ * offsetZ;
if (offset < smallest) {
smallest = offset;
if (offset < 1E-25) {
break iteration;
}
}
}
}
}
}
}
}
}
}
}
}
double max = (tick < 6 ? 0.01 : 0.14);
double ratio = smallest / max;
//Not perfect check but does the job
if (smallest >= max) {
if (buffer().addAndGet() > 3) {
this.fail(
"S=" + smallest,
"M=" + max,
"R=" + ratio + "%",
"T=" + tick,
"B=" + buffer().getRounded()
);
}
} else {
this.bufferValue -= Math.min(bufferValue, .1);
}
}
}
this.friction = profile.getBlockProcessor().getBlockFriction(new Location(profile.getPlayer().getWorld(),
profile.getMovementProcessor().getLocation().getX(),
profile.getMovementProcessor().getLocation().getY() - 1,
profile.getMovementProcessor().getLocation().getZ())
);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
private double[] moveFlying(double motionX, double motionZ, float strafe, float forward, float friction, float yaw, int fastMath) {
float f = strafe * strafe + forward * forward;
if (f >= 1.0E-4F) {
f = sqrt(f);
if (f < 1.0F) {
f = 1.0F;
}
f = friction / f;
strafe = strafe * f;
forward = forward * f;
float f1 = sin(fastMath, yaw * (float) Math.PI / 180.0F);
float f2 = cos(fastMath, yaw * (float) Math.PI / 180.0F);
motionX += strafe * f2 - forward * f1;
motionZ += forward * f2 + strafe * f1;
}
return new double[]{motionX, motionZ};
}
}

View File

@ -0,0 +1,60 @@
package cc.edgesolutions.edge.check.impl.combat.velocity;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Velocity", type = "B", releaseType = ReleaseType.DEVELOPMENTAL, description = "No vertical velocity", typeAdvanced = "Ignore")
public class VelocityB extends EdgeCheck {
public VelocityB(Profile profile) {
super(profile);
}
//TODO: add exemptions
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
if (this.profile.getVelocityProcessor().getLastConfirmedVelocityData() == null
|| profile.getCollisionProcessor().isCactus()
|| !profile.isValidMotion()) {
return;
}
int tick = Math.abs(this.profile.getVelocityProcessor().getFlyingTicks()
- this.profile.getVelocityProcessor().getVelocityTicks());
boolean ground = profile.getMovementProcessor().isGround();
boolean lastGround = profile.getMovementProcessor().isLastGround();
float deltaY = (float) profile.getMovementProcessor().getDeltaY();
float total = (float) (deltaY / this.profile.getVelocityProcessor().getLastConfirmedVelocityData().getY());
if (tick == 1 && ground && lastGround && deltaY == 0.0 && total < 0.991) {
if (buffer().addAndGet() > 3) {
this.fail(
"T=" + total,
"Y=" + deltaY,
"B=" + buffer().getRounded()
);
}
} else {
this.bufferValue -= Math.min(this.bufferValue, 0.025);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,61 @@
package cc.edgesolutions.edge.check.impl.combat.velocity;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Velocity", type = "C", releaseType = ReleaseType.DEVELOPMENTAL, description = "Invalid vertical velocity", typeAdvanced = "Y")
public class VelocityC extends EdgeCheck {
public VelocityC(Profile profile) {
super(profile);
}
//TODO: add exemptions
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
if (this.profile.getVelocityProcessor().getLastConfirmedVelocityData() == null
|| profile.getCollisionProcessor().getBlockAboveTicks() > 0
|| !profile.isValidMotion()) {
return;
}
int tick = Math.abs(this.profile.getVelocityProcessor().getFlyingTicks()
- this.profile.getVelocityProcessor().getVelocityTicks());
boolean ground = profile.getMovementProcessor().isGround();
boolean lastGround = profile.getMovementProcessor().isLastGround();
float deltaY = (float) profile.getMovementProcessor().getDeltaY();
float total = (float) (deltaY / this.profile.getVelocityProcessor().getLastConfirmedVelocityData().getY());
if (tick == 1 && !ground && lastGround && total < 0.991) {
if (buffer().addAndGet() > 2) { //3
this.fail(
"T=" + total,
"Y=" + deltaY,
"G=" + ground,
"B=" + buffer().getRounded()
);
}
} else {
this.bufferValue -= Math.min(this.bufferValue, 0.025);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,34 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.noslow;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "NoSlow", type = "A")
public class NoSlowA extends EdgeCheck {
public NoSlowA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
final double deltaXZ = profile.getMovementProcessor().getDeltaXZ();
final boolean sprinting = profile.isSprinting();
final boolean sneaking = profile.isSneaking();
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,42 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "A", description = "Invalid Rotation", releaseType = ReleaseType.RELEASE)
public class ProtocolA extends EdgeCheck {
public ProtocolA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isRotation(event)) {
return;
}
WrapperPlayClientPlayerFlying flying = new WrapperPlayClientPlayerFlying(event);
float pitch = flying.getLocation().getPitch();
float yaw = flying.getLocation().getYaw();
if (Math.abs(pitch) > 90.0) {
fail(
"P=" + pitch
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,51 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "B", description = "Invalid attack action", releaseType = ReleaseType.EXPERIMENTAL)
public class ProtocolB extends EdgeCheck {
private boolean invalid;
public ProtocolB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isUseEntity(event)) {
final WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event);
if (wrapper.getAction() == WrapperPlayClientInteractEntity.InteractAction.ATTACK && invalid) {
fail();
}
} else if (EdgePacket.isEntityAction(event)) {
final WrapperPlayClientEntityAction wrapper = new WrapperPlayClientEntityAction(event);
switch (wrapper.getAction()) {
case START_SNEAKING:
case STOP_SNEAKING:
case START_SPRINTING:
case STOP_SPRINTING:
invalid = true;
break;
}
} else if (EdgePacket.isFlyingType(event)) {
invalid = false;
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,63 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.Edge;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@Check(name = "Protocol", type = "C", description = "Invalid interaction vector", releaseType = ReleaseType.RELEASE)
public class ProtocolC extends EdgeCheck {
private boolean isSword;
public ProtocolC(Profile profile) {
super(profile);
}
//TODO: this check is only for 1.8 and 1.7 versions!
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isFlyingType(event)) {
if (this.buffer().get() > 10) {
this.fail(
"B=" + buffer().getRounded()
);
}
}
if (EdgePacket.isBlockPlace(event)) {
this.buffer().reset();
}
if (EdgePacket.isUseEntity(event)) {
WrapperPlayClientInteractEntity interactEntity = new WrapperPlayClientInteractEntity(event);
ItemStack hand = Edge.getInstance().getInstanceManager().getInstance().getItemInHand(profile);
if (hand == null) return;
this.isSword = profile.isSword(hand);
if (this.isSword) {
if (interactEntity.getAction() == WrapperPlayClientInteractEntity.InteractAction.INTERACT) {
this.buffer().add();
} else if (interactEntity.getAction() == WrapperPlayClientInteractEntity.InteractAction.INTERACT_AT) {
this.buffer().add();
}
}
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,82 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.Edge;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.player.DiggingAction;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@Check(name = "Protocol", type = "D", description = "Attacking while blocking or unblocking at the same time")
public class ProtocolD extends EdgeCheck {
private boolean digging, blocking;
public ProtocolD(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isFlyingType(event)) {
this.blocking = this.digging = false;
}
if (EdgePacket.isBlockPlace(event)) {
ItemStack hand = Edge.getInstance().getInstanceManager().getInstance().getItemInHand(profile);
if (hand != null) {
if (profile.isSword(hand)) {
this.blocking = true;
}
}
}
if (EdgePacket.isBlockBreak(event)) {
WrapperPlayClientPlayerDigging digging = new WrapperPlayClientPlayerDigging(event);
ItemStack hand = Edge.getInstance().getInstanceManager().getInstance().getItemInHand(profile);
if (digging.getAction() == DiggingAction.RELEASE_USE_ITEM) {
if (hand != null) {
if (profile.isSword(hand)) {
this.digging = true;
}
}
}
}
if (EdgePacket.isUseEntity(event)) {
WrapperPlayClientInteractEntity interactEntity = new WrapperPlayClientInteractEntity(event);
ItemStack hand = Edge.getInstance().getInstanceManager().getInstance().getItemInHand(profile);
if (hand == null) return;
if (profile.isSword(hand)) {
if (interactEntity.getAction() == WrapperPlayClientInteractEntity.InteractAction.ATTACK) {
if (this.digging || this.blocking) {
if (buffer().addAndGet() > 3) {
this.fail(
"D=" + this.digging,
"B=" + this.blocking,
"B=" + buffer().getRounded()
);
}
}
}
}
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,77 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPluginMessage;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Check(name = "Protocol", type = "E", description = "Invalid payload", releaseType = ReleaseType.RELEASE, typeAdvanced = "Payload")
public class ProtocolE extends EdgeCheck {
public ProtocolE(Profile profile) {
super(profile);
}
private final List<String> invalidPayload = Arrays.asList(
"Remix",
"CRYSTAL",
"matrix",
"LOLIMAHCKER",
"MCnetHandler",
"XDSMKDKFDKSDAKDFkEJF",
"CRYSTAL|6LAKS0TRIES",
"CrystalWare",
"CRYSTAL|KZ1LM9TO",
"Misplace",
"reach",
"lmaohax",
"warac:exempt",
"Reach Mod",
"cock",
"218c69d8875f",
"Vape v3",
"1946203560",
"#unbanearwax",
"OVF|DISABLE",
"EARWAXWASHERE",
"Cracked Vape",
"EROUAXWASHERE",
"Vape",
"Bspkrs Client"
);
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isCustomPayload(event)) {
return;
}
final WrapperPlayClientPluginMessage wrapper = new WrapperPlayClientPluginMessage(event);
//This would make the overall time complexity of the code O(n) instead of O(n^2).
Set<String> invalidPayloadSet = new HashSet<>(invalidPayload);
String channelName = wrapper.getChannelName();
if (invalidPayloadSet.contains(channelName)) {
fail(
"P=" + channelName
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,43 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "F", description = "Self harm", releaseType = ReleaseType.EXPERIMENTAL)
public class ProtocolF extends EdgeCheck {
public ProtocolF(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isUseEntity(event)) {
return;
}
final WrapperPlayClientInteractEntity wrapper = new WrapperPlayClientInteractEntity(event);
final int targetId = wrapper.getEntityId();
final int attackerId = player.getEntityId();
if (targetId == attackerId) {
fail(
"T=" + targetId,
"A=" + attackerId
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,40 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "G", description = "Attacked dead entity", releaseType = ReleaseType.EXPERIMENTAL)
public class ProtocolG extends EdgeCheck {
private int predicted;
public ProtocolG(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isUseEntity(event)) {
return;
}
if (player.isDead()) {
if (buffer().addAndGet() > 2) {
fail(
"B=" + buffer().getRounded()
);
}
} else buffer().reset();
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,49 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerAbilities;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "H", description = "Attribute spoof", releaseType = ReleaseType.EXPERIMENTAL)
public class ProtocolH extends EdgeCheck {
public ProtocolH(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isAbilities(event)) {
return;
}
WrapperPlayClientPlayerAbilities packet = new WrapperPlayClientPlayerAbilities(event);
GameMode mode = player.getGameMode();
if (!player.getAllowFlight() && (packet.isFlying() || packet.isFlightAllowed().get())) {
fail(
"M=" + mode,
"AF=" + player.getAllowFlight(),
"FA=" + packet.isFlightAllowed(),
"F=" + packet.isFlying()
);
} else if (mode != GameMode.CREATIVE && mode != GameMode.SPECTATOR && packet.isInGodMode().get()) {
fail(
"M=" + mode,
"G=" + packet.isInGodMode().get()
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,49 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientKeepAlive;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "I", description = "Duplicate KeepAlive IDs", releaseType = ReleaseType.RELEASE)
public class ProtocolI extends EdgeCheck {
private long lastId = -1;
public ProtocolI(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isKeepAlive(event)) {
return;
}
final WrapperPlayClientKeepAlive wrapper = new WrapperPlayClientKeepAlive(event);
long id = wrapper.getId();
if (id == lastId) {
if (buffer().addAndGet() > 2) {
fail(
"ID=" + id,
"L=" + lastId,
"B=" + buffer().getRounded()
);
}
}
lastId = id;
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,62 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "J", description = "Invalid inventory action", releaseType = ReleaseType.RELEASE)
public class ProtocolJ extends EdgeCheck {
private int lastSlot = -1;
public ProtocolJ(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isHeldItemChange(event)) {
return;
}
final WrapperPlayClientHeldItemChange wrapper = new WrapperPlayClientHeldItemChange(event);
final int slot = wrapper.getSlot();
if (slot < 0 || slot > 8) {
fail(
"T=Invalid slot",
"S=" + slot,
"B=" + buffer().getRounded()
);
}
if (lastSlot == slot) {
fail(
"T=Invalid slot switch",
"S=" + slot,
"L=" + lastSlot,
"B=" + buffer().getRounded()
);
}
if (slot < 0 && slot != -999 && slot != -1) {
fail(
"T=Invalid slot (2)",
"S=" + slot,
"B=" + buffer().getRounded()
);
}
lastSlot = slot;
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,86 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.util.Vector3i;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "K", description = "Liquid occlusion", releaseType = ReleaseType.EXPERIMENTAL)
public class ProtocolK extends EdgeCheck {
public ProtocolK(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isBlockPlace(event)) {
final WrapperPlayClientPlayerBlockPlacement wrapper = new WrapperPlayClientPlayerBlockPlacement(event);
if (profile.isPrinter()) return;
Vector3i blockPosition = wrapper.getBlockPosition();
final Block block = profile.getBlockProcessor().getBlockAsync(
new Location(
player.getWorld(),
blockPosition.getX(),
blockPosition.getY(),
blockPosition.getZ()
)
);
if (block != null && block.isLiquid()) {
fail(
"T=Place",
"X=" + blockPosition.getX(),
"Y=" + blockPosition.getY(),
"Z=" + blockPosition.getZ(),
"B=" + buffer().getRounded()
);
}
}
if (!EdgePacket.isBlockBreak(event)) {
return;
}
final WrapperPlayClientPlayerDigging wrapper = new WrapperPlayClientPlayerDigging(event);
if (profile.isPrinter()) return;
Vector3i blockPosition = wrapper.getBlockPosition();
final Block block = profile.getBlockProcessor().getBlockAsync(
new Location(
player.getWorld(),
blockPosition.getX(),
blockPosition.getY(),
blockPosition.getZ()
)
);
if (block != null && block.isLiquid()) {
fail(
"T=Break",
"X=" + blockPosition.getX(),
"Y=" + blockPosition.getY(),
"Z=" + blockPosition.getZ(),
"B=" + buffer().getRounded()
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,43 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSteerVehicle;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "L", description = "Invalid steering packets", releaseType = ReleaseType.EXPERIMENTAL)
public class ProtocolL extends EdgeCheck {
public ProtocolL(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isSteerVehicle(event)) {
return;
}
final WrapperPlayClientSteerVehicle wrapper = new WrapperPlayClientSteerVehicle(event);
float forwards = Math.abs(wrapper.getForward());
float sideways = Math.abs(wrapper.getSideways());
if (sideways > 0.98f || forwards > 0.98f) {
fail(
"F=" + forwards,
"S=" + sideways,
"B=" + buffer().getRounded()
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,41 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "M", description = "Invalid steering packets", releaseType = ReleaseType.EXPERIMENTAL)
public class ProtocolM extends EdgeCheck {
private int graceTicks = 6;
public ProtocolM(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isSteerBoat(event) && !EdgePacket.isSteerVehicle(event)) {
return;
}
if (player.isInsideVehicle()) {
graceTicks = 6;
} else if (--graceTicks < 0) {
fail(
"T=" + player.isInsideVehicle(),
"G=" + graceTicks
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,37 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "N", description = "Invalid creative packets", releaseType = ReleaseType.RELEASE)
public class ProtocolN extends EdgeCheck {
public ProtocolN(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isCreativeInventory(event)) {
return;
}
if (player.getGameMode() != GameMode.CREATIVE) {
fail(
"M=" + player.getGameMode()
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,38 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.protocol;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientTabComplete;
import org.bukkit.entity.Player;
@Check(name = "Protocol", type = "O", description = "Invalid tab complete packets", releaseType = ReleaseType.EXPERIMENTAL)
public class ProtocolO extends EdgeCheck {
public ProtocolO(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isTabComplete(event)) {
return;
}
WrapperPlayClientTabComplete packet = new WrapperPlayClientTabComplete(event);
if (packet.getText() == null) {
fail(
"T=null"
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,80 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.timer;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.config.CheckSetting;
import cc.edgesolutions.edge.config.ConfigManager;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
import java.util.Deque;
import java.util.LinkedList;
@Check(name = "Timer", type = "A", releaseType = ReleaseType.EXPERIMENTAL, description = "Statistic timer abuse check", typeAdvanced = "Difference")
public class TimerA extends EdgeCheck {
private final CheckSetting<Double> timer = new CheckSetting<>(
this,
ConfigManager.CHECKS_CONFIG,
"Settings.Max",
1.02
);
private long lastFlying;
private final Deque<Long> delay = new LinkedList<>();
public TimerA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
if (profile.getTeleportTicks() < 15) {
delay.clear();
return;
}
final long now = System.currentTimeMillis();
if (!profile.getMovementProcessor().isTeleporting()) delay.add(now - lastFlying);
if (delay.size() == 20) {
final double averagePacketDifference = delay.stream().mapToDouble(d -> d)
.average().orElse(0.0);
final double timerSpeed = 50.0 / averagePacketDifference;
profile.setTimerSpeed(timerSpeed);
if (timerSpeed > timer.getValue()) {
if (buffer().addAndGet() > 2) {
fail(
"T=" + timerSpeed,
"S=" + delay.size(),
"N=" + now,
"B=" + buffer().getRounded()
);
}
} else {
buffer().remove(true, 1);
}
delay.clear();
}
this.lastFlying = now;
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,26 @@
package cc.edgesolutions.edge.check.impl.miscellaneous.timer;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Timer", type = "B", releaseType = ReleaseType.DEVELOPMENTAL, description = "Timer balance abuse check")
public class TimerB extends EdgeCheck {
public TimerB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,106 @@
package cc.edgesolutions.edge.check.impl.movement.flight;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Flight", type = "A", releaseType = ReleaseType.DEVELOPMENTAL, description = "Predictive fly check")
public class FlightA extends EdgeCheck {
private final double DRAG = .9800000190734863D;
private final double MIN_XZ = .09;
private final double ZERO_THREE = .003016261509046103D;
private final double MAX_PREDICTION = 3.780309398848658E-14;
private final double AIR_MOTION = .6349722830977471;
public FlightA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
if (profile.getMovementProcessor().getLastDeltaY() == null) return;
double deltaY = profile.getMovementProcessor().getDeltaY();
double deltaXZ = profile.getMovementProcessor().getDeltaXZ();
boolean ground = profile.getMovementProcessor().isGround();
boolean lastGround = profile.getMovementProcessor().isLastGround();
int airTicks = profile.getMovementProcessor().getAirTicks();
double predictionY = (profile.getMovementProcessor().getLastDeltaY() - 0.08) * this.DRAG;
if (ground
|| lastGround
|| profile.getCollisionProcessor().getLiquidTicks() > 0
|| profile.getCollisionProcessor().getClimbableTicks() > 0
|| (profile.getCurrentTick() - profile.getAbilityProcessor().getBukkitFlyingTick()) < 15
|| !profile.isValidMotion()) {
buffer().remove(true, .005);
return;
}
double deltaPrediction = Math.abs(deltaY - predictionY);
double expected;
boolean zeroThree = false;
// fixes 0.003
if (deltaXZ < this.MIN_XZ) {
expected = 0.004995;
zeroThree = true;
} else {
if (Math.abs(predictionY) < 0.005) {
expected = this.ZERO_THREE;
} else {
expected = this.MAX_PREDICTION;
}
}
// fixes 8th and 9th tick
if (airTicks > 7 && airTicks < 10) {
expected = this.AIR_MOTION;
}
if (profile.getVelocityProcessor().isTakingVelocity()) {
expected += (Math.abs(profile.getVelocityProcessor().getVelocityY()) + +.625);
}
if (deltaPrediction > expected && airTicks > 3) {
if (zeroThree && profile.getMovementProcessor().isNearGround()) {
buffer().reset();
return;
}
if (buffer().addAndGet() > 3) {
fail(
"P=" + predictionY,
"D=" + deltaPrediction,
"E=" + expected,
"T=" + airTicks,
"ZT=" + zeroThree,
"B=" + buffer().getRounded()
);
}
} else {
buffer().remove(true, .05);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,75 @@
package cc.edgesolutions.edge.check.impl.movement.flight;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.profile.processor.CollisionProcessor;
import cc.edgesolutions.edge.profile.processor.MovementProcessor;
import cc.edgesolutions.edge.utils.player.PlayerUtils;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;
import org.bukkit.entity.Player;
@Check(name = "Flight", type = "B", releaseType = ReleaseType.DEVELOPMENTAL, description = "Not corresponding to ground rules", typeAdvanced = "Spoof")
public class FlightB extends EdgeCheck {
public FlightB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
final WrapperPlayClientPlayerFlying wrapper = new WrapperPlayClientPlayerFlying(event);
final MovementProcessor movement = profile.getMovementProcessor();
final CollisionProcessor collision = profile.getCollisionProcessor();
if (collision.getSlimeTicks() > 0
|| movement.getLastDeltaY() == null
|| PlayerUtils.isNearVehicle(player)
|| profile.getTeleportTicks() < 40
|| profile.getCollisionProcessor().getStairTicks() > 0
|| !profile.isValidMotion()) {
buffer().reset();
return;
}
final boolean ground = movement.isGround();
final boolean serverGround = collision.isServerGround();
final boolean math = movement.getY() % 0.015625 == 0;
final double deltaY = movement.getDeltaY();
final double lastDeltaY = movement.getLastDeltaY();
final int airTicks = movement.getAirTicks();
if (airTicks == 0 && !ground ||
airTicks == 0 && !math ||
airTicks > 0 && ground ||
airTicks > 0 && math) {
if (buffer().addAndGet() > 1) {
fail(
"Y=" + deltaY,
"L=" + lastDeltaY,
"A=" + airTicks,
"M=" + math,
"S=" + serverGround,
"G=" + ground,
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, 0.15);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,102 @@
package cc.edgesolutions.edge.check.impl.movement.invalid;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Invalid", type = "A", description = "Invalid predicted jump ratio", releaseType = ReleaseType.EXPERIMENTAL, typeAdvanced = "Jump")
public class InvalidA extends EdgeCheck {
private int ticks = Integer.MAX_VALUE;
private double expectedJumpMotion;
public InvalidA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isPosition(event)) {
return;
}
final boolean onGround = profile.getMovementProcessor().isGround();
final boolean lastOnGround = profile.getMovementProcessor().isLastGround();
final double deltaY = profile.getMovementProcessor().getDeltaY();
final double y = profile.getMovementProcessor().getY();
final double lastY = profile.getMovementProcessor().getLastY();
final boolean step = y % 0.015625 == 0.0 && lastY % 0.015625 == 0.0;
final double modifierJump = profile.getAttributeProcessor().getJumpLevel() * 0.1F;
if ((profile.getCurrentTick() - profile.getAbilityProcessor().getBukkitFlyingTick()) < 15
|| profile.getCollisionProcessor().getWebTicks() > 0
|| profile.getCollisionProcessor().getClimbableTicks() > 0
|| profile.getCollisionProcessor().getSlimeTicks() > 0
|| profile.getCollisionProcessor().getLiquidTicks() > 0
|| profile.getVelocityProcessor().isTakingVelocity()
|| !profile.isValidMotion()
|| profile.getCollisionProcessor().getPistonTicks() > 0) {
ticks = Integer.MAX_VALUE;
return;
}
final boolean jumped = deltaY > 0.0 && !onGround && lastY % 0.015625 == 0.0 && !step && lastOnGround;
final boolean slime = profile.getCollisionProcessor().getSlimeTicks() > 0;
if (jumped) {
ticks = 0;
expectedJumpMotion = 0.42F + modifierJump;
}
//Account slime soon
/* if (slime) {
expectedJumpMotion *= 0.2F;
}*/
boolean flagged = false;
if (onGround) ticks = Integer.MAX_VALUE;
if (ticks < 5) {
ticks++;
if (Math.abs(deltaY - expectedJumpMotion) > 0.00001) {
flagged = true;
if (buffer().upMin(100) > 100) {
if (Math.abs(deltaY - 0.2 + modifierJump) > 0.0001 && Math.abs(deltaY - 0.0338907 + modifierJump) > 0.0001 && Math.abs(deltaY - 0.034999) > 0.0001) {
// fail(
// "Y=" + deltaY,
// "M=" + expectedJumpMotion,
// "J=" + modifierJump,
// "S=" + step,
// "T=" + ticks,
// "B=" + buffer().getRounded()
// );
}
}
ticks = Integer.MAX_VALUE;
} else {
expectedJumpMotion = Math.abs((expectedJumpMotion - 0.08) * 0.9800000190734863F) < 0.005 ? 0 : (expectedJumpMotion - 0.08) * 0.9800000190734863F;
}
}
if (!flagged) buffer().remove(false, 1);
//if (step && deltaY > 0.6F) fail("Y" + deltaY, "B=" + buffer().getRounded(), "T=" + ticks, "");
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,44 @@
package cc.edgesolutions.edge.check.impl.movement.invalid;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Invalid", type = "A1", description = "Invalid value")
public class InvalidA1 extends EdgeCheck {
public InvalidA1(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isPosition(event)) {
return;
}
if (!profile.isValidMotion()) return;
final double deltaXZ = profile.getMovementProcessor().getDeltaXZ();
final double modulo = 0.1 % (deltaXZ % 0.1);
if (deltaXZ > 0.11 && modulo < 1.0E-8) {
if (buffer().addAndGet() > 1) {
fail(
"D=" + deltaXZ,
"M=" + modulo,
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, .05);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,55 @@
package cc.edgesolutions.edge.check.impl.movement.invalid;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Invalid", type = "B", releaseType = ReleaseType.EXPERIMENTAL, description = "Invalid jump delta", typeAdvanced = "Delta")
public class InvalidB extends EdgeCheck {
public InvalidB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isPosition(event)) {
return;
}
if (profile.getMovementProcessor().getLastDeltaZ() == null
|| profile.getCancelMoveTimer().hasNotPassed(20)
|| profile.getTeleportTicks() < 5) { //Replace teleportTicks for joinTicks
return;
}
final double potionLevel = profile.getAttributeProcessor().getJumpLevel() * 0.1;
final double deltaY = profile.getMovementProcessor().getDeltaY();
final double lastDeltaY = profile.getMovementProcessor().getLastDeltaY();
final double delta = Math.abs(deltaY - lastDeltaY);
if (delta - potionLevel > 2) {
if (buffer().addAndGet() > 2) {
fail(
"D=" + delta,
"Y=" + deltaY,
"LY=" + lastDeltaY,
"P=" + potionLevel,
"B=" + buffer().getRounded()
);
}
} else this.buffer().remove(true, 0.15);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,56 @@
package cc.edgesolutions.edge.check.impl.movement.invalid;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Invalid", type = "C", releaseType = ReleaseType.DEVELOPMENTAL, description = "Invalid predicted jump motion")
public class InvalidC extends EdgeCheck {
public InvalidC(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isPosition(event)) {
return;
}
if (!profile.isValidMotion()
|| profile.getMovementProcessor().getLastDeltaY() == null
|| profile.getCollisionProcessor().getBlockAboveTicks() > 0) {
return;
}
final double deltaY = profile.getMovementProcessor().getDeltaY();
final double lastDeltaY = profile.getMovementProcessor().getLastDeltaY();
if (lastDeltaY - deltaY > 0.2 && deltaY != 0) {
//if (Math.abs(lastDeltaY - 0.2) < 0.00001) sendDebug("InvalidC: &7You would have been setback."); //
//else
if (buffer().addAndGet() > 2) {
fail(
"LY=" + lastDeltaY,
"Y=" + deltaY,
"V=" + Math.abs(lastDeltaY - 0.2),
"T=" + profile.getCurrentTick(),
"B=" + buffer().getRounded()
);
}
} else {
buffer().remove(true, 0.15);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,63 @@
package cc.edgesolutions.edge.check.impl.movement.invalid;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Invalid", type = "D", releaseType = ReleaseType.RELEASE, description = "Invalid climbable speed", typeAdvanced = "Climbable")
public class InvalidD extends EdgeCheck {
public InvalidD(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isPosition(event)) {
return;
}
if (!profile.isValidMotion()
|| profile.getMovementProcessor().getLastDeltaY() == null) {
return;
}
final boolean onGround = profile.getMovementProcessor().isGround();
final boolean onClimbable = profile.getCollisionProcessor().getClimbableTicks() > 0;
final double deltaY = profile.getMovementProcessor().getDeltaY();
final double lastDeltaY = profile.getMovementProcessor().getLastDeltaY();
final double delta = Math.abs(deltaY - lastDeltaY);
if (onClimbable) {
if (!onGround && delta == 0 && deltaY > 0.1177) {
if (buffer().addAndGet() > 3) {
fail(
"D=" + delta,
"Y=" + deltaY,
"L=" + lastDeltaY,
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, 0.25);
if (deltaY > 0.52F + profile.getAttributeProcessor().getJumpLevel() * 0.1) {
fail(
"T=1",
"Y=" + deltaY,
"G=" + onGround
);
}
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,68 @@
package cc.edgesolutions.edge.check.impl.movement.invalid;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.config.CheckSetting;
import cc.edgesolutions.edge.config.ConfigManager;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
import java.util.Collections;
import java.util.List;
@Check(name = "Invalid", type = "E", releaseType = ReleaseType.EXPERIMENTAL, description = "Duplicate vertical motion", typeAdvanced = "Duplicate")
public class InvalidE extends EdgeCheck {
private final CheckSetting<List<Double>> exempted = new CheckSetting<>(
this,
ConfigManager.CHECKS_CONFIG,
"Settings.Exempted",
Collections.singletonList(0.3100000000000023)
);
public InvalidE(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isPosition(event)) {
return;
}
if (profile.getCollisionProcessor().getLiquidTicks() > 0
|| profile.getCollisionProcessor().getClimbableTicks() > 0
|| profile.getMovementProcessor().getLastDeltaY() == null
|| profile.getCollisionProcessor().getStairTicks() > 0
|| !profile.isValidMotion()) {
return;
}
double deltaY = profile.getMovementProcessor().getDeltaY();
double lastDeltaY = profile.getMovementProcessor().getLastDeltaY();
if (exempted.getValue().contains(deltaY)) {
buffer().remove(true, 0.01);
return;
}
if (deltaY > 0 && deltaY == lastDeltaY) {
if (buffer().addAndGet() > 1) {
fail(
"Y=" + deltaY,
"L=" + lastDeltaY,
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, 0.01);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,50 @@
package cc.edgesolutions.edge.check.impl.movement.invalid;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.profile.processor.CollisionProcessor;
import cc.edgesolutions.edge.profile.processor.MovementProcessor;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Invalid", type = "F", description = "Invalid web motion", releaseType = ReleaseType.DEVELOPMENTAL, typeAdvanced = "Web")
public class InvalidF extends EdgeCheck {
public InvalidF(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isPosition(event)) {
return;
}
final MovementProcessor movement = profile.getMovementProcessor();
final CollisionProcessor collision = profile.getCollisionProcessor();
final double deltaXZ = movement.getDeltaXZ();
final boolean web = profile.getBlockProcessor().getBlockAsync(profile.getPlayer().getLocation().add(0, -0.5, 0)).getType().name().contains("WEB");
if (web) {
if (deltaXZ > 0.1) {
if (buffer().addAndGet() > 1) {
fail(
"S=" + deltaXZ,
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, 0.15);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,55 @@
package cc.edgesolutions.edge.check.impl.movement.invalid;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Invalid", type = "G", releaseType = ReleaseType.EXPERIMENTAL, description = "Invalid ground movement")
public class InvalidG extends EdgeCheck {
public InvalidG(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isPosition(event)) {
return;
}
if (!profile.isValidMotion()
|| profile.getCollisionProcessor().getClimbableTicks() > 0
|| profile.getCollisionProcessor().getSlimeTicks() > 0
|| profile.getCollisionProcessor().getSnowTicks() > 0
|| profile.getCollisionProcessor().getPistonTicks() > 0
|| profile.getCollisionProcessor().getWallTicks() > 0
|| profile.getCollisionProcessor().getStairTicks() > 0
|| profile.getCollisionProcessor().getLiquidTicks() > 0
|| profile.getCollisionProcessor().getHalfBlockTicks() > 0) {
buffer().remove(true, .3);
return;
}
final boolean ground = profile.getMovementProcessor().isGround();
final double deltaY = profile.getMovementProcessor().getDeltaY();
if (ground && deltaY > 0.007) {
if (buffer().addAndGet() > 3) {
fail(
"Y=" + deltaY,
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, .003);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,54 @@
package cc.edgesolutions.edge.check.impl.movement.invalid;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Invalid", type = "H", typeAdvanced = "Ascension", releaseType = ReleaseType.EXPERIMENTAL, description = "Invalid air ascension")
public class InvalidH extends EdgeCheck {
private int time;
public InvalidH(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
double deltaY = profile.getMovementProcessor().getDeltaY();
boolean serverGround = profile.getCollisionProcessor().isServerGround();
if (profile.getCollisionProcessor().getSnowTicks() > 0
|| profile.getCollisionProcessor().getClimbableTicks() > 0
|| profile.getCollisionProcessor().getLiquidTicks() > 0
|| !profile.isValidMotion()) {
return;
}
if (deltaY == 0.0 && !serverGround) {
if (++this.time > 10) {
fail(
"Y=" + deltaY,
"T=" + time,
"R=" + receivedAt
);
}
} else {
this.time = 0;
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,67 @@
package cc.edgesolutions.edge.check.impl.movement.jesus;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.utils.boundingbox.BoundingBox;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@Check(name = "Jesus", type = "A", releaseType = ReleaseType.EXPERIMENTAL, description = "Liquid linear speed check", typeAdvanced = "Speed")
public class JesusA extends EdgeCheck {
public JesusA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
if (!profile.isValidMotion()
|| profile.getAbilityProcessor().getDepthStriderTimer().hasNotPassed(20)
|| profile.getCollisionProcessor().getNearBoatTicks() > 0
|| profile.getCollisionProcessor().getLillyPadTicks() > 0
|| profile.getCollisionProcessor().getLiquidTicks() == 0) {
return;
}
boundingBox:
{
BoundingBox boundingBox = profile.getMovementProcessor().getBoundingBox();
boundingBox.expand(0, -0.5, 0);
if (boundingBox.getAllBlocks(profile).stream().noneMatch(Block::isLiquid)) {
return;
}
}
final double deltaXZ = profile.getMovementProcessor().getDeltaXZ();
double limit = (profile.getVersion().isNewerThanOrEquals(ClientVersion.V_1_13) ? 0.5 : 0.36);
//Could account velocity if needed here (limit += velocity)
if (deltaXZ > limit) {
if (buffer().addAndGet() > 2) {
fail(
"S=" + deltaXZ,
"L=" + limit,
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, 0.1);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,50 @@
package cc.edgesolutions.edge.check.impl.movement.jesus;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Jesus", type = "B", releaseType = ReleaseType.EXPERIMENTAL, description = "Invalid collision with liquid", typeAdvanced = "Motion")
public class JesusB extends EdgeCheck {
public JesusB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isPosition(event)) {
return;
}
if (!profile.isValidMotion()
|| profile.getMovementProcessor().isGround()
|| profile.getCollisionProcessor().getClimbableTicks() > 0
|| profile.getCollisionProcessor().getLillyPadTicks() > 0
|| profile.getCollisionProcessor().getLiquidTicks() == 0) {
buffer().reset();
return;
}
final double deltaY = profile.getMovementProcessor().getDeltaY();
if (deltaY == 0) {
if (buffer().addAndGet() > 9) {
fail(
"Y=" + deltaY,
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, 1);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,270 @@
package cc.edgesolutions.edge.check.impl.movement.speed;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.utils.boundingbox.BoundingBox;
import cc.edgesolutions.edge.utils.math.MathHelper;
import cc.edgesolutions.edge.utils.misc.Motion;
import cc.edgesolutions.edge.utils.misc.MoveFlyingResult;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;
import org.bukkit.entity.Player;
@Check(name = "Speed", type = "A", releaseType = ReleaseType.EXPERIMENTAL, description = "Predictive speed check", typeAdvanced = "Predictive")
public class SpeedA extends EdgeCheck {
private boolean lastLastGround;
public SpeedA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) {
return;
}
final WrapperPlayClientPlayerFlying wrapper = new WrapperPlayClientPlayerFlying(event);
if (profile.getPlayer().getWalkSpeed() != 0.2F
|| profile.isPrinter()
|| (profile.getCurrentTick() - profile.getAbilityProcessor().getBukkitFlyingTick()) < 15
|| !profile.isValidMotion()) {
return;
}
if (profile.getAbilityProcessor().getDepthStriderTimer().hasNotPassed(20)) {
if (profile.getCollisionProcessor().getLiquidTicks() > 0) {
return;
}
}
if (profile.getCollisionProcessor().getClimbableTicks() > 0) {
this.bufferValue -= this.bufferValue > 0 ? .3 : 0;
return;
}
final Motion realMotion = new Motion(
profile.getMovementProcessor().getDeltaX(),
0.0D,
profile.getMovementProcessor().getDeltaZ()
);
double attributeSpeed = profile.getPlayer().getWalkSpeed() / 2;
final BoundingBox boundingBox = new BoundingBox(
(float) wrapper.getLocation().getX() - 0.3F,
(float) wrapper.getLocation().getY(),
(float) wrapper.getLocation().getZ() - 0.3F,
(float) wrapper.getLocation().getX() + 0.3F,
(float) wrapper.getLocation().getY() + 1.8F,
(float) wrapper.getLocation().getZ() + 0.3F
);
final double minX = boundingBox.minX;
final double minZ = boundingBox.minZ;
final double maxX = boundingBox.maxX;
final double maxZ = boundingBox.maxZ;
if ((this.testCollision(minX) || this.testCollision(minZ)
|| this.testCollision(maxX) || this.testCollision(maxZ))) {
this.bufferValue -= this.bufferValue > 0 ? .25 : 0;
return;
}
if (profile.getAttributeProcessor().isHasSpeed()) {
attributeSpeed += profile.getAttributeProcessor().getSpeedLevel() * 0.2D * attributeSpeed;
}
if (profile.getAttributeProcessor().isHasSlow()) {
attributeSpeed += profile.getAttributeProcessor().getSlowLevel() * -.15D * attributeSpeed;
}
Motion predicted;
double smallest = Double.MAX_VALUE;
iteration:
{
// Yes this looks retarded but its brute forcing every possible thing.
for (int f = -1; f < 2; f++) {
for (int s = -1; s < 2; s++) {
for (int sp = 0; sp < 2; sp++) {
for (int jp = 0; jp < 2; jp++) {
for (int ui = 0; ui < 2; ui++) {
for (int hs = 0; hs < 2; hs++) {
for (int sn = 0; sn < 2; sn++) {
final boolean sprint = sp == 0;
final boolean jump = jp == 0;
final boolean using = ui == 0;
final boolean hitSlowdown = hs == 0;
final boolean ground = profile.getMovementProcessor().isLastGround(); //lastFlying.isGround()
final boolean sneaking = sn == 0;
float forward = f;
float strafe = s;
if (using) {
forward *= 0.2D;
strafe *= 0.2D;
}
if (sneaking) {
forward *= (float) 0.3D;
strafe *= (float) 0.3D;
}
forward *= 0.98F;
strafe *= 0.98F;
final Motion motion = new Motion(
profile.getMovementProcessor().getLastDeltaX(),
0.0D,
profile.getMovementProcessor().getLastDeltaZ()
);
if (lastLastGround) {
motion.getMotionX().multiply(0.6F * 0.91F);
motion.getMotionZ().multiply(0.6F * 0.91F);
} else {
motion.getMotionX().multiply(0.91F);
motion.getMotionZ().multiply(0.91F);
}
if (hitSlowdown) {
motion.getMotionX().multiply(0.6D);
motion.getMotionZ().multiply(0.6D);
}
motion.round(profile);
if (jump && sprint) {
final float radians = profile.getRotationProcessor().getYaw()
* 0.017453292F;
motion.getMotionX().subtract(MathHelper.sin(radians) * 0.2F);
motion.getMotionZ().add(MathHelper.cos(radians) * 0.2F);
}
float slipperiness = 0.91F;
if (ground) slipperiness = 0.6F * 0.91F;
float moveSpeed = (float) attributeSpeed;
if (sprint) moveSpeed += moveSpeed * 0.30000001192092896D;
final float moveFlyingFriction;
if (ground) {
final float moveSpeedMultiplier = 0.16277136F /
(slipperiness * slipperiness * slipperiness);
moveFlyingFriction = moveSpeed * moveSpeedMultiplier;
} else {
moveFlyingFriction = (float)
(sprint ? ((double) 0.02F + (double) 0.02F * 0.3D) : 0.02F);
}
motion.apply(this.moveFlying(profile,
forward, strafe,
moveFlyingFriction
));
motion.getMotionY().set(0.0);
final double distance = realMotion.distanceSquared(motion);
if (distance < smallest) {
smallest = distance;
predicted = motion;
if (distance < 1E-8) {
break iteration;
}
}
}
}
}
}
}
}
}
}
final double speed = profile.getMovementProcessor().getDeltaXZ();
if (profile.getCollisionProcessor().getSlimeTicks() > 0
|| profile.getCollisionProcessor().getBlockAboveTicks() > 0
|| profile.getCollisionProcessor().getIceTicks() > 0) {
return;
}
if (profile.getVelocityProcessor().isTakingVelocity()) {
buffer().remove(true, .05);
return;
}
if (smallest > 1E-6 && speed > .2) {
if (buffer().addAndGet() > 5) { //5
fail(
"S=" + smallest,
"M=" + speed,
"B=" + buffer().getRounded()
);
}
} else {
buffer().remove(true, .05); //.05
}
//was outside the if statement
lastLastGround = profile.getMovementProcessor().isLastGround();
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
MoveFlyingResult moveFlying(final Profile data, final float moveForward, final float moveStrafe, final float friction) {
float diagonal = moveStrafe * moveStrafe + moveForward * moveForward;
float moveFlyingFactorX = 0.0F;
float moveFlyingFactorZ = 0.0F;
if (diagonal >= 1.0E-4F) {
diagonal = MathHelper.c(diagonal);
if (diagonal < 1.0F) {
diagonal = 1.0F;
}
diagonal = friction / diagonal;
final float strafe = moveStrafe * diagonal;
final float forward = moveForward * diagonal;
final float rotationYaw = data.getRotationProcessor().getYaw();
final float f1 = MathHelper.sin(rotationYaw * (float) Math.PI / 180.0F);
final float f2 = MathHelper.cos(rotationYaw * (float) Math.PI / 180.0F);
final float factorX = strafe * f2 - forward * f1;
final float factorZ = forward * f2 + strafe * f1;
moveFlyingFactorX = factorX;
moveFlyingFactorZ = factorZ;
}
return new MoveFlyingResult(moveFlyingFactorX, moveFlyingFactorZ);
}
boolean testCollision(double value) {
return Math.abs(value % 0.015625D) < 1E-10;
}
}

View File

@ -0,0 +1,101 @@
package cc.edgesolutions.edge.check.impl.movement.speed;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Speed", type = "B", description = "Linear limit", releaseType = ReleaseType.EXPERIMENTAL)
public class SpeedB extends EdgeCheck {
private double limit;
private boolean lastLastGround;
public SpeedB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) return;
final boolean ground = profile.getMovementProcessor().isGround();
final boolean lastGround = profile.getMovementProcessor().isLastGround();
final double deltaXZ = profile.getMovementProcessor().getDeltaXZ();
if (!profile.isValidMotion()
|| profile.getPlayer().getWalkSpeed() != 0.2F //Temp fix
|| (profile.getCurrentTick() - profile.getAbilityProcessor().getBukkitFlyingTick()) < 15) {
return;
}
if (!lastGround) limit = 0.36001F;
if (profile.getMovementProcessor().getGroundTicks() > 12) {
limit = 0.32;
} else if (profile.getMovementProcessor().getGroundTicks() > 7) {
limit = 0.35;
}
if (ground && lastGround && !lastLastGround) limit = 0.42;
if (!ground && lastGround) limit = 0.613;
if (profile.getCollisionProcessor().getIceTicks() > 0
|| (profile.getCollisionProcessor().getPistonTicks() > 0
&& profile.getCollisionProcessor().getSlimeTicks() > 0)) {
limit = 1.2;
}
if (profile.getCollisionProcessor().getWallTicks() > 0
|| profile.getCollisionProcessor().getSlimeTicks() > 0) {
limit = 0.75;
}
if (profile.getCollisionProcessor().getLiquidTicks() > 0) {
limit = 1.0;
}
if (profile.getCollisionProcessor().getSlimeTicks() > 0
&& profile.getCollisionProcessor().getBlockAboveTicks() < 1) {
limit = 0.7;
}
//Account potions & speed here (Speed Potion Level * 0.072f [limit += level * 0.072f)
if (profile.getAttributeProcessor().isHasSpeed()) {
double speedAttribute = profile.getAttributeProcessor().getSpeedLevel();
limit += speedAttribute * 0.072f;
}
if (profile.getVelocityProcessor().getLastConfirmedVelocityData() != null) {
if (profile.getVelocityProcessor().isTakingVelocity()) {
limit += profile.getVelocityProcessor().getLastConfirmedVelocityData().getVelocitySpeed();
}
}
if (deltaXZ > limit) {
if (buffer().addAndGet() > 5) {
fail(
"S=" + deltaXZ,
"L=" + limit,
"G=" + (ground ? "Y" : "N"),
"LG=" + (ground ? "Y" : "N"),
"PPG=" + (ground ? "Y" : "N"),
"B=" + buffer().getRounded()
);
}
} else buffer().remove(true, .01);
lastLastGround = lastGround;
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,29 @@
package cc.edgesolutions.edge.check.impl.movement.speed;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Speed", type = "C", releaseType = ReleaseType.DEVELOPMENTAL, description = "Friction offset")
public class SpeedC extends EdgeCheck {
public SpeedC(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isFlyingType(event)) return;
//Do something
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,54 @@
package cc.edgesolutions.edge.check.impl.world.baritone;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.player.DiggingAction;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging;
import org.bukkit.entity.Player;
@Check(name = "Baritone", type = "A", releaseType = ReleaseType.RELEASE, description = "Rotations simular to automine")
public class BaritoneA extends EdgeCheck {
public BaritoneA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isBlockBreak(event)) {
return;
}
//Account cinematic here
WrapperPlayClientPlayerDigging wrapper = new WrapperPlayClientPlayerDigging(event);
if (wrapper.getAction() != DiggingAction.FINISHED_DIGGING
|| !profile.isValidRotation()
|| Math.abs(profile.getRotationProcessor().getPitch()) == 90F) {
return;
}
final float lastDeltaPitch = profile.getRotationProcessor().getLastDeltaPitch();
final float deltaPitch = profile.getRotationProcessor().getDeltaPitch();
final double diff = Math.abs(lastDeltaPitch - deltaPitch);
if (diff < 0.005 && diff > 0) {
fail(
"D=" + diff,
"P=" + deltaPitch,
"L=" + lastDeltaPitch
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,58 @@
package cc.edgesolutions.edge.check.impl.world.inventory;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Inventory", type = "A", description = "Invalid inventory actions")
public class InventoryA extends EdgeCheck {
private boolean attack;
public InventoryA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isUseEntity(event)) attack = true;
if (EdgePacket.isFlyingType(event)) attack = false;
// if (!EdgePacket.isWindowClick(event)) {
// return;
// }
//
// if (!profile.isInventory()) {
// fail(
// "T=Inv"
// );
// }
// if (attack) {
// fail(
// "T=Attack"
// );
// }
// if (profile.isSprinting()) {
// fail(
// "T=Sprint"
// );
// }
// if (profile.getMovementProcessor().getDeltaXZ() > .1 && profile.getMovementProcessor().isGround()) {
// if (profile.getVelocityProcessor().isTakingVelocity()
// || !profile.isValidMotion()
// || profile.getCollisionProcessor().getWebTicks() > 0) {
// return;
// }
// fail(
// "T=Motion"
// );
// }
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,76 @@
package cc.edgesolutions.edge.check.impl.world.scaffold;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@Check(name = "Scaffold", type = "A", releaseType = ReleaseType.RELEASE, description = "Invalid blockplace vector")
public class ScaffoldA extends EdgeCheck {
public ScaffoldA(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isBlockPlace(event)) {
return;
}
WrapperPlayClientPlayerBlockPlacement blockPlace = new WrapperPlayClientPlayerBlockPlacement(event);
if (blockPlace.getCursorPosition() == null || profile.isPrinter()) return;
final Vector blockVector = new Vector(
blockPlace.getCursorPosition().getX(),
blockPlace.getCursorPosition().getY(),
blockPlace.getCursorPosition().getZ()
);
final int face = blockPlace.getFace().getFaceValue();
final boolean validFace = face >= 0 && face <= 3;
final float yaw = profile.getRotationProcessor().getYaw();
Block block = profile.getBlockProcessor().getBlockAsync(
new Location(profile.getPlayer().getWorld(),
blockPlace.getBlockPosition().getX(),
blockPlace.getBlockPosition().getY(),
blockPlace.getBlockPosition().getZ())
.add(0, -1, 0)
);
if (block == null) {
return;
}
if (yaw > 0 && block.getType() == Material.AIR) {
if (validFace && blockVector.getX() == 0.5 && blockVector.getY() == 0.5 || blockVector.getZ() == 0.5 && blockVector.getY() == 0.5) {
fail(
"Y=" + yaw,
"F=" + face,
"V=" + blockVector,
"B=" + buffer().getRounded()
);
} else {
bufferValue = Math.min(0, 0.05);
}
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,49 @@
package cc.edgesolutions.edge.check.impl.world.scaffold;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement;
import org.bukkit.entity.Player;
@Check(name = "Scaffold", type = "B", releaseType = ReleaseType.RELEASE, description = "Invalid block face")
public class ScaffoldB extends EdgeCheck {
public ScaffoldB(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isBlockPlace(event)) {
return;
}
WrapperPlayClientPlayerBlockPlacement blockPlace = new WrapperPlayClientPlayerBlockPlacement(event);
double x = blockPlace.getBlockPosition().getX();
double y = blockPlace.getBlockPosition().getY();
double z = blockPlace.getBlockPosition().getZ();
int face = blockPlace.getFace().getFaceValue();
if (x != 0 || y != 0 || z != 0) return;
if (face != 255) {
fail(
"F=" + face,
"X=" + x,
"Y=" + y,
"Z=" + z
);
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,85 @@
package cc.edgesolutions.edge.check.impl.world.scaffold;
import cc.edgesolutions.edge.Edge;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import cc.edgesolutions.edge.utils.misc.Tuple;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement;
import io.github.retrooper.packetevents.util.SpigotConversionUtil;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@Check(name = "Scaffold", type = "C", releaseType = ReleaseType.RELEASE, description = "Invalid block")
public class ScaffoldC extends EdgeCheck {
public ScaffoldC(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (!EdgePacket.isBlockPlace(event)) {
return;
}
if (profile.isPrinter()) return;
WrapperPlayClientPlayerBlockPlacement wrapper = new WrapperPlayClientPlayerBlockPlacement(event);
// check if the place is invalid
if (!wrapper.getItemStack().isPresent() || !SpigotConversionUtil.toBukkitItemStack(wrapper.getItemStack().get()).getType().isBlock()) {
// is the server side item valid?
if (this.isCurrentItemValid()) {
// confirm the client has the correct item in hand
profile.getConnectionProcessor().queue(false, () -> {
// check once again if the item is valid when they send the transaction
if (!this.isCurrentItemValid()) return;
Tuple<String, String> itemNames = this.getItemNames(wrapper);
if (buffer().addAndGet() > 1) {
fail(
"P=" + itemNames.a(),
"S=" + itemNames.b(),
"B=" + buffer().getRounded()
);
}
});
} else {
buffer().remove(true, 1);
}
} else {
buffer().remove(true, .35);
}
}
private Tuple<String, String> getItemNames(WrapperPlayClientPlayerBlockPlacement wrapper) {
ItemStack realItem = Edge.getInstance().getInstanceManager().getInstance().getItemInHand(profile);
return new Tuple<>(wrapper != null && wrapper.getItemStack().isPresent()
&& wrapper.getItemStack().get().getType() != null ?
wrapper.getItemStack().get().getType().toString() : "NULL",
realItem != null && realItem.getType() != null ? realItem.getType().name() : "NULL");
}
private boolean isCurrentItemValid() {
ItemStack realItem = Edge.getInstance().getInstanceManager().getInstance().getItemInHand(profile);
return !(realItem == null || realItem.getType() == null || !realItem.getType().isBlock()
|| realItem.getType() == Material.AIR);
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,54 @@
package cc.edgesolutions.edge.check.impl.world.scaffold;
import cc.edgesolutions.edge.Edge;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement;
import org.bukkit.entity.Player;
@Check(name = "Scaffold", type = "D", releaseType = ReleaseType.DEVELOPMENTAL, description = "Post block place")
public class ScaffoldD extends EdgeCheck {
private long lastFlying;
private boolean sent;
public ScaffoldD(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isFlyingType(event)) {
lastFlying = System.currentTimeMillis();
}
if (!EdgePacket.isBlockPlace(event)) return;
WrapperPlayClientPlayerBlockPlacement wrapper = new WrapperPlayClientPlayerBlockPlacement(event);
if (!profile.isValidMotion()
|| profile.isPrinter()) {
return;
}
if (wrapper.getItemStack().isPresent() && Edge.getInstance().getInstanceManager().getInstance().getItemInHand(profile).getType().isBlock()) {
long diff = System.currentTimeMillis() - lastFlying;
if (diff < 5L && buffer().addAndGet() > 22) {
fail(
"D=" + diff,
"B=" + buffer().getRounded()
);
} else buffer().reset();
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,63 @@
package cc.edgesolutions.edge.check.impl.world.scaffold;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.annotations.Check;
import cc.edgesolutions.edge.check.utils.ReleaseType;
import cc.edgesolutions.edge.packet.EdgePacket;
import cc.edgesolutions.edge.profile.Profile;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import org.bukkit.entity.Player;
@Check(name = "Scaffold", type = "E", releaseType = ReleaseType.DEVELOPMENTAL, description = "Post block break")
public class ScaffoldE extends EdgeCheck {
private long lastFlying;
private boolean sent;
public ScaffoldE(Profile profile) {
super(profile);
}
@Override
public void handle(Player player, PacketReceiveEvent event, long receivedAt) {
if (EdgePacket.isFlyingType(event)) {
if (profile.isPrinter()) return;
final long now = System.currentTimeMillis();
final long delay = now - lastFlying;
if (sent) {
if (delay > 40L && delay < 100L) {
if (buffer().addAndGet() > 1) {
fail(
"T=BlockPlace",
"D=" + delay,
"LF=" + lastFlying,
"S=" + sent,
"N=" + now,
"B=" + buffer().getRounded()
);
}
} else {
buffer().remove(true, .125);
}
sent = false;
}
lastFlying = now;
} else if (EdgePacket.isBlockBreak(event)) {
final long delay = System.currentTimeMillis() - lastFlying;
if (delay < 10) {
sent = true;
}
}
}
@Override
public void handle(Player player, PacketSendEvent event, long receivedAt) {
}
}

View File

@ -0,0 +1,111 @@
package cc.edgesolutions.edge.check.utils;
import cc.edgesolutions.edge.check.EdgeCheck;
import cc.edgesolutions.edge.check.impl.combat.aim.*;
import cc.edgesolutions.edge.check.impl.combat.autoclicker.AutoClickerA;
import cc.edgesolutions.edge.check.impl.combat.autoclicker.AutoClickerB;
import cc.edgesolutions.edge.check.impl.combat.autoclicker.AutoClickerC;
import cc.edgesolutions.edge.check.impl.combat.autoclicker.AutoClickerD;
import cc.edgesolutions.edge.check.impl.combat.autoclicker.ml.MLAutoClickerG;
import cc.edgesolutions.edge.check.impl.combat.hitbox.HitBoxB;
import cc.edgesolutions.edge.check.impl.combat.hitbox.ReachA;
import cc.edgesolutions.edge.check.impl.combat.killaura.*;
import cc.edgesolutions.edge.check.impl.combat.velocity.VelocityA;
import cc.edgesolutions.edge.check.impl.combat.velocity.VelocityB;
import cc.edgesolutions.edge.check.impl.combat.velocity.VelocityC;
import cc.edgesolutions.edge.check.impl.miscellaneous.protocol.*;
import cc.edgesolutions.edge.check.impl.miscellaneous.timer.TimerA;
import cc.edgesolutions.edge.check.impl.movement.flight.FlightA;
import cc.edgesolutions.edge.check.impl.movement.flight.FlightB;
import cc.edgesolutions.edge.check.impl.movement.invalid.*;
import cc.edgesolutions.edge.check.impl.movement.jesus.JesusA;
import cc.edgesolutions.edge.check.impl.movement.jesus.JesusB;
import cc.edgesolutions.edge.check.impl.movement.speed.SpeedA;
import cc.edgesolutions.edge.check.impl.movement.speed.SpeedB;
import cc.edgesolutions.edge.check.impl.world.baritone.BaritoneA;
import cc.edgesolutions.edge.check.impl.world.inventory.InventoryA;
import cc.edgesolutions.edge.check.impl.world.scaffold.*;
public class CheckRegistry {
public static final Class<? extends EdgeCheck>[] CHECK_CLASSES = new Class[]{
// Machine Learning and Deep Learning Checks
MLAutoClickerG.class,
// Handcrafted Checks
KillAuraA.class,
KillAuraB.class,
KillAuraC.class,
KillAuraD.class,
KillAuraE.class,
KillAuraF.class,
KillAuraG.class,
AutoClickerA.class,
AutoClickerB.class,
AutoClickerC.class,
AutoClickerD.class,
AimA.class,
AimB.class,
AimC.class,
AimD.class,
AimE.class,
//AimF.class,
AimG.class,
AimH.class,
ReachA.class,
HitBoxB.class,
VelocityA.class,
VelocityB.class,
VelocityC.class,
FlightA.class,
FlightB.class,
SpeedA.class,
SpeedB.class,
InvalidA.class,
InvalidB.class,
InvalidC.class,
InvalidD.class,
InvalidE.class,
InvalidF.class,
InvalidG.class,
InvalidH.class,
JesusA.class,
JesusB.class,
BaritoneA.class,
ScaffoldA.class,
ScaffoldB.class,
ScaffoldC.class,
ScaffoldD.class,
ScaffoldE.class,
ProtocolA.class,
ProtocolB.class,
ProtocolC.class,
ProtocolD.class,
ProtocolE.class,
ProtocolF.class,
ProtocolG.class,
ProtocolH.class,
ProtocolI.class,
ProtocolJ.class,
ProtocolK.class,
ProtocolL.class,
ProtocolM.class,
ProtocolN.class,
ProtocolO.class,
TimerA.class,
InventoryA.class
};
}

View File

@ -0,0 +1,43 @@
package cc.edgesolutions.edge.check.utils;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum CheckType {
COMBAT(new DetectionType[]{
DetectionType.KILLAURA,
DetectionType.AIM,
DetectionType.REACH,
DetectionType.AUTOCLICKER
}),
MOVEMENT(new DetectionType[]{
DetectionType.FLIGHT,
DetectionType.SPEED,
DetectionType.SPRINT,
DetectionType.INVALID,
DetectionType.VELOCITY
}),
WORLD(new DetectionType[]{
DetectionType.SCAFFOLD,
DetectionType.NUKER,
DetectionType.INVENTORY
}),
MISCELLANEOUS(new DetectionType[]{
DetectionType.BAD_PACKETS,
DetectionType.TIMER
});
private final DetectionType[] detectionTypes;
}

View File

@ -0,0 +1,28 @@
package cc.edgesolutions.edge.check.utils;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum DetectionType {
REACH("Reach"),
AIM("Aim"),
KILLAURA("Kill Aura"),
AUTOCLICKER("Auto Clicker"),
VELOCITY("Velocity"),
NUKER("Nuker"),
FLIGHT("Flight"),
SPEED("Speed"),
INVALID("Invalid"),
INVENTORY("Inventory"),
SPRINT("Sprint"),
BAD_PACKETS("Bad Packets"),
TIMER("Timer"),
SCAFFOLD("Scaffold"),
CRASHER("Crasher");
private final String displayContext;
}

View File

@ -0,0 +1,13 @@
package cc.edgesolutions.edge.check.utils;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum ReleaseType {
RELEASE("&aStable"), EXPERIMENTAL("&eExperimental"), DEVELOPMENTAL("&CDevelopmental");
public final String name;
}

View File

@ -0,0 +1,67 @@
package cc.edgesolutions.edge.command;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.List;
public abstract class BaseCommand {
@Getter
private final String name;
@Getter
private final List<String> aliases;
@Getter
private final String permission;
@Getter
private final String description;
@Getter
@Setter
private CommandSenderType senderType = CommandSenderType.ALL;
public BaseCommand(String name, List<String> aliases, String permission, String description) {
this.name = name;
this.aliases = aliases;
this.permission = permission;
this.description = description;
}
public BaseCommand(String name) {
this(name, new ArrayList<>(), null, null);
}
public BaseCommand(String name, String permission) {
this(name, new ArrayList<>(), permission, null);
}
public abstract void handle(CommandSender sender, String label, String[] args);
public boolean hasAliases() {
return aliases.size() > 0;
}
public boolean requiresPermission() {
return permission != null;
}
public boolean hasDescription() {
return description != null;
}
public int countArguments(String usage) {
int required = 0;
for (int i = 0; i < usage.length(); i++) {
char c = usage.charAt(i);
if (Character.toString(c).equals("<")) {
required++;
}
}
return required;
}
}

View File

@ -0,0 +1,56 @@
package cc.edgesolutions.edge.command;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.BiConsumer;
@Getter
@RequiredArgsConstructor
public class CommandArgument {
private final String label;
private String description;
private final String usage;
private final BiConsumer<CommandSender, String[]> argumentConsumer;
private List<String> aliases = new ArrayList<>();
private String permission = null;
private CommandSenderType senderType = CommandSenderType.ALL;
public boolean hasAliases() {
return aliases.size() > 0;
}
public boolean requiresPermission() {
return permission != null;
}
public String getArgumentStrings() {
String[] split = usage.split(" ");
return split.length <= 1 ? "" : String.join(" ", Arrays.copyOfRange(split, 1, split.length));
}
public CommandArgument setSenderType(CommandSenderType senderType) {
this.senderType = senderType;
return this;
}
public CommandArgument setPermission(String permission) {
this.permission = permission;
return this;
}
public CommandArgument setAliases(List<String> aliases) {
this.aliases = aliases;
return this;
}
public CommandArgument setDescription(String description) {
this.description = description;
return this;
}
}

View File

@ -0,0 +1,40 @@
package cc.edgesolutions.edge.command;
import cc.edgesolutions.edge.Edge;
import lombok.SneakyThrows;
import org.bukkit.Bukkit;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.plugin.SimplePluginManager;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class CommandManager {
private final Map<String, BaseCommand> commandMap = new HashMap<>();
private final SimpleCommandMap simpleCommandMap = getBukkitCommandMap();
public void registerCommand(BaseCommand baseCommand) {
commandMap.put(baseCommand.getName(), baseCommand);
simpleCommandMap.register(Edge.getInstance().getEdgeConfig().getName().getValue(), new CommandProcessor(baseCommand));
}
public void registerCommand(BaseCommand... baseCommands) {
Arrays.stream(baseCommands).forEach(this::registerCommand);
}
@SneakyThrows
public SimpleCommandMap getBukkitCommandMap() {
SimplePluginManager simplePluginManager = (SimplePluginManager) Bukkit.getServer().getPluginManager();
Field field = simplePluginManager.getClass().getDeclaredField("commandMap");
field.setAccessible(true);
SimpleCommandMap simpleCommandMap = (SimpleCommandMap) field.get(simplePluginManager);
field.setAccessible(false);
return simpleCommandMap;
}
}

Some files were not shown because too many files have changed in this diff Show More