added files.

This commit is contained in:
nitrogenoliquido committed 2026-11-26 18:54:12 -05:00
commit 5f37b463a7
286 files changed
+153775

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
.gradle/
build/
out/
.idea/
*.iml
.classpath
.project
.settings/
Buzz-*.jar
TEST*.jar
+61
View File
@@ -0,0 +1,61 @@
<p align="center">
<img src="assets/ss.png" alt="Skid Solutions Banner" width="350" />
<br><br>
<a href="https://discord.gg/skidsolutions">
<img src="https://img.shields.io/badge/Discord-Skid%20Solutions-18181b?style=for-the-badge&logo=discord&logoColor=ffffff&labelColor=09090b" alt="Discord" />
</a>
<img src="assets/version.svg" alt="Version 1.0.8" />
<img src="https://img.shields.io/badge/Java-17-3f3f46?style=for-the-badge&logo=openjdk&logoColor=ffffff&labelColor=09090b" alt="Java 17" />
<img src="https://img.shields.io/badge/Gradle-8.14.3-52525b?style=for-the-badge&logo=gradle&logoColor=ffffff&labelColor=09090b" alt="Gradle 8.14.3" />
</p>
<p align="center">
<a href="https://discord.gg/skidsolutions">https://discord.gg/skidsolutions</a>
</p>
<p align="center">
<img src="assets/divider.svg" alt="" width="720" />
</p>
<p align="center">
<img src="assets/jak.jpg" alt="jak" height="150" />
<img src="assets/hack.jpg" alt="hack" height="150" />
<img src="assets/deobf2.png" alt="deobf2" height="150" />
<img src="assets/deobf.jpg" alt="deobf" height="150" />
</p>
<p align="center">
<sub>This is NOT a recreation nor a remake.</sub>
</p>
<p align="center">
<img src="assets/divider.svg" alt="" width="720" />
</p>
## How to build
### Prerequisites
- **Java Development Kit**: JDK 17 (the Gradle wrapper 8.14.3 does not run on newer JDKs)
### Building OpenBuzz
Run from this folder:
```powershell
$env:JAVA_HOME = "C:\Program Files\Java\jdk-17"
.\gradlew.bat clean prepareIde build
```
Generated `build/libs/`:
- `OpenBuzz-1.0.8-java17.jar`
- `OpenBuzz-1.0.8-plain.jar`
- `OpenBuzz-1.0.8-sources.jar`
### Usage
Place `build/libs/OpenBuzz-1.0.8-java17.jar` alongside **ProtocolLib** in your Spigot `1.8.8` server's `plugins/` directory.
## Credits
- **Lucky, Simon, Stellar** - Original authors of Buzz 1.0.8.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

+26
View File
@@ -0,0 +1,26 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 820 20" width="820" height="20" role="img" aria-hidden="true">
<defs>
<linearGradient id="baseLine" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#000000" stop-opacity="0" />
<stop offset="25%" stop-color="#404040" stop-opacity="0.7" />
<stop offset="50%" stop-color="#d4d4d4" stop-opacity="0.95" />
<stop offset="75%" stop-color="#404040" stop-opacity="0.7" />
<stop offset="100%" stop-color="#000000" stop-opacity="0" />
</linearGradient>
<linearGradient id="pulse" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#ffffff" stop-opacity="0" />
<stop offset="50%" stop-color="#ffffff" stop-opacity="1" />
<stop offset="100%" stop-color="#ffffff" stop-opacity="0" />
</linearGradient>
<clipPath id="lineClip">
<rect x="40" y="8" width="740" height="4" rx="2" />
</clipPath>
</defs>
<rect x="40" y="9.25" width="740" height="1.5" rx="0.75" fill="url(#baseLine)" />
<g clip-path="url(#lineClip)">
<rect x="-120" y="8.5" width="140" height="3" rx="1.5" fill="url(#pulse)">
<animate attributeName="x" values="-120;820" dur="3.4s" repeatCount="indefinite" />
</rect>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="137" height="28" role="img" aria-label="VERSION: 1.0.8"><title>VERSION: 1.0.8</title><g shape-rendering="crispEdges"><rect width="78.75" height="28" fill="#09090b"/><rect x="78.75" width="58.25" height="28" fill="#27272a"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="100"><text transform="scale(.1)" x="393.75" y="175" textLength="547.5">VERSION</text><text transform="scale(.1)" x="1078.75" y="175" textLength="342.5" font-weight="bold">1.0.8</text></g></svg>

After

Width:  |  Height:  |  Size: 602 B

+122
View File
@@ -0,0 +1,122 @@
plugins {
id 'java'
id 'idea'
id 'eclipse'
id 'com.gradleup.shadow' version '8.3.8'
}
group = 'org.stellardev.anticheat'
version = '1.0.8'
def javaVersion = 17
repositories {
mavenCentral()
maven { url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/') }
}
configurations {
apiGenerator
}
def generatorClasses = layout.buildDirectory.dir('api-generator/classes')
tasks.register('compileApiGenerator', JavaCompile) {
source = files('gradle/GenerateCompileApis.java')
classpath = configurations.apiGenerator
destinationDirectory = generatorClasses
javaCompiler = javaToolchains.compilerFor { languageVersion = JavaLanguageVersion.of(javaVersion) }
options.release = javaVersion
options.encoding = 'UTF-8'
}
tasks.register('generateCompileApis', JavaExec) {
group = 'build setup'
description = 'Generates compile-only API headers from text declarations.'
dependsOn tasks.named('compileApiGenerator')
inputs.dir('gradle/api-signatures')
outputs.dir(layout.buildDirectory.dir('compile-apis'))
classpath = files(generatorClasses) + configurations.apiGenerator
javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(javaVersion) }
mainClass = 'GenerateCompileApis'
maxHeapSize = '2g'
args file('gradle/api-signatures').absolutePath, layout.buildDirectory.dir('compile-apis').get().asFile.absolutePath
}
def compileApi = { String name ->
files(layout.buildDirectory.file("compile-apis/${name}.jar")).builtBy(tasks.named('generateCompileApis'))
}
tasks.register('prepareIde') {
group = 'ide'
description = 'Generates the compile-only API headers used by the IDE import.'
dependsOn tasks.named('generateCompileApis')
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(javaVersion)
withSourcesJar()
}
dependencies {
apiGenerator 'org.ow2.asm:asm:9.8'
apiGenerator 'com.google.code.gson:gson:2.10.1'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'commons-codec:commons-codec:1.15'
compileOnly compileApi('buzz')
compileOnly 'com.google.guava:guava:21.0'
compileOnly 'io.netty:netty-all:4.1.25.Final'
compileOnly 'commons-lang:commons-lang:2.6'
compileOnly 'net.md-5:bungeecord-chat:1.16-R0.4'
compileOnly 'com.google.code.gson:gson:2.8.9'
compileOnly 'org.yaml:snakeyaml:1.27'
}
tasks.withType(JavaCompile).configureEach {
if (name != 'compileApiGenerator') {
dependsOn tasks.named('generateCompileApis')
}
options.release = javaVersion
options.encoding = 'UTF-8'
options.compilerArgs += ['-parameters', '-Xmaxerrs', '1500']
options.debug = true
options.debugOptions.debugLevel = 'source,lines,vars'
}
tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
filePermissions { unix('0644') }
dirPermissions { unix('0755') }
}
jar {
archiveClassifier = 'plain'
manifest.attributes('Implementation-Title': 'Buzz', 'Implementation-Version': project.version)
}
shadowJar {
archiveClassifier = 'java17'
relocate 'org.apache.commons.math3', 'org.stellardev.anticheat.lib.math3'
relocate 'org.apache.commons.codec', 'org.stellardev.anticheat.lib.codec'
minimize()
mergeServiceFiles()
exclude 'META-INF/*.SF', 'META-INF/*.RSA', 'META-INF/*.DSA'
exclude 'META-INF/INDEX.LIST', 'META-INF/maven/**'
exclude 'META-INF/LICENSE', 'META-INF/LICENSE.txt', 'META-INF/NOTICE', 'META-INF/NOTICE.txt'
manifest.attributes('Implementation-Title': 'Buzz', 'Implementation-Version': project.version)
}
assemble.dependsOn shadowJar
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
eclipse {
classpath {
downloadSources = true
downloadJavadoc = true
}
}
+3
View File
@@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8
org.gradle.workers.max=2
org.gradle.parallel=false
+66
View File
@@ -0,0 +1,66 @@
import com.google.gson.*;
import org.objectweb.asm.*;
import java.io.*;
import java.nio.file.*;
import java.util.*;
import java.util.jar.*;
public final class GenerateCompileApis implements Opcodes {
static String text(JsonObject o,String k){return o.has(k)&&!o.get(k).isJsonNull()?o.get(k).getAsString():null;}
static int number(JsonObject o,String k){return o.get(k).getAsInt();}
static JsonArray array(JsonObject o,String k){return o.has(k)?o.getAsJsonArray(k):new JsonArray();}
static String[] strings(JsonObject o,String k){List<String> r=new ArrayList<>();for(JsonElement e:array(o,k))r.add(e.getAsString());return r.toArray(new String[0]);}
static Object scalar(JsonObject o){String v=text(o,"value");return switch(text(o,"type")){
case "Long"->Long.valueOf(v);case "Integer"->Integer.valueOf(v);case "Float"->Float.valueOf(v);case "Double"->Double.valueOf(v);case "Byte"->Byte.valueOf(v);case "Short"->Short.valueOf(v);case "Character"->v.charAt(0);default->throw new IllegalArgumentException(o.toString());};}
static Object constant(JsonElement e){if(e==null||e.isJsonNull())return null;if(e.isJsonObject())return scalar(e.getAsJsonObject());return e.getAsString();}
static void annotationValue(AnnotationVisitor visitor,String name,JsonElement value){
if(value.isJsonArray()){AnnotationVisitor nested=visitor.visitArray(name);for(JsonElement e:value.getAsJsonArray())annotationValue(nested,null,e);nested.visitEnd();}
else if(value.isJsonObject()){JsonObject o=value.getAsJsonObject();switch(text(o,"kind")){
case "scalar"->visitor.visit(name,scalar(o));case "type"->visitor.visit(name,Type.getType(text(o,"descriptor")));
case "enum"->visitor.visitEnum(name,text(o,"descriptor"),text(o,"name"));
case "annotation"->{JsonObject a=o.getAsJsonObject("annotation");writeAnnotation(visitor.visitAnnotation(name,text(a,"descriptor")),a);}
default->throw new IllegalArgumentException(o.toString());}}
else if(value.getAsJsonPrimitive().isBoolean())visitor.visit(name,value.getAsBoolean());
else visitor.visit(name,value.getAsString());
}
static void writeAnnotation(AnnotationVisitor visitor,JsonObject annotation){if(visitor==null)return;for(var e:annotation.getAsJsonObject("values").entrySet())annotationValue(visitor,e.getKey(),e.getValue());visitor.visitEnd();}
interface Factory {AnnotationVisitor create(JsonObject annotation);}
static void annotations(JsonObject o,String key,Factory factory){for(JsonElement a:array(o,key)){JsonObject obj=a.getAsJsonObject();writeAnnotation(factory.create(obj),obj);}}
static TypePath path(JsonObject o){return TypePath.fromString(text(o,"typePath"));}
static byte[] compile(JsonObject c){
ClassWriter cw=new ClassWriter(0);cw.visit(number(c,"version"),number(c,"access"),text(c,"name"),text(c,"signature"),text(c,"superName"),strings(c,"interfaces"));
if(c.has("outerClass"))cw.visitOuterClass(text(c,"outerClass"),text(c,"outerMethod"),text(c,"outerMethodDescriptor"));
if(c.has("nestHostClass"))cw.visitNestHost(text(c,"nestHostClass"));
for(String n:strings(c,"nestMembers"))cw.visitNestMember(n);for(String n:strings(c,"permittedSubclasses"))cw.visitPermittedSubclass(n);
annotations(c,"annotations",a->cw.visitAnnotation(text(a,"descriptor"),a.get("visible").getAsBoolean()));
annotations(c,"typeAnnotations",a->cw.visitTypeAnnotation(number(a,"typeRef"),path(a),text(a,"descriptor"),a.get("visible").getAsBoolean()));
for(JsonElement el:array(c,"innerClasses")){var n=el.getAsJsonObject();cw.visitInnerClass(text(n,"name"),text(n,"outerName"),text(n,"innerName"),number(n,"access"));}
for(JsonElement el:array(c,"recordComponents")){var r=el.getAsJsonObject();var rv=cw.visitRecordComponent(text(r,"name"),text(r,"descriptor"),text(r,"signature"));annotations(r,"annotations",a->rv.visitAnnotation(text(a,"descriptor"),a.get("visible").getAsBoolean()));annotations(r,"typeAnnotations",a->rv.visitTypeAnnotation(number(a,"typeRef"),path(a),text(a,"descriptor"),a.get("visible").getAsBoolean()));rv.visitEnd();}
for(JsonElement el:array(c,"fields")){var f=el.getAsJsonObject();var fv=cw.visitField(number(f,"access"),text(f,"name"),text(f,"descriptor"),text(f,"signature"),constant(f.get("constant")));annotations(f,"annotations",a->fv.visitAnnotation(text(a,"descriptor"),a.get("visible").getAsBoolean()));annotations(f,"typeAnnotations",a->fv.visitTypeAnnotation(number(a,"typeRef"),path(a),text(a,"descriptor"),a.get("visible").getAsBoolean()));fv.visitEnd();}
for(JsonElement el:array(c,"methods")){var m=el.getAsJsonObject();int access=number(m,"access");String descriptor=text(m,"descriptor");var mv=cw.visitMethod(access,text(m,"name"),descriptor,text(m,"signature"),strings(m,"exceptions"));
for(JsonElement pe:array(m,"parameters")){var p=pe.getAsJsonObject();mv.visitParameter(text(p,"name"),number(p,"access"));}
annotations(m,"annotations",a->mv.visitAnnotation(text(a,"descriptor"),a.get("visible").getAsBoolean()));annotations(m,"typeAnnotations",a->mv.visitTypeAnnotation(number(a,"typeRef"),path(a),text(a,"descriptor"),a.get("visible").getAsBoolean()));
annotations(m,"parameterAnnotations",a->mv.visitParameterAnnotation(number(a,"parameter"),text(a,"descriptor"),a.get("visible").getAsBoolean()));
if(m.has("annotationDefault")){var av=mv.visitAnnotationDefault();annotationValue(av,null,m.get("annotationDefault"));av.visitEnd();}
if((access&(ACC_ABSTRACT|ACC_NATIVE))==0){mv.visitCode();mv.visitTypeInsn(NEW,"java/lang/UnsupportedOperationException");mv.visitInsn(DUP);mv.visitLdcInsn("Compile-only API header; use the real server or library at runtime");mv.visitMethodInsn(INVOKESPECIAL,"java/lang/UnsupportedOperationException","<init>","(Ljava/lang/String;)V",false);mv.visitInsn(ATHROW);int locals=(access&ACC_STATIC)==0?1:0;for(Type t:Type.getArgumentTypes(descriptor))locals+=t.getSize();mv.visitMaxs(3,locals);}
mv.visitEnd();}
cw.visitEnd();return cw.toByteArray();
}
static SortedMap<String,JsonObject> declarations(Path input,Path schema,Set<Path> active)throws Exception {
if(!active.add(schema))throw new IllegalArgumentException("Cyclic API declaration inheritance: "+schema);
JsonObject data;try(Reader r=Files.newBufferedReader(schema)){data=JsonParser.parseReader(r).getAsJsonObject();}
SortedMap<String,JsonObject> classes=new TreeMap<>();
if(data.has("base"))classes.putAll(declarations(input,input.resolve(text(data,"base")+".json"),active));
for(JsonElement entry:array(data,"classes")){JsonObject c=entry.getAsJsonObject();classes.put(text(c,"name"),c);}
active.remove(schema);return classes;
}
public static void main(String[] args)throws Exception{
Path input=Path.of(args[0]),output=Path.of(args[1]);Files.createDirectories(output);
for(Path schema:Files.list(input).filter(p->p.toString().endsWith(".json")).sorted().toList()){
SortedMap<String,JsonObject> classes=declarations(input,schema,new HashSet<>());
String name=schema.getFileName().toString().replace(".json",".jar");Path jar=output.resolve(name);
try(var out=new JarOutputStream(Files.newOutputStream(jar))){for(JsonObject c:classes.values()){var entry=new JarEntry(text(c,"name")+".class");entry.setTime(0);out.putNextEntry(entry);out.write(compile(c));out.closeEntry();}}
System.out.println("Generated compile API "+name+" ("+classes.size()+" declarations)");
}
}
}
File diff suppressed because it is too large. Load diff
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
Vendored
+251
View File
@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+94
View File
@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+1
View File
@@ -0,0 +1 @@
rootProject.name = 'OpenBuzz'
@@ -0,0 +1,435 @@
package org.stellardev.anticheat;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.utility.MinecraftVersion;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.stellardev.anticheat.check.Check;
import org.stellardev.anticheat.check.CheckManager;
import org.stellardev.anticheat.check.PunishType;
import org.stellardev.anticheat.command.CommandManager;
import org.stellardev.anticheat.config.ConfigFile;
import org.stellardev.anticheat.config.ConfigManager;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.gui.GuiListener;
import org.stellardev.anticheat.listener.BukkitEventListener;
import org.stellardev.anticheat.listener.ClientPacketListener;
import org.stellardev.anticheat.listener.ServerPacketListener;
import org.stellardev.anticheat.manager.AlertManager;
import org.stellardev.anticheat.manager.ClientBrandManager;
import org.stellardev.anticheat.manager.GuiManager;
import org.stellardev.anticheat.manager.LibraryManager;
import org.stellardev.anticheat.manager.PlayerDataManager;
import org.stellardev.anticheat.nms.NmsHandler;
import org.stellardev.anticheat.nms.impl.NmsHandler_v1_8_R3;
import org.stellardev.anticheat.packet.PacketWrapperManager;
import org.stellardev.anticheat.packet.tracker.PacketTrackerManager;
import org.stellardev.anticheat.util.TransactionDebugger;
import org.stellardev.anticheat.util.math.FastMath;
import org.stellardev.anticheat.util.math.MathUtil;
public class AntiCheat extends JavaPlugin implements MathUtil {
private static AntiCheat instance;
private final String version = "1.0.8";
private PacketTrackerManager packetTrackerManager;
private PlayerDataManager playerDataManager;
private AlertManager alertManager;
private CommandManager commandManager;
private PacketWrapperManager packetWrapperManager;
private ClientBrandManager clientBrandManager;
private ConfigManager configManager;
private CheckManager checkManager;
private LibraryManager libraryManager;
private GuiManager guiManager;
private ServerPacketListener serverPacketListener;
private ClientPacketListener clientPacketListener;
private ServerVersion serverVersion;
private MinecraftVersion minecraftVersion;
private boolean legacy17;
private final long lagWarnTicks = 200L;
private final long tpsTickInterval = 40L;
private long lastTickNanos = System.currentTimeMillis();
private long totalTicks;
private long lastLagAlertNanos;
private long lastLagSpikeNanos;
private double tps = 20.0;
private final List<Double> tpsSamples = new ArrayList<>(20);
private boolean initialized = false;
private boolean viaVersionEnabled;
private boolean protocolSupportEnabled;
private NmsHandler nmsHandler;
@Override
public void onEnable() {
instance = this;
ConsoleCommandSender console = instance.getServer().getConsoleSender();
long startTime = System.currentTimeMillis();
this.initNmsHandler();
this.minecraftVersion = ProtocolLibrary.getProtocolManager().getMinecraftVersion();
this.serverVersion = this.detectServerVersion();
if (this.serverVersion == ServerVersion.v1_7_R4) {
console.sendMessage(" ");
console.sendMessage(" Buzz Anticheat:");
console.sendMessage(" ");
console.sendMessage(" 1.7 based servers are currently in beta. Issues");
console.sendMessage(" may occur. Open a ticket for support or if you");
console.sendMessage(" encounter any errors.");
console.sendMessage(" ");
}
this.legacy17 = ProtocolLibrary.getProtocolManager().getMinecraftVersion().getVersion().equals("1.7.10") || this.serverVersion == ServerVersion.v1_7_R4;
try {
String protocolLibVersion = Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
if (this.legacy17) {
if (!protocolLibVersion.equalsIgnoreCase("3.7.0-BETA")) {
console.sendMessage(" ");
console.sendMessage(" ProtocolLib Version Alert:");
console.sendMessage(" ");
console.sendMessage(" Buzz recommends to use ProtocolLib 3.7.0-BETA on 1.7 servers.");
console.sendMessage(" You are currently using " + protocolLibVersion);
console.sendMessage(" Different versions may cause issues.");
console.sendMessage(" ");
}
} else {
int versionNumber = Integer.parseInt(protocolLibVersion.split("-")[0].replace(".", ""));
if (versionNumber < 460) {
console.sendMessage(" ");
console.sendMessage(" ProtocolLib Version Alert:");
console.sendMessage(" ");
console.sendMessage(" Buzz recommends to use at least ProtocolLib 4.6.0 on 1.8 or above servers.");
console.sendMessage(" You are currently using " + protocolLibVersion);
console.sendMessage(" Older versions may cause issues.");
console.sendMessage(" ");
}
}
} catch (Exception ignored) {
}
if (!instance.getDataFolder().exists()) {
instance.getDataFolder().mkdir();
}
this.initManagers();
this.registerPacketListeners();
this.registerBukkitListeners();
this.startTickTask();
FastMath.init();
if ((Boolean)this.configManager.getCheckSettings().getPrinterMode().getValue()) {
System.out.println("Printer mode enabled, some blatant cheats might not get picked up as easily.");
}
if (!(Boolean)this.configManager.getCheckSettings().getMoveSetback().getValue()) {
System.out.println("Setbacks disabled, this will make the anticheat vulnerable to ghost blocks and fly exploits.");
}
this.initialized = true;
if (Bukkit.getPluginManager().isPluginEnabled("ViaVersion")) {
try {
Class.forName("us.myles.ViaVersion.api.Via");
this.viaVersionEnabled = true;
} catch (ClassNotFoundException ignored) {
}
} else if (Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport")) {
this.protocolSupportEnabled = true;
}
}
public String getNmsPackageVersion() {
String packageName = Bukkit.getServer().getClass().getPackage().getName();
return packageName.substring(packageName.lastIndexOf(46) + 1);
}
public ServerVersion detectServerVersion() {
String version = this.getNmsPackageVersion();
if (version.startsWith("v1.7")) {
return ServerVersion.v1_7_R4;
} else if (version.startsWith("v1.8")) {
return ServerVersion.v1_8_R3;
} else if (version.startsWith("v1.11")) {
return ServerVersion.v1_11_R1;
} else if (version.startsWith("v1.12")) {
return ServerVersion.v1_12_R1;
} else if (version.startsWith("v1.13")) {
return ServerVersion.v1_13_R1;
} else if (version.startsWith("v1.14")) {
return ServerVersion.v1_14_R1;
} else if (version.startsWith("v1.15")) {
return ServerVersion.v1_15_R2;
} else {
return version.startsWith("v1.16") ? ServerVersion.v1_16_R1 : ServerVersion.valueOf(Bukkit.getServer().getClass().getName().split("\\.")[3]);
}
}
private void initManagers() {
this.libraryManager = new LibraryManager();
this.configManager = new ConfigManager();
this.packetTrackerManager = new PacketTrackerManager();
this.playerDataManager = new PlayerDataManager();
this.alertManager = new AlertManager();
this.commandManager = new CommandManager();
this.packetWrapperManager = new PacketWrapperManager();
this.clientBrandManager = new ClientBrandManager();
this.checkManager = new CheckManager();
this.configManager.getChecks().load();
this.configManager.getChecks().save();
this.guiManager = new GuiManager();
}
public void reloadConfigs() {
this.configManager = new ConfigManager();
this.configManager.getChecks().load();
this.configManager.getChecks().save();
this.getPlayerDataManager()
.getAllPlayerData()
.forEach(data -> data.getCheckHolder().getAllChecks().forEach(check -> check.setSettings(this.configManager.getCheckSettings())));
for (Check check : this.getCheckManager().getGlobalCheckHolder().getAllChecks()) {
((Check)this.getCheckManager().getGlobalCheckHolder().getCheck(check.getClass()))
.setEnabled(this.configManager.getChecks().getBoolean(check.getIdentifier() + ".enabled", check.isEnabled()));
((Check)this.getCheckManager().getGlobalCheckHolder().getCheck(check.getClass()))
.setMaxVl(this.configManager.getChecks().getInt(check.getIdentifier() + ".punish-vl", check.getMaxVl()));
((Check)this.getCheckManager().getGlobalCheckHolder().getCheck(check.getClass()))
.setPunishable(this.configManager.getChecks().getBoolean(check.getIdentifier() + ".punish", check.isPunishable()));
((Check)this.getCheckManager().getGlobalCheckHolder().getCheck(check.getClass()))
.setPunishType(PunishType.valueOf(this.configManager.getChecks().getString(check.getIdentifier() + ".punish-type", check.getPunishType().name())));
}
for (PlayerData data : getInstance().getPlayerDataManager().getAllPlayerData()) {
for (Check check : data.getCheckHolder().getAllChecks()) {
check.setEnabled(this.configManager.getChecks().getBoolean(check.getIdentifier() + ".enabled", check.isEnabled()));
check.setMaxVl(this.configManager.getChecks().getInt(check.getIdentifier() + ".punish-vl", check.getMaxVl()));
check.setPunishable(this.configManager.getChecks().getBoolean(check.getIdentifier() + ".punish", check.isPunishable()));
check.setPunishType(
PunishType.valueOf(this.configManager.getChecks().getString(check.getIdentifier() + ".punish-type", check.getPunishType().name()))
);
}
}
this.guiManager = new GuiManager();
this.commandManager = new CommandManager();
}
public void reloadGui() {
this.guiManager = new GuiManager();
}
private void registerPacketListeners() {
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
this.serverPacketListener = new ServerPacketListener();
this.clientPacketListener = new ClientPacketListener();
Stream.of(this.serverPacketListener, this.clientPacketListener).forEach(protocolManager::addPacketListener);
}
private void startTickTask() {
Bukkit.getScheduler()
.scheduleSyncRepeatingTask(
instance,
() -> {
this.totalTicks++;
long now = System.nanoTime();
double deltaMillis = (now - this.lastTickNanos) / 1000000.0;
if (deltaMillis < 10.0 || deltaMillis > 250.0) {
this.lastLagSpikeNanos = now;
if (now - this.lastLagAlertNanos > 10000000000L && this.totalTicks > 200L) {
ConsoleCommandSender console = instance.getServer().getConsoleSender();
String prefix = ChatColor.RED + "[Buzz]";
console.sendMessage(prefix + ChatColor.AQUA + "");
console.sendMessage(
prefix + ChatColor.DARK_AQUA + " Developer debug: " + String.format("TPS: %.2f D: %.2f T: %d", this.tps, deltaMillis, this.totalTicks)
);
this.lastLagAlertNanos = now;
}
}
if (this.totalTicks > 100L) {
double instantTps = 1000.0 / deltaMillis;
this.tpsSamples.add(instantTps);
if (this.tpsSamples.size() >= 20) {
double average = this.getAverage(this.tpsSamples);
double stdDev = this.getStandardDeviation(this.tpsSamples);
this.tps = average;
this.tpsSamples.clear();
}
}
this.playerDataManager.getAllPlayerData().forEach(PlayerData::tick);
this.lastTickNanos = now;
},
1L,
1L
);
}
private void registerBukkitListeners() {
Arrays.asList(new BukkitEventListener(), new GuiListener()).forEach(listener -> instance.getServer().getPluginManager().registerEvents(listener, instance));
}
public void shutdown() {
if (this.initialized) {
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
Stream.of(this.serverPacketListener, this.clientPacketListener).forEach(protocolManager::removePacketListener);
this.configManager.getConfigs().forEach(ConfigFile::save);
}
}
public boolean isServerLagging() {
long now = System.nanoTime();
return now - this.lastLagSpikeNanos < 250000000L || now - this.lastTickNanos > 250000000L;
}
public static AntiCheat getInstance() {
return instance;
}
public AntiCheat getPlugin() {
return instance;
}
public NmsHandler getNmsHandler() {
return this.nmsHandler;
}
private void initNmsHandler() {
TransactionDebugger.init(instance);
String nmsVersion = "";
try {
nmsVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
switch (nmsVersion) {
case "v1_8_R3":
this.nmsHandler = new NmsHandler_v1_8_R3();
case "v1_7_R4":
return;
default:
throw new ClassNotFoundException();
}
} catch (ClassNotFoundException | ClassCastException e) {
throw new RuntimeException("Your server version " + nmsVersion + " isn't supported! Please report this!");
}
}
public String getVersion() {
return "1.0.8";
}
public PacketTrackerManager getPacketTrackerManager() {
return this.packetTrackerManager;
}
public PlayerDataManager getPlayerDataManager() {
return this.playerDataManager;
}
public AlertManager getAlertManager() {
return this.alertManager;
}
public CommandManager getCommandManager() {
return this.commandManager;
}
public PacketWrapperManager getPacketWrapperManager() {
return this.packetWrapperManager;
}
public ClientBrandManager getClientBrandManager() {
return this.clientBrandManager;
}
public ConfigManager getConfigManager() {
return this.configManager;
}
public CheckManager getCheckManager() {
return this.checkManager;
}
public LibraryManager getLibraryManager() {
return this.libraryManager;
}
public GuiManager getGuiManager() {
return this.guiManager;
}
public ServerPacketListener getServerPacketListener() {
return this.serverPacketListener;
}
public ClientPacketListener getClientPacketListener() {
return this.clientPacketListener;
}
public ServerVersion getServerVersion() {
return this.serverVersion;
}
public MinecraftVersion getMinecraftVersion() {
return this.minecraftVersion;
}
public boolean isLegacy17() {
return this.legacy17;
}
public long getLagWarnTicks() {
return 200L;
}
public long getTpsTickInterval() {
return 40L;
}
public long getLastTickNanos() {
return this.lastTickNanos;
}
public long getTotalTicks() {
return this.totalTicks;
}
public long getLastLagAlertNanos() {
return this.lastLagAlertNanos;
}
public long getLastLagSpikeNanos() {
return this.lastLagSpikeNanos;
}
public double getTps() {
return this.tps;
}
public List<Double> getTpsSamples() {
return this.tpsSamples;
}
public boolean isInitialized() {
return this.initialized;
}
public boolean isViaVersionEnabled() {
return this.viaVersionEnabled;
}
public boolean isProtocolSupportEnabled() {
return this.protocolSupportEnabled;
}
public void setConfigManager(ConfigManager configManager) {
this.configManager = configManager;
}
public void setCheckManager(CheckManager checkManager) {
this.checkManager = checkManager;
}
}
@@ -0,0 +1,43 @@
package org.stellardev.anticheat;
public enum ClientVersion {
v1_7_5("1.7.5"),
v1_7_10("1.7.10"),
v1_8("1.8.X"),
v1_9("1.9.X"),
v1_10("1.10.X"),
v1_11("1.11.X"),
v1_12("1.12.X"),
v1_13("1.13.X"),
v1_14("1.14.X"),
v1_15("1.15.X"),
v1_16("1.16.X"),
v1_17("1.17.X"),
UNKNOWN("Unknown");
private final String displayName;
public boolean isBelow(ClientVersion other) {
return this.ordinal() < other.ordinal();
}
public boolean isBelowOrEqual(ClientVersion other) {
return this.ordinal() <= other.ordinal();
}
public boolean isAbove(ClientVersion other) {
return this.ordinal() > other.ordinal();
}
public boolean isAboveOrEqual(ClientVersion other) {
return this.ordinal() >= other.ordinal();
}
ClientVersion(String displayName) {
this.displayName = displayName;
}
public String getDisplayName() {
return this.displayName;
}
}
@@ -0,0 +1,28 @@
package org.stellardev.anticheat;
public enum ServerVersion {
v1_7_R4,
v1_8_R3,
v1_11_R1,
v1_12_R1,
v1_13_R1,
v1_14_R1,
v1_15_R2,
v1_16_R1;
public boolean isBelow(ServerVersion other) {
return this.ordinal() < other.ordinal();
}
public boolean isBelowOrEqual(ServerVersion other) {
return this.ordinal() <= other.ordinal();
}
public boolean isAbove(ServerVersion other) {
return this.ordinal() > other.ordinal();
}
public boolean isAboveOrEqual(ServerVersion other) {
return this.ordinal() >= other.ordinal();
}
}
@@ -0,0 +1,391 @@
package org.stellardev.anticheat.check;
import org.stellardev.anticheat.AntiCheat;
import org.stellardev.anticheat.ServerVersion;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.check.type.DualAutoClickerCheck;
import org.stellardev.anticheat.config.impl.CheckSettingsConfig;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.data.tracker.ActionTracker;
import org.stellardev.anticheat.data.tracker.AttributeTracker;
import org.stellardev.anticheat.data.tracker.ConnectionTracker;
import org.stellardev.anticheat.data.tracker.EntityTracker;
import org.stellardev.anticheat.data.tracker.MovementTracker;
import org.stellardev.anticheat.manager.AlertManager;
import org.stellardev.anticheat.util.math.MathUtil;
public abstract class Check<T> implements MathUtil {
protected final AntiCheat plugin = AntiCheat.getInstance();
protected final ServerVersion serverVersion = this.plugin.getServerVersion();
protected PlayerData data;
protected ConnectionTracker connectionTracker;
protected MovementTracker movementTracker;
protected ActionTracker actionTracker;
protected AttributeTracker attributeTracker;
protected EntityTracker entityTracker;
protected CheckSettingsConfig settings = this.plugin.getConfigManager().getCheckSettings();
protected final int categoryId;
private String fullName;
private CheckType type;
private String subType;
protected boolean enabled;
protected boolean punishable;
protected int maxVl;
protected PunishType punishType;
protected CheckState state;
protected double baseBuffer;
protected double vl;
protected double buffer;
private int debugCount;
private String identifier;
public Check(PlayerData data, int categoryId) {
if (data != null) {
this.data = data;
this.connectionTracker = data.getConnectionTracker();
this.movementTracker = data.getMovementTracker();
this.actionTracker = data.getActionTracker();
this.attributeTracker = data.getAttributeTracker();
this.entityTracker = data.getEntityTracker();
}
this.categoryId = categoryId;
Class<?> clazz = this.getClass();
if (!clazz.isAnnotationPresent(CheckInfo.class)) {
this.plugin.getPlugin().getLogger().warning(String.format("Malformed check class %s", clazz.getSimpleName()));
} else {
CheckInfo info = clazz.getAnnotation(CheckInfo.class);
this.type = info.type();
this.subType = info.subType();
this.baseBuffer = info.buffer();
this.state = info.state();
this.punishType = info.punishType();
this.maxVl = info.maxVl();
this.punishable = info.punish();
this.enabled = info.enabled();
this.fullName = this.type.getName() + " " + this.subType;
this.identifier = this.type.getName() + this.subType;
this.vl = this.baseBuffer;
this.buffer = 0.0;
}
}
public abstract void handle(T data, long timestamp);
public void kick(Check<?> check, String reason) {
this.plugin.getAlertManager().kick(check, reason, false);
}
public void kick(Check<?> check, String reason, boolean force) {
this.plugin.getAlertManager().kick(check, reason, force);
}
public void ban(Check<?> check, String reason) {
this.plugin.getAlertManager().ban(check, reason);
}
public void ban(Check<?> check) {
String reason = this.plugin.getConfigManager().getCheckSettings().getBanReason().getValue();
this.plugin.getAlertManager().ban(check, reason);
}
protected void debug(String message) {
AlertManager alertManager = this.plugin.getAlertManager();
if (alertManager.isDebugging(this.data.getPlayer().getUniqueId(), this.identifier)) {
String prefix = "§b[Debug §9" + ++this.debugCount + "§b]§r";
this.data.getPlayer().sendMessage(prefix + " " + message);
}
}
protected void decreaseBuffer(double amount) {
this.buffer = Math.max(0.0, this.buffer - amount);
}
protected void decreaseVl(double amount) {
this.vl = Math.max(this.baseBuffer, this.vl - amount);
this.decayAutoClickerScore(amount);
}
protected void decreaseBoth(double amount) {
this.vl = Math.max(this.baseBuffer, this.vl - amount);
this.buffer = Math.max(0.0, this.buffer - amount);
this.decayAutoClickerScore(amount);
}
public boolean shouldPunish() {
return this.isPunishable() && this.getVl() >= this.getMaxVl() && this.getMaxVl() > 0 && this.getState() == CheckState.RELEASE;
}
public void fail(String info, double vl) {
if (!this.data.isExempt()) {
if (!this.enabled) {
return;
}
this.vl += vl;
if (this.getVl() <= 0.0) {
return;
}
this.addAutoClickerScore();
this.plugin.getAlertManager().sendAlert(this, info);
}
}
public void fail(String info) {
this.fail(info, 1.0);
}
public void fail(double vl) {
if (!this.data.isExempt()) {
if (!this.enabled) {
return;
}
this.vl += vl;
if (this.getVl() <= 0.0) {
return;
}
this.plugin.getAlertManager().sendAlert(this, "");
}
}
public void fail() {
this.fail(1.0);
}
private void addAutoClickerScore() {
if (this instanceof AutoClickerCheck || this instanceof DualAutoClickerCheck) {
double currentVl = Math.max(this.getVl(), 1.0);
if (this instanceof AutoClickerCheck) {
AutoClickerCheck autoClickerCheck = (AutoClickerCheck)this;
if (autoClickerCheck.contributesToScore) {
this.data.addAutoClickerScore(currentVl / this.getMaxVl());
}
} else {
DualAutoClickerCheck dualAutoClickerCheck = (DualAutoClickerCheck)this;
if (dualAutoClickerCheck.contributesToScore) {
this.data.addAutoClickerScore(currentVl / this.getMaxVl());
}
}
}
}
private void decayAutoClickerScore(double amount) {
if (this instanceof AutoClickerCheck || this instanceof DualAutoClickerCheck) {
double currentVl = this.getVl();
if (currentVl <= 0.0 || currentVl >= this.getMaxVl()) {
currentVl = this.getMaxVl() - 1;
}
if (this instanceof AutoClickerCheck) {
AutoClickerCheck autoClickerCheck = (AutoClickerCheck)this;
if (autoClickerCheck.contributesToScore) {
this.data.decreaseAutoClickerScore((this.getMaxVl() - currentVl) / this.getMaxVl() * amount);
}
} else {
DualAutoClickerCheck dualAutoClickerCheck = (DualAutoClickerCheck)this;
if (dualAutoClickerCheck.contributesToScore) {
this.data.decreaseAutoClickerScore((this.getMaxVl() - currentVl) / this.getMaxVl() * amount);
}
}
}
}
public void reduceDamage(double multiplier, int duration) {
if ((Boolean)this.settings.getHitModificationEnabled().getValue()) {
if (!this.data.isExempt()) {
this.data.applyDamageReduction(multiplier, duration);
}
}
}
public void setback() {
if (!this.data.isExempt()) {
this.data.setback(this);
}
}
public void setback(String reason) {
if (!this.data.isExempt()) {
this.data.setback(this, reason);
}
}
public boolean canRegister() {
return this.data == null ? true : true;
}
public void setData(PlayerData data) {
this.data = data;
}
public void setConnectionTracker(ConnectionTracker connectionTracker) {
this.connectionTracker = connectionTracker;
}
public void setMovementTracker(MovementTracker movementTracker) {
this.movementTracker = movementTracker;
}
public void setActionTracker(ActionTracker actionTracker) {
this.actionTracker = actionTracker;
}
public void setAttributeTracker(AttributeTracker attributeTracker) {
this.attributeTracker = attributeTracker;
}
public void setEntityTracker(EntityTracker entityTracker) {
this.entityTracker = entityTracker;
}
public void setSettings(CheckSettingsConfig settings) {
this.settings = settings;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public void setType(CheckType type) {
this.type = type;
}
public void setSubType(String subType) {
this.subType = subType;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void setPunishable(boolean punishable) {
this.punishable = punishable;
}
public void setMaxVl(int maxVl) {
this.maxVl = maxVl;
}
public void setPunishType(PunishType punishType) {
this.punishType = punishType;
}
public void setState(CheckState state) {
this.state = state;
}
public void setBaseBuffer(double baseBuffer) {
this.baseBuffer = baseBuffer;
}
public void setVl(double vl) {
this.vl = vl;
}
public void setBuffer(double buffer) {
this.buffer = buffer;
}
public void setDebugCount(int debugCount) {
this.debugCount = debugCount;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public AntiCheat getPlugin() {
return this.plugin;
}
public ServerVersion getServerVersion() {
return this.serverVersion;
}
public PlayerData getData() {
return this.data;
}
public ConnectionTracker getConnectionTracker() {
return this.connectionTracker;
}
public MovementTracker getMovementTracker() {
return this.movementTracker;
}
public ActionTracker getActionTracker() {
return this.actionTracker;
}
public AttributeTracker getAttributeTracker() {
return this.attributeTracker;
}
public EntityTracker getEntityTracker() {
return this.entityTracker;
}
public CheckSettingsConfig getSettings() {
return this.settings;
}
public int getCategoryId() {
return this.categoryId;
}
public String getFullName() {
return this.fullName;
}
public CheckType getType() {
return this.type;
}
public String getSubType() {
return this.subType;
}
public boolean isEnabled() {
return this.enabled;
}
public boolean isPunishable() {
return this.punishable;
}
public int getMaxVl() {
return this.maxVl;
}
public PunishType getPunishType() {
return this.punishType;
}
public CheckState getState() {
return this.state;
}
public double getBaseBuffer() {
return this.baseBuffer;
}
public double getVl() {
return this.vl;
}
public double getBuffer() {
return this.buffer;
}
public int getDebugCount() {
return this.debugCount;
}
public String getIdentifier() {
return this.identifier;
}
}
@@ -0,0 +1,96 @@
package org.stellardev.anticheat.check;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.stellardev.anticheat.AntiCheat;
import org.stellardev.anticheat.check.type.BlockPlaceCheck;
import org.stellardev.anticheat.check.type.MotionCheck;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.check.type.PositionCheck;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
public class CheckHolder {
public static final int PACKET = 0;
public static final int POSITION = 1;
public static final int MOTION = 2;
public static final int ROTATION = 3;
public static final int BLOCK_PLACE = 4;
private final List<Check<?>> allChecks = new ArrayList<>();
private final List<PacketCheck> packetChecks = new ArrayList<>();
private final List<PositionCheck> positionChecks = new ArrayList<>();
private final List<MotionCheck> motionChecks = new ArrayList<>();
private final List<RotationCheck> rotationChecks = new ArrayList<>();
private final List<BlockPlaceCheck> blockPlaceChecks = new ArrayList<>();
public CheckHolder(PlayerData data) {
CheckManager.CHECK_CONSTRUCTORS.forEach(constructor -> {
try {
Check<?> check = constructor.newInstance(data);
if (data != null) {
Check<?> globalCheck = AntiCheat.getInstance().getCheckManager().getGlobalCheckHolder().getCheck(check.getClass());
check.setEnabled(globalCheck.isEnabled());
check.setPunishable(globalCheck.isPunishable());
check.setMaxVl(globalCheck.getMaxVl());
check.setPunishType(globalCheck.getPunishType());
}
if (!check.canRegister()) {
return;
}
switch (check.getCategoryId()) {
case PACKET:
this.packetChecks.add((PacketCheck)check);
break;
case POSITION:
this.positionChecks.add((PositionCheck)check);
break;
case MOTION:
this.motionChecks.add((MotionCheck)check);
break;
case ROTATION:
this.rotationChecks.add((RotationCheck)check);
break;
case BLOCK_PLACE:
this.blockPlaceChecks.add((BlockPlaceCheck)check);
break;
}
this.allChecks.add(check);
} catch (InstantiationException | InvocationTargetException | IllegalAccessException ex) {
ex.printStackTrace();
}
});
}
@SuppressWarnings("unchecked")
public <T extends Check<?>> T getCheck(Class<T> clazz) {
return (T)this.allChecks.stream().filter(check -> check.getClass() == clazz).findFirst().orElse(null);
}
public List<Check<?>> getAllChecks() {
return this.allChecks;
}
public List<PacketCheck> getPacketChecks() {
return this.packetChecks;
}
public List<PositionCheck> getPositionChecks() {
return this.positionChecks;
}
public List<MotionCheck> getMotionChecks() {
return this.motionChecks;
}
public List<RotationCheck> getRotationChecks() {
return this.rotationChecks;
}
public List<BlockPlaceCheck> getBlockPlaceChecks() {
return this.blockPlaceChecks;
}
}
@@ -0,0 +1,26 @@
package org.stellardev.anticheat.check;
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 CheckInfo {
CheckType type();
String subType();
double buffer() default 0.0;
PunishType punishType() default PunishType.BAN;
CheckState state() default CheckState.RELEASE;
int maxVl() default -1;
boolean punish() default true;
boolean enabled() default true;
}
@@ -0,0 +1,208 @@
package org.stellardev.anticheat.check;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistA;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistA2;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistB;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistC;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistC2;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistD;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistE;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistE2;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistF;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistG;
import org.stellardev.anticheat.check.impl.aimassist.AimAssistH;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerA;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerA2;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerA3;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerB;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerB2;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerB3;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerC;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerCPSLimit;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerD;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerE;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerF;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerG;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerH;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerI;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerJ;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerK;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerL;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerM;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerN;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerO;
import org.stellardev.anticheat.check.impl.autoclicker.AutoClickerO2;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsA;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsB;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsC;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsD;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsD2;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsD3;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsE;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsF;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsG;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsH;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsH2;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsI;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsI2;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsI3;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsI4;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsJ;
import org.stellardev.anticheat.check.impl.badpackets.BadPacketsK;
import org.stellardev.anticheat.check.impl.cheststealer.ChestStealerA;
import org.stellardev.anticheat.check.impl.cheststealer.ChestStealerA2;
import org.stellardev.anticheat.check.impl.cheststealer.ChestStealerB;
import org.stellardev.anticheat.check.impl.cheststealer.ChestStealerC;
import org.stellardev.anticheat.check.impl.cheststealer.ChestStealerD;
import org.stellardev.anticheat.check.impl.cheststealer.ChestStealerE;
import org.stellardev.anticheat.check.impl.cheststealer.ChestStealerF;
import org.stellardev.anticheat.check.impl.fastbreak.FastBreakA;
import org.stellardev.anticheat.check.impl.fly.FlyA;
import org.stellardev.anticheat.check.impl.fly.FlyB;
import org.stellardev.anticheat.check.impl.fly.FlyC;
import org.stellardev.anticheat.check.impl.fly.FlyD;
import org.stellardev.anticheat.check.impl.jesus.JesusA;
import org.stellardev.anticheat.check.impl.killaura.KillAuraA;
import org.stellardev.anticheat.check.impl.killaura.KillAuraB;
import org.stellardev.anticheat.check.impl.killaura.KillAuraB2;
import org.stellardev.anticheat.check.impl.killaura.KillAuraC;
import org.stellardev.anticheat.check.impl.killaura.KillAuraD;
import org.stellardev.anticheat.check.impl.killaura.KillAuraE;
import org.stellardev.anticheat.check.impl.killaura.KillAuraF;
import org.stellardev.anticheat.check.impl.killaura.KillAuraG;
import org.stellardev.anticheat.check.impl.reach.ReachA;
import org.stellardev.anticheat.check.impl.reach.ReachB;
import org.stellardev.anticheat.check.impl.reach.ReachD;
import org.stellardev.anticheat.check.impl.scaffold.ScaffoldA;
import org.stellardev.anticheat.check.impl.scaffold.ScaffoldB;
import org.stellardev.anticheat.check.impl.scaffold.ScaffoldC;
import org.stellardev.anticheat.check.impl.scaffold.ScaffoldD;
import org.stellardev.anticheat.check.impl.scaffold.ScaffoldE;
import org.stellardev.anticheat.check.impl.scaffold.ScaffoldF;
import org.stellardev.anticheat.check.impl.scaffold.ScaffoldF2;
import org.stellardev.anticheat.check.impl.speed.SpeedA;
import org.stellardev.anticheat.check.impl.speed.SpeedB;
import org.stellardev.anticheat.check.impl.speed.SpeedC;
import org.stellardev.anticheat.check.impl.timer.TimerA;
import org.stellardev.anticheat.check.impl.velocity.VelocityA;
import org.stellardev.anticheat.check.impl.velocity.VelocityB;
import org.stellardev.anticheat.check.impl.wtap.WTapA;
import org.stellardev.anticheat.check.impl.wtap.WTapB;
import org.stellardev.anticheat.data.PlayerData;
public class CheckManager {
public static final List<Constructor<? extends Check<?>>> CHECK_CONSTRUCTORS = new ArrayList<>();
private final List<Check<?>> registeredChecks = new ArrayList<>();
private final List<Class<? extends Check<?>>> checkClasses = new ArrayList<>();
private final CheckHolder globalCheckHolder = new CheckHolder(null);
public List<Check<?>> getRegisteredChecks() {
return this.registeredChecks;
}
public List<Class<? extends Check<?>>> getCheckClasses() {
return this.checkClasses;
}
public CheckHolder getGlobalCheckHolder() {
return this.globalCheckHolder;
}
static {
try {
CHECK_CONSTRUCTORS.add(AimAssistA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AimAssistA2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AimAssistB.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AimAssistC.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AimAssistC2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AimAssistD.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AimAssistE.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AimAssistE2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AimAssistF.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AimAssistG.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AimAssistH.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerA2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerA3.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerB.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerB2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerB3.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerC.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerD.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerE.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerF.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerG.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerH.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerI.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerJ.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerK.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerL.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerM.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerN.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerO.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerO2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(AutoClickerCPSLimit.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsB.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsC.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsD.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsD2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsD3.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsE.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsF.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsG.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsH.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsH2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsI.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsI2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsI3.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsI4.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsJ.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(BadPacketsK.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ChestStealerA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ChestStealerA2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ChestStealerB.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ChestStealerC.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ChestStealerD.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ChestStealerE.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ChestStealerF.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(FastBreakA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(FlyA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(FlyB.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(FlyC.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(FlyD.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(JesusA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(KillAuraA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(KillAuraB.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(KillAuraB2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(KillAuraC.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(KillAuraD.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(KillAuraE.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(KillAuraF.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(KillAuraG.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ReachD.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ReachA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ReachB.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ScaffoldA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ScaffoldB.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ScaffoldC.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ScaffoldD.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ScaffoldE.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ScaffoldF.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(ScaffoldF2.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(SpeedA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(SpeedB.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(SpeedC.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(TimerA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(VelocityA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(VelocityB.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(WTapA.class.getConstructor(PlayerData.class));
CHECK_CONSTRUCTORS.add(WTapB.class.getConstructor(PlayerData.class));
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
}
@@ -0,0 +1,7 @@
package org.stellardev.anticheat.check;
public enum CheckState {
RELEASE,
EXPERIMENTAL,
DEV;
}
@@ -0,0 +1,36 @@
package org.stellardev.anticheat.check;
import org.bukkit.Material;
public enum CheckType {
AUTO_CLICKER("Auto Clicker", Material.DIAMOND_SWORD),
AIM_ASSIST("Aim Assist", Material.DIAMOND_SWORD),
BAD_PACKETS("Bad Packets", Material.DIODE),
FAST_BREAK("Fast Break", Material.DIAMOND_PICKAXE),
FLY("Fly", Material.FEATHER),
JESUS("Jesus", Material.WATER_BUCKET),
KILL_AURA("Kill Aura", Material.DIAMOND_SWORD),
REACH("Range", Material.DIAMOND_SWORD),
SCAFFOLD("Scaffold", Material.STONE),
SPEED("Speed", Material.SUGAR),
TIMER("Timer", Material.DIODE),
VELOCITY("Velocity", Material.ANVIL),
W_TAP("W Tap", Material.DIAMOND_SWORD),
CHEST_STEALER("Chest Stealer", Material.CHEST);
private final String name;
private final Material material;
public String getName() {
return this.name;
}
public Material getMaterial() {
return this.material;
}
CheckType(String name, Material material) {
this.name = name;
this.material = material;
}
}
@@ -0,0 +1,10 @@
package org.stellardev.anticheat.check;
public enum PunishType {
KICK,
BAN;
public PunishType toggle() {
return this == BAN ? KICK : BAN;
}
}
@@ -0,0 +1,32 @@
package org.stellardev.anticheat.check.impl.aimassist;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "A", buffer = -1.0, maxVl = 20)
public class AimAssistA extends RotationCheck {
private float lastRoundedDeltaYaw;
public AimAssistA(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 200 || this.movementTracker.isTeleporting();
float deltaYaw = Math.abs(update.getTo().getYaw() - update.getFrom().getYaw());
if (!exempt && deltaYaw > 1.0F && Math.round(deltaYaw) == deltaYaw && deltaYaw % 1.5F != 0.0F) {
if (deltaYaw == this.lastRoundedDeltaYaw) {
this.fail("" + deltaYaw);
}
this.lastRoundedDeltaYaw = Math.round(deltaYaw);
} else {
this.lastRoundedDeltaYaw = 0.0F;
this.decreaseVl(8.0E-4);
}
}
}
@@ -0,0 +1,32 @@
package org.stellardev.anticheat.check.impl.aimassist;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "A2", buffer = -1.0, maxVl = 20)
public class AimAssistA2 extends RotationCheck {
private float lastRoundedDeltaYaw;
public AimAssistA2(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 200 || this.movementTracker.isTeleporting();
float deltaYaw = Math.abs(update.getTo().getYaw() - update.getFrom().getYaw());
if (!exempt && deltaYaw > 1.0F && Math.round(deltaYaw * 10.0F) * 0.1F == deltaYaw && Math.round(deltaYaw) != deltaYaw && deltaYaw % 1.5F != 0.0F) {
if (deltaYaw == this.lastRoundedDeltaYaw) {
this.fail("" + deltaYaw);
}
this.lastRoundedDeltaYaw = Math.round(deltaYaw * 10.0F) * 0.1F;
} else {
this.lastRoundedDeltaYaw = 0.0F;
this.decreaseVl(8.0E-4);
}
}
}
@@ -0,0 +1,26 @@
package org.stellardev.anticheat.check.impl.aimassist;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "B", buffer = -3.0, maxVl = 10)
public class AimAssistB extends RotationCheck {
public AimAssistB(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 50 || this.movementTracker.isTeleporting();
float deltaYaw = Math.abs(update.getTo().getYaw() - update.getFrom().getYaw());
float deltaPitch = Math.abs(update.getTo().getPitch() - update.getFrom().getPitch());
if (!exempt && deltaYaw > 1.5F && deltaYaw == deltaPitch) {
this.fail(String.format("%.3f", deltaYaw));
} else {
this.decreaseVl(0.02);
}
}
}
@@ -0,0 +1,33 @@
package org.stellardev.anticheat.check.impl.aimassist;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "C", maxVl = 20)
public class AimAssistC extends RotationCheck {
private float lastDeltaYaw;
public AimAssistC(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 50 || this.movementTracker.isTeleporting();
float deltaYaw = Math.abs(update.getTo().getYaw() - update.getFrom().getYaw());
if (!exempt && deltaYaw > 2.5F && deltaYaw == this.lastDeltaYaw) {
this.buffer = Math.min(10.0, this.buffer + 1.0);
if (this.buffer >= 10.0) {
this.fail(String.format("%.2f", deltaYaw));
}
} else {
this.decreaseBuffer(2.0);
this.decreaseVl(0.001);
}
this.lastDeltaYaw = deltaYaw;
}
}
@@ -0,0 +1,33 @@
package org.stellardev.anticheat.check.impl.aimassist;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "C2", maxVl = 20)
public class AimAssistC2 extends RotationCheck {
private float lastDeltaPitch;
public AimAssistC2(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 20 || this.movementTracker.isTeleporting();
float deltaPitch = Math.abs(update.getTo().getPitch() - update.getFrom().getPitch());
if (!exempt && deltaPitch > 2.5F && deltaPitch == this.lastDeltaPitch) {
this.buffer = Math.min(10.0, this.buffer + 1.0);
if (this.buffer >= 10.0) {
this.fail(String.format("%.2f", deltaPitch));
}
} else {
this.decreaseBuffer(0.5);
this.decreaseVl(0.001);
}
this.lastDeltaPitch = deltaPitch;
}
}
@@ -0,0 +1,34 @@
package org.stellardev.anticheat.check.impl.aimassist;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "D", maxVl = 20)
public class AimAssistD extends RotationCheck {
private float lastDeltaYaw;
public AimAssistD(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 50 || this.movementTracker.isTeleporting();
float deltaYaw = Math.abs(update.getTo().getYaw() - update.getFrom().getYaw());
float deltaPitch = Math.abs(update.getTo().getPitch() - update.getFrom().getPitch());
if (!exempt && deltaYaw > 1.5F && deltaYaw != this.lastDeltaYaw && deltaPitch == 0.0F && this.abs(update.getTo().getPitch()) != 90.0F) {
this.buffer = Math.min(30.0, this.buffer + 1.0);
if (this.buffer >= 30.0) {
this.fail(String.format("%.2f", deltaYaw));
}
} else {
this.buffer = 0.0;
this.decreaseVl(5.0E-4);
}
this.lastDeltaYaw = deltaYaw;
}
}
@@ -0,0 +1,51 @@
package org.stellardev.anticheat.check.impl.aimassist;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "E", maxVl = 50)
public class AimAssistE extends RotationCheck {
private float lastDeltaYaw;
private float lastDeltaPitch;
public AimAssistE(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 3 || this.movementTracker.isTeleporting();
float deltaYaw = Math.abs(update.getTo().getYaw() - update.getFrom().getYaw());
float deltaPitch = Math.abs(update.getTo().getPitch() - update.getFrom().getPitch());
float yawAccel = Math.abs(this.lastDeltaYaw - deltaYaw);
float pitchAccel = Math.abs(this.lastDeltaPitch - deltaPitch);
float yawJerk = Math.abs(yawAccel - deltaYaw);
float pitchJerk = Math.abs(pitchAccel - deltaPitch);
boolean highAccel = pitchAccel > 2.0F && yawAccel > 1.5F;
boolean highJerk = pitchJerk > 1.5F || yawJerk > 1.5F;
if (!exempt && deltaPitch > 0.001F && this.lastDeltaPitch > 0.001F && deltaPitch < 5.0F && this.lastDeltaPitch < 5.0F && highAccel && deltaYaw > 3.0F && this.lastDeltaYaw > 1.5F && highJerk) {
double gcd = this.getGcd(deltaPitch, this.lastDeltaPitch);
int sensitivity = (int)Math.ceil((Math.cbrt(gcd / 0.15 / 8.0) - 0.2) / 0.6);
if (gcd < 0.0094F) {
this.buffer = Math.min((Double)this.settings.getAimAssistEThreshold().getValue(), this.buffer + 1.0);
if (this.buffer >= (Double)this.settings.getAimAssistEThreshold().getValue()) {
this.reduceDamage(
(Double)this.settings.getAimAssistEDamageMultiplier().getValue(), (Integer)this.settings.getAimAssistEDamageTicks().getValue()
);
this.fail(String.format("%.4f %s %s", gcd, pitchJerk, yawJerk));
}
} else {
this.decreaseVl(0.005);
this.decreaseBuffer(1.0);
}
} else {
this.decreaseBuffer(0.01);
}
this.lastDeltaYaw = deltaYaw;
this.lastDeltaPitch = deltaPitch;
}
}
@@ -0,0 +1,38 @@
package org.stellardev.anticheat.check.impl.aimassist;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "E2", punish = false)
public class AimAssistE2 extends RotationCheck {
private float lastDeltaPitch;
public AimAssistE2(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 10 || this.movementTracker.isTeleporting();
float deltaYaw = Math.abs(update.getTo().getYaw() - update.getFrom().getYaw());
float deltaPitch = Math.abs(update.getTo().getPitch() - update.getFrom().getPitch());
double gcd = this.getGcd(deltaPitch, this.lastDeltaPitch);
if (!exempt && deltaYaw > 0.25 && deltaPitch > 0.05) {
if (gcd < 0.0094F) {
this.buffer = Math.min((Double)this.settings.getAimAssistE2Threshold().getValue(), this.buffer + 1.0);
if (++this.buffer >= (Double)this.settings.getAimAssistE2Threshold().getValue()) {
this.reduceDamage(
(Double)this.settings.getAimAssistE2DamageMultiplier().getValue(), (Integer)this.settings.getAimAssistE2DamageTicks().getValue()
);
}
} else {
this.decreaseBuffer(0.375);
}
}
this.lastDeltaPitch = deltaPitch;
}
}
@@ -0,0 +1,45 @@
package org.stellardev.anticheat.check.impl.aimassist;
import java.util.concurrent.atomic.AtomicBoolean;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.mc.CustomLocation;
import org.stellardev.anticheat.util.type.EntityHistory;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "F", buffer = -1.0, maxVl = 5)
public class AimAssistF extends RotationCheck {
public AimAssistF(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 20 || this.movementTracker.isTeleporting(3);
int targetId = this.actionTracker.getLastTargetId();
EntityHistory history = (EntityHistory)this.entityTracker.getEntityHistories().get(targetId);
if (!exempt && history != null) {
CustomLocation location = this.movementTracker.getLocation();
AtomicBoolean flagged = new AtomicBoolean(false);
float yaw = update.getTo().getYaw();
float deltaYaw = Math.abs(yaw - update.getFrom().getYaw());
if (deltaYaw > 0.25) {
history.getInterpolatedLocations().forEach(pastLocation -> {
double deltaX = pastLocation.getX() - location.getX();
double deltaZ = pastLocation.getZ() - location.getZ();
float targetYaw = (float)(Math.toDegrees(Math.atan2(deltaZ, deltaX)) - 90.0);
if (this.getAngleDistance(targetYaw, yaw) == 0.0F) {
flagged.set(true);
this.fail();
}
});
}
if (!flagged.get()) {
this.decreaseVl(0.001);
}
}
}
}
@@ -0,0 +1,38 @@
package org.stellardev.anticheat.check.impl.aimassist;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "G", maxVl = 5)
public class AimAssistG extends RotationCheck {
private float lastDeltaYaw;
private float lastDeltaPitch;
public AimAssistG(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 200 || this.movementTracker.isTeleporting();
float deltaYaw = Math.abs(update.getTo().getYaw() - update.getFrom().getYaw());
float deltaPitch = Math.abs(update.getTo().getPitch() - update.getFrom().getPitch());
float yawAccel = Math.abs(this.lastDeltaYaw - deltaYaw);
float pitchAccel = Math.abs(this.lastDeltaPitch - deltaPitch);
float yawJerk = Math.abs(yawAccel - deltaYaw);
float pitchJerk = Math.abs(pitchAccel - deltaPitch);
boolean highAccel = pitchAccel > 1.0F && yawAccel > 1.0F;
boolean highJerk = pitchJerk > 1.0F || yawJerk > 1.0F;
if (!exempt && deltaPitch > 0.001F && deltaPitch < 0.0094F && this.lastDeltaPitch > 0.001F && this.lastDeltaPitch < 10.0F && highAccel && deltaYaw > 3.0F && this.lastDeltaYaw > 1.5F && highJerk) {
this.fail(String.format("%.4f", deltaPitch));
} else {
this.decreaseVl(1.0E-4);
}
this.lastDeltaYaw = deltaYaw;
this.lastDeltaPitch = deltaPitch;
}
}
@@ -0,0 +1,36 @@
package org.stellardev.anticheat.check.impl.aimassist;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.AIM_ASSIST, subType = "H", maxVl = 20)
public class AimAssistH extends RotationCheck {
private float lastDeltaPitch;
public AimAssistH(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 10 || this.movementTracker.isTeleporting();
float deltaYaw = Math.abs(update.getTo().getYaw() - update.getFrom().getYaw());
float deltaPitch = Math.abs(update.getTo().getPitch() - update.getFrom().getPitch());
double gcd = this.getGcd(deltaPitch, this.lastDeltaPitch);
if (!exempt && deltaYaw > 1.0F && deltaPitch > 0.5 && deltaPitch < 15.0F) {
if (gcd > 0.615) {
this.buffer = Math.min(20.0, this.buffer + 1.0);
if (this.buffer >= 25.0) {
this.fail(String.format("%.4f", gcd));
}
} else {
this.decreaseBuffer(1.25);
}
}
this.lastDeltaPitch = deltaPitch;
}
}
@@ -0,0 +1,25 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "A", buffer = -1.0, maxVl = 5)
public class AutoClickerA extends AutoClickerCheck {
public AutoClickerA(PlayerData data) {
super(data, 50, false);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double cps = this.getCps(samples);
if (cps > (Double)this.settings.getAutoClickerAMax().getValue()) {
this.fail(String.format("CPS %.1f", cps));
} else {
this.decreaseVl(0.25);
}
}
}
@@ -0,0 +1,26 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "A2", buffer = -1.0, maxVl = 5)
public class AutoClickerA2 extends AutoClickerCheck {
public AutoClickerA2(PlayerData data) {
super(data, 50, false);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double cps = this.getCps(samples);
long zeroDelays = samples.stream().filter(delay -> delay == 0).count();
if (cps > this.settings.getAutoClickerA2Max().getValue() && zeroDelays == 0L) {
this.fail(String.format("CPS %.1f %d", cps, zeroDelays));
} else {
this.decreaseVl(0.2);
}
}
}
@@ -0,0 +1,27 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckState;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "A3", buffer = -1.0, maxVl = 8, state = CheckState.EXPERIMENTAL)
public class AutoClickerA3 extends AutoClickerCheck {
public AutoClickerA3(PlayerData data) {
super(data, 500, false);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double cps = this.getCps(samples);
long zeroDelays = samples.stream().filter(delay -> delay == 0).count();
if (cps > this.settings.getAutoClickerA3Max().getValue() && zeroDelays == 0L) {
this.fail(String.format("CPS %.1f %d", cps, zeroDelays));
} else {
this.decreaseVl(0.125);
}
}
}
@@ -0,0 +1,25 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "B", buffer = -2.0, maxVl = 15)
public class AutoClickerB extends AutoClickerCheck {
public AutoClickerB(PlayerData data) {
super(data, 100);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double stdDev = this.getStandardDeviation(samples);
if (stdDev < 0.475) {
this.fail(String.format("%.3f", stdDev));
} else {
this.decreaseVl(0.5);
}
}
}
@@ -0,0 +1,25 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.DualAutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "B2", buffer = -2.0, maxVl = 10)
public class AutoClickerB2 extends DualAutoClickerCheck {
public AutoClickerB2(PlayerData data) {
super(data, 100);
}
@Override
public void handleSamples(List<Integer> deltaSamples, List<Integer> rawSamples) {
this.contributesToScore = true;
double stdDev = this.getStandardDeviation(deltaSamples);
if (stdDev < 0.4) {
this.fail(String.format("%.3f", stdDev));
} else {
this.decreaseVl(0.25);
}
}
}
@@ -0,0 +1,38 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "B3", buffer = -1.0, maxVl = 10)
public class AutoClickerB3 extends AutoClickerCheck {
private final Deque<Integer> midpointSamples = new LinkedList<>();
public AutoClickerB3(PlayerData data) {
super(data, 80);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double stdDev = this.getStandardDeviation(samples);
int min = samples.stream().mapToInt(delay -> delay).min().orElse(0);
int max = samples.stream().mapToInt(delay -> delay).max().orElse(0);
int midpoint = (max + min) / 2;
this.midpointSamples.add(midpoint);
if (this.midpointSamples.size() == 4) {
double midpointStdDev = this.getStandardDeviation(this.midpointSamples);
if (stdDev <= 0.485 && midpointStdDev <= 0.45) {
this.fail(String.format("%.3f %.3f", stdDev, midpointStdDev));
} else {
this.decreaseVl(0.25);
}
this.midpointSamples.removeFirst();
}
}
}
@@ -0,0 +1,25 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "C", buffer = -2.0, maxVl = 15)
public class AutoClickerC extends AutoClickerCheck {
public AutoClickerC(PlayerData data) {
super(data, 100);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double entropy = this.getEntropy(samples);
if (entropy < 0.85) {
this.fail(String.format("%.3f", entropy), entropy < 0.725 ? 1.0 : 0.5);
} else {
this.decreaseVl(0.3);
}
}
}
@@ -0,0 +1,55 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.util.Vector;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInArmAnimation;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "CPS Limit", punish = false)
public class AutoClickerCPSLimit extends PacketCheck {
private final List<Integer> samples = new ArrayList<>(20);
private Vector lastLook;
private int ticksSinceLastClick;
public AutoClickerCPSLimit(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInArmAnimation) {
if (this.actionTracker.isDigging() || this.actionTracker.getLastDigTicks() <= 6) {
return;
}
if (this.ticksSinceLastClick < 10) {
this.samples.add(this.ticksSinceLastClick);
if (this.samples.size() >= 20) {
double cps = this.getCps(this.samples);
if (cps > this.actionTracker.getHighestCps()) {
this.actionTracker.setHighestCps(cps);
}
this.actionTracker.setRecentCps(cps);
if (cps >= (Double)this.settings.getCpsLimitMax().getValue()) {
this.reduceDamage(
(Double)this.settings.getCpsLimitDamageMultiplier().getValue(), (Integer)this.settings.getCpsLimitDamageTicks().getValue()
);
}
this.samples.remove(0);
}
}
this.ticksSinceLastClick = 0;
} else if (packet instanceof WrappedPacketInFlying) {
this.ticksSinceLastClick++;
}
}
}
@@ -0,0 +1,25 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "D", buffer = -2.0, maxVl = 5)
public class AutoClickerD extends AutoClickerCheck {
public AutoClickerD(PlayerData data) {
super(data, 1000, true, true);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
int outliers = (int)samples.stream().filter(delay -> delay > 3).count();
if (outliers < 8) {
this.fail(String.format("%d", outliers));
} else {
this.decreaseVl(0.8);
}
}
}
@@ -0,0 +1,42 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.PlayerDigAction;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInArmAnimation;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockDig;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "E", buffer = -1.0, maxVl = 5)
public class AutoClickerE extends PacketCheck {
private boolean startedDigging;
public AutoClickerE(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInBlockDig) {
PlayerDigAction action = ((WrappedPacketInBlockDig)packet).getAction();
switch (action) {
case START_DESTROY_BLOCK:
this.startedDigging = true;
break;
case ABORT_DESTROY_BLOCK:
if (this.startedDigging) {
if (++this.buffer > 20.0) {
this.fail("" + this.buffer);
}
} else {
this.buffer = 0.0;
this.decreaseVl(0.01);
}
}
} else if (packet instanceof WrappedPacketInArmAnimation) {
this.startedDigging = false;
}
}
}
@@ -0,0 +1,35 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "F", maxVl = 10)
public class AutoClickerF extends AutoClickerCheck {
private Double lastStdDev;
public AutoClickerF(PlayerData data) {
super(data, 100);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double stdDev = this.getStandardDeviation(samples);
if (this.lastStdDev != null) {
double deltaStdDev = this.abs(this.lastStdDev - stdDev);
if (stdDev < 0.75 && deltaStdDev < 0.05) {
if (++this.buffer > 4.0) {
this.fail(String.format("%.3f %.3f", stdDev, deltaStdDev));
}
} else {
this.decreaseVl(0.5);
this.decreaseBuffer(2.5);
}
}
this.lastStdDev = stdDev;
}
}
@@ -0,0 +1,25 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "G", buffer = -2.0, maxVl = 6)
public class AutoClickerG extends AutoClickerCheck {
public AutoClickerG(PlayerData data) {
super(data, 500, true, true);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double kurtosis = this.getKurtosis(samples);
if (kurtosis < 0.0) {
this.fail(String.format("%.3f", kurtosis));
} else {
this.decreaseVl(0.65);
}
}
}
@@ -0,0 +1,26 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "H", buffer = -2.0, maxVl = 8)
public class AutoClickerH extends AutoClickerCheck {
public AutoClickerH(PlayerData data) {
super(data, 500, true);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double kurtosis = this.getKurtosis(samples);
double skewness = this.getSkewness(samples);
if (kurtosis < 0.0 && skewness < 0.7) {
this.fail(String.format("%.3f %.3f", kurtosis, skewness));
} else {
this.decreaseVl(0.55);
}
}
}
@@ -0,0 +1,25 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "I", buffer = -3.0, maxVl = 15)
public class AutoClickerI extends AutoClickerCheck {
public AutoClickerI(PlayerData data) {
super(data, 500, true);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double skewness = this.getSkewness(samples);
if (skewness < 0.7) {
this.fail(String.format("%.3f", skewness));
} else {
this.decreaseVl(1.0);
}
}
}
@@ -0,0 +1,25 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.DualAutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "J", buffer = -1.0, maxVl = 10)
public class AutoClickerJ extends DualAutoClickerCheck {
public AutoClickerJ(PlayerData data) {
super(data, 500, true, false);
}
@Override
public void handleSamples(List<Integer> deltaSamples, List<Integer> rawSamples) {
this.contributesToScore = true;
double skewness = this.getSkewness(deltaSamples);
if (skewness < 0.005) {
this.fail(String.format("%.3f", skewness));
} else {
this.decreaseVl(1.25);
}
}
}
@@ -0,0 +1,27 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.AutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "K", buffer = -1.0, maxVl = 8)
public class AutoClickerK extends AutoClickerCheck {
public AutoClickerK(PlayerData data) {
super(data, 500);
}
@Override
public void handleSamples(List<Integer> samples) {
this.contributesToScore = true;
double stdDev = this.getStandardDeviation(samples);
double skewness = this.getSkewness(samples);
double kurtosis = this.getKurtosis(samples);
if (stdDev < 0.55 && skewness < 0.55 && kurtosis < 2.0) {
this.fail(String.format("%.3f %.3f %.3f", stdDev, skewness, kurtosis));
} else {
this.decreaseVl(1.5);
}
}
}
@@ -0,0 +1,52 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.util.Vector;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockDig;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "L", maxVl = 8)
public class AutoClickerL extends PacketCheck {
private final List<Integer> samples = new ArrayList<>(20);
private Vector lastAbortedPosition;
private int ticksSinceLastDig;
public AutoClickerL(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInBlockDig) {
switch (((WrappedPacketInBlockDig)packet).getAction()) {
case START_DESTROY_BLOCK:
if (this.lastAbortedPosition != null && this.lastAbortedPosition.equals(((WrappedPacketInBlockDig)packet).getPosition())) {
this.samples.add(this.ticksSinceLastDig);
if (this.samples.size() == 20) {
double stdDev = this.getStandardDeviation(this.samples);
if (stdDev < 0.45 && ++this.vl > 3.0) {
this.fail(String.format("%.3f", stdDev));
} else {
this.decreaseVl(0.5);
}
this.samples.clear();
}
}
this.ticksSinceLastDig = 0;
break;
case ABORT_DESTROY_BLOCK:
this.lastAbortedPosition = ((WrappedPacketInBlockDig)packet).getPosition();
}
} else if (packet instanceof WrappedPacketInFlying) {
this.ticksSinceLastDig++;
}
}
}
@@ -0,0 +1,29 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.DualAutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "M", buffer = -1.0, maxVl = 5)
public class AutoClickerM extends DualAutoClickerCheck {
public AutoClickerM(PlayerData data) {
super(data, 30);
}
@Override
public void handleSamples(List<Integer> deltaSamples, List<Integer> rawSamples) {
this.contributesToScore = true;
int minDelta = deltaSamples.stream().mapToInt(delta -> delta).min().orElse(0);
if (minDelta > 0) {
double cps = this.getCps(rawSamples);
if (cps >= 8.0) {
int maxDelta = deltaSamples.stream().mapToInt(delta -> delta).max().orElse(0);
this.fail(String.format("%d %d %.1f", minDelta, maxDelta, cps));
}
} else {
this.decreaseVl(0.05);
}
}
}
@@ -0,0 +1,44 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.ArrayList;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckState;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockPlace;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "N", maxVl = 25, buffer = -1.0, state = CheckState.EXPERIMENTAL)
public class AutoClickerN extends PacketCheck {
private final List<Integer> samples = new ArrayList<>(50);
private int ticksSinceLastPlace;
public AutoClickerN(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInBlockPlace) {
this.samples.add(this.ticksSinceLastPlace);
if (this.samples.size() == 50) {
double stdDev = this.getStandardDeviation(this.samples);
double average = this.getAverage(this.samples);
if (average <= 1.25 && stdDev <= 0.05) {
this.fail(String.format("A: %.2f STD: %.2f", average, stdDev), stdDev == 0.0 ? 2.0 : 1.0);
} else {
this.decreaseVl(0.2);
}
this.samples.clear();
}
this.ticksSinceLastPlace = 0;
} else if (packet instanceof WrappedPacketInFlying) {
this.ticksSinceLastPlace++;
}
}
}
@@ -0,0 +1,26 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.DualAutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "O", buffer = -1.0, maxVl = 8)
public class AutoClickerO extends DualAutoClickerCheck {
public AutoClickerO(PlayerData data) {
super(data, 600);
}
@Override
public void handleSamples(List<Integer> deltaSamples, List<Integer> rawSamples) {
this.contributesToScore = true;
int outliers = (int)rawSamples.stream().filter(delay -> delay > 3).count();
int maxDelay = rawSamples.stream().mapToInt(delay -> delay).max().orElse(0);
if (maxDelay <= 6) {
this.fail(String.format("max: %d outliers: %d", maxDelay, outliers), maxDelay <= 4 ? 2.0 : 1.0);
} else {
this.decreaseVl(0.15);
}
}
}
@@ -0,0 +1,26 @@
package org.stellardev.anticheat.check.impl.autoclicker;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.DualAutoClickerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.AUTO_CLICKER, subType = "O2", buffer = -1.0, maxVl = 8)
public class AutoClickerO2 extends DualAutoClickerCheck {
public AutoClickerO2(PlayerData data) {
super(data, 800);
}
@Override
public void handleSamples(List<Integer> deltaSamples, List<Integer> rawSamples) {
this.contributesToScore = true;
int outliers = (int)rawSamples.stream().filter(delay -> delay > 3).count();
int maxDelay = rawSamples.stream().mapToInt(delay -> delay).max().orElse(0);
if (maxDelay <= 8) {
this.fail(String.format("max: %d outliers: %d", maxDelay, outliers), maxDelay <= 4 ? 2.0 : 1.0);
} else {
this.decreaseVl(0.125);
}
}
}
@@ -0,0 +1,31 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "A", maxVl = 1)
public class BadPacketsA extends PacketCheck {
private int streak;
public BadPacketsA(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInFlying) {
if (!((WrappedPacketInFlying)packet).isHasPosition() && !this.movementTracker.isRecentlyInVehicle()) {
if (++this.streak > 23) {
this.fail("S " + this.streak);
this.streak = 0;
}
} else {
this.streak = 0;
}
}
}
}
@@ -0,0 +1,26 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "B", maxVl = 1)
public class BadPacketsB extends PacketCheck {
public BadPacketsB(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInFlying && this.abs(((WrappedPacketInFlying)packet).getPitch()) > 90.0F) {
if (this.movementTracker.isTeleporting(10)) {
return;
}
this.fail();
}
}
}
@@ -0,0 +1,51 @@
package org.stellardev.anticheat.check.impl.badpackets;
import java.util.HashSet;
import java.util.Set;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInEntityAction;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "C", maxVl = 1)
public class BadPacketsC extends PacketCheck {
private final Set<String> actions = new HashSet<>(2);
public BadPacketsC(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInEntityAction && !this.movementTracker.isTeleporting(2)) {
switch (((WrappedPacketInEntityAction)packet).getAction()) {
case START_SPRINTING:
case STOP_SPRINTING:
if (!this.actions.add("sprint")) {
this.fail("Sprint");
}
break;
case START_SNEAKING:
case STOP_SNEAKING:
if (!this.actions.add("sneak")) {
this.fail("Sneak");
}
}
} else if (packet instanceof WrappedPacketInFlying) {
this.actions.clear();
}
}
@Override
public boolean canRegister() {
if (this.data == null) {
return true;
}
int protocol = this.data.getProtocolVersion();
return protocol == 5 || protocol == 47;
}
}
@@ -0,0 +1,15 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketOrderCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockPlace;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInHeldItemSlot;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "D", maxVl = 1)
public class BadPacketsD extends PacketOrderCheck {
public BadPacketsD(PlayerData data) {
super(data, packet -> packet instanceof WrappedPacketInHeldItemSlot, packet -> packet instanceof WrappedPacketInBlockPlace);
}
}
@@ -0,0 +1,20 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketOrderCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.EntityUseActionType;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockPlace;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "D2", maxVl = 1)
public class BadPacketsD2 extends PacketOrderCheck {
public BadPacketsD2(PlayerData data) {
super(
data,
packet -> packet instanceof WrappedPacketInUseEntity && ((WrappedPacketInUseEntity)packet).getAction() == EntityUseActionType.ATTACK,
packet -> packet instanceof WrappedPacketInBlockPlace
);
}
}
@@ -0,0 +1,21 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketOrderCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.EntityUseActionType;
import org.stellardev.anticheat.packet.wrapper.client.PlayerDigAction;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockDig;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "D3", maxVl = 1)
public class BadPacketsD3 extends PacketOrderCheck {
public BadPacketsD3(PlayerData data) {
super(
data,
packet -> packet instanceof WrappedPacketInUseEntity && ((WrappedPacketInUseEntity)packet).getAction() == EntityUseActionType.ATTACK,
packet -> packet instanceof WrappedPacketInBlockDig && ((WrappedPacketInBlockDig)packet).getAction() == PlayerDigAction.RELEASE_USE_ITEM
);
}
}
@@ -0,0 +1,46 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.PlayerDigAction;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockDig;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockPlace;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "E", maxVl = 3)
public class BadPacketsE extends PacketCheck {
private boolean usingItem;
public BadPacketsE(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInBlockDig) {
if (((WrappedPacketInBlockDig)packet).getAction() == PlayerDigAction.RELEASE_USE_ITEM) {
if (!this.usingItem) {
this.fail();
} else {
this.decreaseVl(0.05);
}
this.usingItem = false;
}
} else if (packet instanceof WrappedPacketInBlockPlace) {
this.usingItem = true;
}
}
@Override
public boolean canRegister() {
if (this.data == null) {
return true;
}
int protocol = this.data.getProtocolVersion();
return protocol <= 47;
}
}
@@ -0,0 +1,14 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PostPacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockPlace;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "F", maxVl = 20)
public class BadPacketsF extends PostPacketCheck {
public BadPacketsF(PlayerData data) {
super(data, packet -> packet instanceof WrappedPacketInBlockPlace);
}
}
@@ -0,0 +1,45 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockDig;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "G", maxVl = 3)
public class BadPacketsG extends PacketCheck {
private boolean startedDigging;
public BadPacketsG(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInBlockDig) {
switch (((WrappedPacketInBlockDig)packet).getAction()) {
case START_DESTROY_BLOCK:
this.startedDigging = true;
break;
case STOP_DESTROY_BLOCK:
if (this.startedDigging) {
this.fail();
}
}
} else if (packet instanceof WrappedPacketInFlying) {
this.startedDigging = false;
}
}
@Override
public boolean canRegister() {
if (this.data == null) {
return true;
}
int protocol = this.data.getProtocolVersion();
return protocol <= 47;
}
}
@@ -0,0 +1,31 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.bukkit.util.Vector;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockPlace;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "H", maxVl = 5)
public class BadPacketsH extends PacketCheck {
public BadPacketsH(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInBlockPlace) {
WrappedPacketInBlockPlace blockPlace = (WrappedPacketInBlockPlace)packet;
if (!blockPlace.isUseItem()) {
return;
}
Vector position = blockPlace.getPosition();
if (position.getX() != -1.0 && position.getY() != -1.0 && position.getZ() != -1.0) {
this.fail(String.format("%f %f %f", position.getX(), position.getY(), position.getZ()));
}
}
}
}
@@ -0,0 +1,32 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockPlace;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "H2", maxVl = 5)
public class BadPacketsH2 extends PacketCheck {
public BadPacketsH2(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInBlockPlace) {
WrappedPacketInBlockPlace blockPlace = (WrappedPacketInBlockPlace)packet;
if (!blockPlace.isUseItem()) {
return;
}
float facingX = blockPlace.getFacingX();
float facingY = blockPlace.getFacingY();
float facingZ = blockPlace.getFacingZ();
if (facingX != 0.0F || facingY != 0.0F || facingZ != 0.0F) {
this.fail(String.format("%f %f %f", facingX, facingY, facingZ));
}
}
}
}
@@ -0,0 +1,14 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.TransactionOrderCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockPlace;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "I", maxVl = 1, punish = false)
public class BadPacketsI extends TransactionOrderCheck {
public BadPacketsI(PlayerData data) {
super(data, packet -> packet instanceof WrappedPacketInBlockPlace);
}
}
@@ -0,0 +1,14 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.TransactionOrderCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockDig;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "I2", maxVl = 1, punish = false)
public class BadPacketsI2 extends TransactionOrderCheck {
public BadPacketsI2(PlayerData data) {
super(data, packet -> packet instanceof WrappedPacketInBlockDig);
}
}
@@ -0,0 +1,14 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.TransactionOrderCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInWindowClick;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "I3", maxVl = 1, punish = false)
public class BadPacketsI3 extends TransactionOrderCheck {
public BadPacketsI3(PlayerData data) {
super(data, packet -> packet instanceof WrappedPacketInWindowClick);
}
}
@@ -0,0 +1,14 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.TransactionOrderCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInEntityAction;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "I4", maxVl = 1)
public class BadPacketsI4 extends TransactionOrderCheck {
public BadPacketsI4(PlayerData data) {
super(data, packet -> packet instanceof WrappedPacketInEntityAction);
}
}
@@ -0,0 +1,21 @@
package org.stellardev.anticheat.check.impl.badpackets;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketOrderCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.ClientCommandAction;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInClientCommand;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInWindowClick;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "J", maxVl = 3)
public class BadPacketsJ extends PacketOrderCheck {
public BadPacketsJ(PlayerData data) {
super(
data,
packet -> packet instanceof WrappedPacketInClientCommand
&& ((WrappedPacketInClientCommand)packet).getAction() == ClientCommandAction.OPEN_INVENTORY_ACHIEVEMENT,
packet -> packet instanceof WrappedPacketInWindowClick
);
}
}
@@ -0,0 +1,26 @@
package org.stellardev.anticheat.check.impl.badpackets;
import java.util.Optional;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.client.ClientBrand;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInCustomPayload;
@CheckInfo(type = CheckType.BAD_PACKETS, subType = "K", maxVl = 1)
public class BadPacketsK extends PacketCheck {
public BadPacketsK(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInCustomPayload) {
Optional.ofNullable(this.data.getClientBrand())
.filter(ClientBrand::isHacked)
.ifPresent(brand -> this.fail(this.data.getClientBrand().getDisplayName()));
}
}
}
@@ -0,0 +1,54 @@
package org.stellardev.anticheat.check.impl.cheststealer;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckState;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInCloseWindow;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInWindowClick;
import org.stellardev.anticheat.packet.wrapper.server.WrappedPacketOutOpenWindow;
@CheckInfo(type = CheckType.CHEST_STEALER, subType = "A", state = CheckState.EXPERIMENTAL)
public class ChestStealerA extends PacketCheck {
private int ticksSinceOpen;
private int openWindowId = -1;
private boolean clicked;
public ChestStealerA(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInFlying) {
this.ticksSinceOpen++;
} else if (packet instanceof WrappedPacketOutOpenWindow) {
WrappedPacketOutOpenWindow openWindow = (WrappedPacketOutOpenWindow)packet;
this.data.sendTransaction(transaction -> {
this.ticksSinceOpen = 0;
this.openWindowId = openWindow.getWindowId();
});
} else if (packet instanceof WrappedPacketInCloseWindow) {
WrappedPacketInCloseWindow closeWindow = (WrappedPacketInCloseWindow)packet;
if (closeWindow.getWindowId() == this.openWindowId) {
if (this.ticksSinceOpen <= 1 && this.connectionTracker.getPing() >= 25L) {
if (++this.buffer >= 4.0) {
this.fail();
}
} else if (!this.clicked) {
this.buffer = 0.0;
}
} else if (this.clicked) {
this.buffer = 0.0;
}
this.openWindowId = -1;
this.clicked = false;
} else if (packet instanceof WrappedPacketInWindowClick) {
this.clicked = true;
}
}
}
@@ -0,0 +1,48 @@
package org.stellardev.anticheat.check.impl.cheststealer;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckState;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInCloseWindow;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInWindowClick;
import org.stellardev.anticheat.packet.wrapper.server.WrappedPacketOutOpenWindow;
@CheckInfo(type = CheckType.CHEST_STEALER, subType = "A2", state = CheckState.EXPERIMENTAL)
public class ChestStealerA2 extends PacketCheck {
private int ticksSinceClick;
private int openWindowId = -1;
private boolean clicked;
public ChestStealerA2(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInFlying) {
this.ticksSinceClick++;
} else if (packet instanceof WrappedPacketOutOpenWindow) {
WrappedPacketOutOpenWindow openWindow = (WrappedPacketOutOpenWindow)packet;
this.data.sendTransaction(transaction -> this.openWindowId = openWindow.getWindowId());
} else if (packet instanceof WrappedPacketInCloseWindow) {
WrappedPacketInCloseWindow closeWindow = (WrappedPacketInCloseWindow)packet;
if (closeWindow.getWindowId() == this.openWindowId && this.clicked && this.ticksSinceClick <= 1) {
if (++this.buffer >= 5.0) {
this.fail(String.format("D: %d", this.ticksSinceClick));
}
} else {
this.buffer = 0.0;
}
this.openWindowId = -1;
this.clicked = false;
} else if (packet instanceof WrappedPacketInWindowClick) {
this.clicked = true;
this.ticksSinceClick = 0;
}
}
}
@@ -0,0 +1,27 @@
package org.stellardev.anticheat.check.impl.cheststealer;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.ChestStealerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.CHEST_STEALER, subType = "B", buffer = -1.0)
public class ChestStealerB extends ChestStealerCheck {
public ChestStealerB(PlayerData data) {
super(data, 10);
}
@Override
public void handleSamples(List<Integer> delaySamples, Integer missClicks) {
double cps = this.getCps(delaySamples);
double stdDev = this.getStandardDeviation(delaySamples);
double maxStdDev = cps >= 7.5 ? 0.575 : 0.45;
if (stdDev <= maxStdDev) {
double vlIncrement = stdDev <= maxStdDev / 2.0 ? 1.5 : 0.75;
this.fail(String.format("C: %.2f D: %.2f M: %d", cps, stdDev, missClicks), vlIncrement);
} else {
this.decreaseVl(0.175);
}
}
}
@@ -0,0 +1,25 @@
package org.stellardev.anticheat.check.impl.cheststealer;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.ChestStealerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.CHEST_STEALER, subType = "C", buffer = -1.0)
public class ChestStealerC extends ChestStealerCheck {
public ChestStealerC(PlayerData data) {
super(data, 8);
}
@Override
public void handleSamples(List<Integer> delaySamples, Integer missClicks) {
double cps = this.getCps(delaySamples);
double stdDev = this.getStandardDeviation(delaySamples);
if (cps >= 9.0 && missClicks == 0) {
this.fail(String.format("C: %.2f D: %.2f M: %d", cps, stdDev, missClicks));
} else {
this.decreaseVl(0.125);
}
}
}
@@ -0,0 +1,25 @@
package org.stellardev.anticheat.check.impl.cheststealer;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.ChestStealerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.CHEST_STEALER, subType = "D", buffer = -1.0)
public class ChestStealerD extends ChestStealerCheck {
public ChestStealerD(PlayerData data) {
super(data, 20);
}
@Override
public void handleSamples(List<Integer> delaySamples, Integer missClicks) {
double cps = this.getCps(delaySamples);
double stdDev = this.getStandardDeviation(delaySamples);
if (cps >= 6.0 && missClicks == 0 && stdDev <= 1.0) {
this.fail(String.format("C: %.2f D: %.2f M: %d", cps, stdDev, missClicks));
} else {
this.decreaseVl(0.125);
}
}
}
@@ -0,0 +1,41 @@
package org.stellardev.anticheat.check.impl.cheststealer;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckState;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInWindowClick;
@CheckInfo(type = CheckType.CHEST_STEALER, subType = "E", state = CheckState.EXPERIMENTAL, buffer = -2.0)
public class ChestStealerE extends PacketCheck {
private boolean clickedWindow;
private boolean usedEntity;
public ChestStealerE(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInFlying) {
WrappedPacketInFlying flying = (WrappedPacketInFlying)packet;
boolean rotated = !this.movementTracker.isRecentlyInVehicle() && !this.movementTracker.isTeleporting() && flying.isHasLook();
if (!this.clickedWindow || !rotated && !this.usedEntity) {
this.decreaseVl(0.005);
} else {
this.fail("T: " + this.movementTracker.getTeleportTicks());
}
this.clickedWindow = false;
this.usedEntity = false;
} else if (packet instanceof WrappedPacketInWindowClick) {
this.clickedWindow = true;
} else if (packet instanceof WrappedPacketInUseEntity) {
this.usedEntity = true;
}
}
}
@@ -0,0 +1,38 @@
package org.stellardev.anticheat.check.impl.cheststealer;
import java.util.List;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckState;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.ChestStealerCheck;
import org.stellardev.anticheat.data.PlayerData;
@CheckInfo(type = CheckType.CHEST_STEALER, subType = "F", buffer = -1.0, state = CheckState.EXPERIMENTAL)
public class ChestStealerF extends ChestStealerCheck {
public ChestStealerF(PlayerData data) {
super(data, 40);
}
@Override
public void handleSamples(List<Integer> delaySamples, Integer missClicks) {
double cps = this.getCps(delaySamples);
int maxDelay = delaySamples.stream().mapToInt(delay -> delay).max().orElse(0);
int nearMaxCount = (int)delaySamples.stream().filter(delay -> delay >= maxDelay - 1).count();
boolean suspicious = cps >= 2.0 && maxDelay >= 4 && maxDelay <= 20 && nearMaxCount >= this.getSampleSize() * 0.1;
if (suspicious) {
double stdDev = this.getStandardDeviation(delaySamples);
double vlIncrement = 1.0;
if (cps >= 3.75 && stdDev <= 2.0) {
vlIncrement += 0.5;
}
if (missClicks == 0) {
vlIncrement++;
}
this.fail(String.format("C: %.2f D: %.2f M: %d MA: %d MAA %d", cps, stdDev, missClicks, maxDelay, nearMaxCount), vlIncrement);
} else {
this.decreaseVl(0.125);
}
}
}
@@ -0,0 +1,42 @@
package org.stellardev.anticheat.check.impl.fastbreak;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckState;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockDig;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
@CheckInfo(type = CheckType.FAST_BREAK, subType = "A", maxVl = 25, buffer = -1.0, state = CheckState.EXPERIMENTAL)
public class FastBreakA extends PacketCheck {
private int ticksSinceStopDig;
public FastBreakA(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInBlockDig) {
WrappedPacketInBlockDig dig = (WrappedPacketInBlockDig)packet;
switch (dig.getAction()) {
case START_DESTROY_BLOCK:
if (this.ticksSinceStopDig <= 1) {
if (++this.buffer >= 3.0) {
this.fail();
}
} else {
this.buffer = 0.0;
this.decreaseVl(0.025);
}
break;
case STOP_DESTROY_BLOCK:
this.ticksSinceStopDig = 0;
}
} else if (packet instanceof WrappedPacketInFlying) {
this.ticksSinceStopDig++;
}
}
}
@@ -0,0 +1,160 @@
package org.stellardev.anticheat.check.impl.fly;
import org.stellardev.anticheat.ClientVersion;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PositionCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.mc.CustomLocation;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.FLY, subType = "A", buffer = -1.0, punish = false)
public class FlyA extends PositionCheck {
private double lastDeltaY;
private int standTicks;
public FlyA(PlayerData data) {
super(data);
}
@Override
public boolean canRegister() {
return this.data == null ? true : this.data.getClientVersion().isBelowOrEqual(ClientVersion.v1_16);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
CustomLocation to = update.getTo();
CustomLocation from = update.getFrom();
boolean resetStand = to.isOnGround()
|| this.movementTracker.getVelocityData().isPending()
|| this.movementTracker.getExplosionVelocity().isActive()
|| this.movementTracker.getLiquidTicks() <= 1
|| this.movementTracker.getClimbableTicks() <= 1;
if (resetStand) {
this.standTicks = 0;
}
double deltaY = update.getDeltaY();
double maxDiff = Math.max((Double)this.settings.getFlyATolerance().getValue(), Math.min(1.0E-10 * this.abs(to.getY()), 0.025));
boolean usedStandTolerance = false;
if (this.data.getProtocolVersion() > 47) {
if (this.standTicks <= (Integer)this.settings.getFlyAMaxStandUsage().getValue() && this.abs(deltaY) <= 0.42F) {
maxDiff += 0.1;
usedStandTolerance = true;
}
} else if (this.movementTracker.getPositionTicks() <= 4 && ++this.standTicks <= (Integer)this.settings.getFlyAMaxStandUsage().getValue()) {
maxDiff += 0.1;
}
double gravityPrediction = (this.lastDeltaY - 0.08) * 0.98F;
double predicted = gravityPrediction;
double initialDiff = this.abs(deltaY - predicted);
boolean exemptMotion = false;
if (this.movementTracker.getLiquidTicks() <= 5 && initialDiff > maxDiff) {
double liquidMotion = this.lastDeltaY * (this.movementTracker.getWaterTicks() <= 1 ? 0.8F : 0.5) - 0.02;
predicted = liquidMotion + 0.04F;
exemptMotion = this.abs(deltaY - 0.3F) <= maxDiff + 0.04F
|| this.abs(deltaY - gravityPrediction - 0.04F) <= maxDiff
|| deltaY < predicted && deltaY != 0.0;
if (deltaY != 0.0) {
maxDiff += 0.06799999910593033;
} else if (deltaY < predicted) {
maxDiff += 0.04F;
}
if (deltaY < predicted - 0.04F && deltaY <= 0.0) {
maxDiff += 0.2;
}
}
if (this.movementTracker.getClimbableTicks() <= 5 && initialDiff > maxDiff) {
double climbSpeed = 0.11760000228881837;
if (!exemptMotion) {
exemptMotion = Math.abs(deltaY - 0.11760000228881837) <= maxDiff
|| this.abs(deltaY) <= 0.11760000228881837 && deltaY > 0.0
|| deltaY < 0.11760000228881837
|| deltaY < 0.0;
}
if (deltaY < -0.11760000228881837) {
maxDiff += 0.25;
}
predicted = Math.max(predicted, -0.15);
}
if (this.abs(predicted) < (this.data.getProtocolVersion() > 47 ? 0.003 : 0.005)) {
predicted = 0.0;
}
if (this.movementTracker.getUnderBlockTicks() <= 1 && this.movementTracker.getPositionTicks() <= 1 && deltaY < predicted) {
exemptMotion = true;
}
if (this.actionTracker.getBucketPlaceTicks() <= 5 && this.standTicks <= (Integer)this.settings.getFlyAMaxStandUsage().getValue()) {
maxDiff += 0.5;
if (this.data.getProtocolVersion() <= 47) {
this.standTicks++;
}
}
double velocityTolerance = this.movementTracker.getLiquidTicks() <= 5 ? 0.08F : 0.04F;
boolean exempt = exemptMotion
|| this.movementTracker.getTotalMoveTicks() <= 5
|| this.movementTracker.isTeleporting(2)
|| this.movementTracker.isRecentlyFlying()
|| this.movementTracker.isRecentlyInVehicle()
|| this.movementTracker.getWebTicks() <= 10
|| this.movementTracker.getSlimeTicks() <= 10
|| this.movementTracker.getHeadCollisionTicks() <= 1 && deltaY >= 0.0 && deltaY <= predicted
|| to.isOnGround() && (deltaY > predicted || deltaY >= 0.0)
|| deltaY == 0.0 && to.getY() <= 0.0 && update.getDeltaXZ() < 0.5
|| this.movementTracker.getPistonTicks() <= 10
|| this.movementTracker.getVelocityData().isPending()
&& (this.movementTracker.getVelocityData().matchesVertical(deltaY, velocityTolerance) || this.movementTracker.getUnderBlockTicks() <= 10)
|| this.movementTracker.getExplosionVelocity().isActive();
double diff = this.abs(deltaY - predicted);
boolean shouldCheck = !exempt && (!from.isOnGround() || deltaY < -0.08);
if (shouldCheck && usedStandTolerance && diff > maxDiff - 0.1) {
this.standTicks++;
}
String debugInfo = String.format(
"deltaY: %.4f predicted: %.4f lastDeltaY: %.4f diff: %.4f maxDiff: %.2f std: %d tp: %d \nkbTicks: %d ladder: %d above: %d maybeAbove: %d water: %d kbY: %.2f pending: %b collW: %.5f",
deltaY,
predicted,
this.lastDeltaY,
diff,
maxDiff,
this.movementTracker.getPositionTicks(),
this.movementTracker.getTeleportTicks(),
this.movementTracker.getVelocityData().getTicks(),
this.movementTracker.getClimbableTicks(),
this.movementTracker.getHeadCollisionTicks(),
this.movementTracker.getUnderBlockTicks(),
this.movementTracker.getWaterTicks(),
this.movementTracker.getVelocityData().getY(),
this.movementTracker.getVelocityData().isPending(),
this.abs(deltaY - 0.3F)
);
if (shouldCheck && diff > maxDiff) {
this.buffer = Math.min((Double)this.settings.getFlyACancelVl().getValue(), this.buffer + Math.max(1.0, diff * 10.0));
if (this.buffer >= (Double)this.settings.getFlyACancelVl().getValue()) {
if (this.abs(deltaY + 0.09800000190735147) > 1.0E-7) {
this.setback(debugInfo);
if (++this.vl >= (Double)this.settings.getFlyAKickVl().getValue()) {
this.kick(this, "Flying or related");
}
} else if (!(Boolean)this.settings.getFlyAAllowChunkLoading().getValue()) {
this.data.teleportToLastGround();
}
}
} else if (this.movementTracker.isOnGround() || (Boolean)this.settings.getFlyADecayInAir().getValue()) {
this.decreaseBoth(0.025);
}
this.debug(debugInfo);
this.lastDeltaY = this.movementTracker.getHeadCollisionTicks() <= 1 ? 0.0 : deltaY;
}
}
@@ -0,0 +1,87 @@
package org.stellardev.anticheat.check.impl.fly;
import java.util.List;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PositionCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.TaskUtil;
import org.stellardev.anticheat.util.mc.BlockUtil;
import org.stellardev.anticheat.util.mc.BoundingBox;
import org.stellardev.anticheat.util.mc.CustomLocation;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.FLY, subType = "B", buffer = -2.0, maxVl = 8)
public class FlyB extends PositionCheck {
private double lastLastDeltaY;
public FlyB(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
if (this.movementTracker.getTotalMoveTicks() > 5 && this.movementTracker.getPistonTicks() > 20 && !this.movementTracker.isRecentlyFlying()) {
CustomLocation from = update.getFrom();
double deltaY = update.getDeltaY();
double lastDeltaY = update.getLastDeltaY();
double previousLastDeltaY = this.lastLastDeltaY;
boolean fallingFast = deltaY < -0.125 && !this.movementTracker.isTeleporting();
boolean spoofedGround = from.isOnGround()
&& (!this.movementTracker.isLastOnGround() && (!this.movementTracker.isLastLastOnGround() || lastDeltaY > 0.25) || fallingFast);
double jumpMotion = 0.42F + update.getJumpAmplifier() * 0.1F;
boolean bufferable = !fallingFast
&& (
from.getY() % 0.015625 == 0.0
|| this.movementTracker.getPositionTicks() <= 3
|| this.abs(lastDeltaY) <= 0.00525 && lastDeltaY < 0.0
|| this.abs(deltaY - jumpMotion) <= 0.03
);
if (spoofedGround) {
this.data.updateLastSetbackTime();
Player player = this.data.getPlayer();
double yExpansion = deltaY > 0.0 ? 0.25 : 0.03;
if (this.movementTracker.getPositionTicks() <= 3) {
yExpansion += 0.05;
}
BoundingBox box = new BoundingBox(from, 0.3, -yExpansion, 0.0)
.addCoord(new Vector(this.clamp(-update.getDeltaX(), -9.0, 9.0), 0.0, this.clamp(-update.getDeltaZ(), -9.0, 9.0)));
TaskUtil.runSync(
() -> {
List<Block> blocks = BlockUtil.getBlocksInBox(this.data, player, box);
boolean onGround = BlockUtil.isOnGround(player, box, from.getY(), blocks);
if (onGround || this.movementTracker.isNearBoat()) {
this.decreaseBuffer(5.0);
} else if (!bufferable) {
this.fail(fallingFast ? 1.5 : 1.0);
} else {
boolean jumpedOrFell = deltaY >= jumpMotion - 0.03
|| lastDeltaY >= jumpMotion - 0.03
|| deltaY <= -0.08
|| previousLastDeltaY <= -0.08;
this.buffer = Math.min(
(Double)this.settings.getFlyBCancelVl().getValue(),
this.buffer + (jumpedOrFell ? (Double)this.settings.getFlyBJumpMultiplier().getValue() : 1.0)
);
if (this.buffer >= (Double)this.settings.getFlyBCancelVl().getValue()) {
this.setback();
}
}
}
);
} else {
if (this.movementTracker.isOnGround() || (Boolean)this.settings.getFlyBDecayInAir().getValue()) {
this.decreaseBuffer(0.25);
}
this.decreaseVl(0.005);
}
this.lastLastDeltaY = lastDeltaY;
}
}
}
@@ -0,0 +1,113 @@
package org.stellardev.anticheat.check.impl.fly;
import org.stellardev.anticheat.ClientVersion;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PositionCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.TaskUtil;
import org.stellardev.anticheat.util.mc.CustomLocation;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.FLY, subType = "C", buffer = -2.0, maxVl = 8)
public class FlyC extends PositionCheck {
public FlyC(PlayerData data) {
super(data);
}
@Override
public boolean canRegister() {
return this.data == null ? true : this.data.getClientVersion().isBelowOrEqual(ClientVersion.v1_16);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
CustomLocation to = update.getTo();
CustomLocation from = update.getFrom();
double deltaY = update.getDeltaY();
double jumpMotion = 0.42F + update.getJumpAmplifier() * 0.1F;
boolean exempt = this.movementTracker.getTotalMoveTicks() <= 5
|| this.movementTracker.getPistonTicks() <= 20
|| this.movementTracker.getVelocityData().isPending() && this.movementTracker.getVelocityData().matchesVertical(deltaY)
|| this.movementTracker.isTeleporting(2)
|| deltaY <= jumpMotion && this.movementTracker.getUnderBlockTicks() <= 10
|| this.movementTracker.getLiquidTicks() <= 10
|| this.movementTracker.isRecentlyInVehicle()
|| this.movementTracker.getWebTicks() <= 10
|| this.movementTracker.getClimbableTicks() <= 10
|| this.movementTracker.getSlimeTicks() <= 10
|| this.movementTracker.isRecentlyFlying()
|| from.getY() % 0.015625 == 0.0 && to.getY() % 0.015625 == 0.0 && this.movementTracker.getHalfBlockTicks() <= 10 && deltaY <= 0.6
|| this.movementTracker.getExplosionVelocity().isActive();
if (this.movementTracker.getUnderBlockTicks() <= 10) {
this.buffer = 0.0;
}
double maxDiff = from.getY() % 0.015625 != 0.0 && this.movementTracker.getPositionTicks() <= 3 ? 0.03 : 1.0E-15;
double diff = this.abs(deltaY - jumpMotion);
if (!exempt && !to.isOnGround() && from.isOnGround() && deltaY >= 0.0 && diff > maxDiff) {
TaskUtil.runSync(
() -> {
if (!this.movementTracker.isNearBoat()) {
if (deltaY > jumpMotion - maxDiff) {
double bufferIncrement = 1.0;
if (deltaY % 0.015625 == 0.0) {
bufferIncrement = 0.5;
}
this.buffer = Math.min((Double)this.settings.getFlyCCancelVl().getValue(), this.buffer + bufferIncrement);
if (this.buffer >= (Double)this.settings.getFlyCCancelVl().getValue()) {
if (this.actionTracker.getSlimePlaceTicks() >= 5) {
this.fail(
String.format(
"%.3f %.3f %d",
deltaY,
this.movementTracker.getVelocityData().getY(),
this.movementTracker.getVelocityData().getTicks()
)
);
}
this.setback();
} else if (deltaY > jumpMotion) {
this.setback();
}
} else {
double scaledIncrement = Math.max(1.0, diff * 50.0);
this.buffer = Math.min((Double)this.settings.getFlyCCancelVl().getValue(), this.buffer + Math.min(1.9, scaledIncrement));
if (this.buffer >= (Double)this.settings.getFlyCCancelVl().getValue()) {
this.setback(
String.format(
"%.3f %.3f %d",
deltaY,
this.movementTracker.getVelocityData().getY(),
this.movementTracker.getVelocityData().getTicks()
)
);
}
}
}
this.debug(
String.format(
"deltaY: %.4f diff: %.4f maxDiff: %.2f posY: %.2f std: %d tp: %d kbTicks: %d above: %d maybeAbove: %d kbY: %.2f pending: %b",
deltaY,
diff,
maxDiff,
to.getY(),
this.movementTracker.getPositionTicks(),
this.movementTracker.getTeleportTicks(),
this.movementTracker.getVelocityData().getTicks(),
this.movementTracker.getHeadCollisionTicks(),
this.movementTracker.getUnderBlockTicks(),
this.movementTracker.getVelocityData().getY(),
this.movementTracker.getVelocityData().isPending()
)
);
}
);
} else if (this.movementTracker.isOnGround() || (Boolean)this.settings.getFlyCDecayInAir().getValue()) {
this.decreaseBoth(0.025);
}
}
}
@@ -0,0 +1,53 @@
package org.stellardev.anticheat.check.impl.fly;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.MotionCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.TaskUtil;
import org.stellardev.anticheat.util.mc.CustomLocation;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.FLY, subType = "D", buffer = -2.0, maxVl = 10)
public class FlyD extends MotionCheck {
private double jumpBoostAllowance;
public FlyD(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
CustomLocation to = update.getTo();
double deltaY = update.getDeltaY();
boolean exempt = this.movementTracker.getTotalMoveTicks() <= 5
|| this.movementTracker.getPistonTicks() <= 20
|| this.movementTracker.isTeleporting()
|| this.movementTracker.isRecentlyInVehicle()
|| this.movementTracker.isRecentlyFlying();
double velocityAllowance = Math.max(
0.0,
Math.abs(this.movementTracker.getVelocityData().getY() + 0.2F)
- Math.max(0.0, this.abs(this.movementTracker.getVelocityData().getTicks() - 1) * 0.0784)
);
velocityAllowance += this.movementTracker.getExplosionVelocity().getVertical();
this.jumpBoostAllowance -= 0.08;
this.jumpBoostAllowance = Math.max(this.jumpBoostAllowance, Math.abs(update.getJumpAmplifier()) * 0.1F);
double slimeAllowance = this.movementTracker.getSlimeTicks() <= 75 ? 4.0 : 0.0;
double maxDeltaY = 0.601 + this.jumpBoostAllowance + velocityAllowance + slimeAllowance;
if (!exempt && deltaY > maxDeltaY) {
TaskUtil.runSync(() -> {
if (!this.movementTracker.isNearBoat() || deltaY > maxDeltaY + 0.6) {
double vlIncrement = deltaY % 0.015625 != 0.0 && !to.isOnGround() ? 1.0 : 2.0;
if (this.actionTracker.getSlimePlaceTicks() >= 75) {
this.fail(String.format("%.2f", deltaY), vlIncrement);
}
this.setback(String.format("%.2f", deltaY));
}
});
} else {
this.decreaseVl(0.0025);
}
}
}
@@ -0,0 +1,78 @@
package org.stellardev.anticheat.check.impl.jesus;
import org.bukkit.enchantments.Enchantment;
import org.stellardev.anticheat.ClientVersion;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.MotionCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.JESUS, subType = "A", punish = false)
public class JesusA extends MotionCheck {
private double lastDeltaXZ;
private int liquidTicks;
public JesusA(PlayerData data) {
super(data);
}
@Override
public boolean canRegister() {
return this.data == null ? true : this.data.getClientVersion().isBelowOrEqual(ClientVersion.v1_12);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.movementTracker.getTotalMoveTicks() <= 5
|| this.movementTracker.getPistonTicks() <= 10
|| this.movementTracker.isRecentlyFlying()
|| this.movementTracker.isTeleporting()
|| this.movementTracker.isRecentlyInVehicle()
|| this.movementTracker.getVelocityData().isPending()
|| this.movementTracker.getExplosionVelocity().isActive();
double deltaXZ = update.getDeltaXZ();
float friction = 0.8F;
float moveFactor = 0.02F;
float depthStrider = 0.0F;
if (this.data.getPlayer().getInventory().getBoots() != null) {
depthStrider = this.data.getPlayer().getInventory().getBoots().getEnchantmentLevel(Enchantment.DEPTH_STRIDER);
}
if (this.data.getPlayer().getInventory().getHelmet() != null) {
depthStrider = Math.max(depthStrider, this.data.getPlayer().getInventory().getHelmet().getEnchantmentLevel(Enchantment.DEPTH_STRIDER));
}
if (depthStrider > 3.0F) {
depthStrider = 3.0F;
}
if (!update.getFrom().isOnGround()) {
depthStrider *= 0.5F;
}
if (depthStrider > 0.0F) {
friction += (0.54600006F - friction) * depthStrider / 3.0F;
moveFactor = (float)(moveFactor + (this.attributeTracker.getSprintAttributeSpeed() * 1.0 - moveFactor) * depthStrider / 3.0);
}
double maxSpeed = this.lastDeltaXZ * friction + moveFactor + 0.014;
double diff = deltaXZ - maxSpeed;
double tolerance = (Double)this.settings.getJesusTolerance().getValue();
if (this.actionTracker.getBucketPlaceTicks() <= 5) {
tolerance += 0.125;
}
if (!exempt && this.liquidTicks >= 1 && diff > tolerance) {
this.buffer = Math.min((Double)this.settings.getJesusCancelVl().getValue(), this.buffer + Math.max(1.0, diff * 10.0));
if (this.buffer >= (Double)this.settings.getJesusCancelVl().getValue()) {
this.setback();
}
} else {
this.decreaseBuffer(0.05);
}
this.liquidTicks = this.movementTracker.getLiquidTicks() <= 1 ? this.liquidTicks + 1 : 0;
this.lastDeltaXZ = Math.max(0.085, deltaXZ);
}
}
@@ -0,0 +1,20 @@
package org.stellardev.anticheat.check.impl.killaura;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.MissingPacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.EntityUseActionType;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInArmAnimation;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
@CheckInfo(type = CheckType.KILL_AURA, subType = "A", maxVl = 2)
public class KillAuraA extends MissingPacketCheck {
public KillAuraA(PlayerData data) {
super(
data,
packet -> packet instanceof WrappedPacketInUseEntity && ((WrappedPacketInUseEntity)packet).getAction() == EntityUseActionType.ATTACK,
packet -> packet instanceof WrappedPacketInArmAnimation
);
}
}
@@ -0,0 +1,15 @@
package org.stellardev.anticheat.check.impl.killaura;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PostPacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.EntityUseActionType;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
@CheckInfo(type = CheckType.KILL_AURA, subType = "B", maxVl = 20)
public class KillAuraB extends PostPacketCheck {
public KillAuraB(PlayerData data) {
super(data, packet -> packet instanceof WrappedPacketInUseEntity && ((WrappedPacketInUseEntity)packet).getAction() == EntityUseActionType.ATTACK);
}
}
@@ -0,0 +1,15 @@
package org.stellardev.anticheat.check.impl.killaura;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.TransactionOrderCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.client.EntityUseActionType;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
@CheckInfo(type = CheckType.KILL_AURA, subType = "B2", maxVl = 1)
public class KillAuraB2 extends TransactionOrderCheck {
public KillAuraB2(PlayerData data) {
super(data, packet -> packet instanceof WrappedPacketInUseEntity && ((WrappedPacketInUseEntity)packet).getAction() == EntityUseActionType.ATTACK);
}
}
@@ -0,0 +1,27 @@
package org.stellardev.anticheat.check.impl.killaura;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.RotationCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.type.MovementUpdate;
@CheckInfo(type = CheckType.KILL_AURA, subType = "C", maxVl = 10, buffer = -1.0)
public class KillAuraC extends RotationCheck {
public KillAuraC(PlayerData data) {
super(data);
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 20 || this.movementTracker.isTeleporting(10);
float pitch = update.getTo().getPitch();
float deltaPitch = Math.abs(pitch - update.getFrom().getPitch());
float deltaYaw = Math.abs(update.getTo().getYaw() - update.getFrom().getYaw());
if (exempt || !(deltaPitch > 1.5F) && !(deltaYaw > 3.0F) || pitch != 0.0F && pitch % 0.01F != 0.0F) {
this.decreaseVl(5.0E-4);
} else {
this.fail(String.format("T: %d pC: %.2f p: %.4f yC: %.2f", this.movementTracker.getTeleportTicks(), deltaPitch, pitch, deltaYaw));
}
}
}
@@ -0,0 +1,48 @@
package org.stellardev.anticheat.check.impl.killaura;
import org.bukkit.entity.Entity;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
@CheckInfo(type = CheckType.KILL_AURA, subType = "D", maxVl = 2)
public class KillAuraD extends PacketCheck {
private int lastTargetId = -1;
private boolean attacked;
public KillAuraD(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInUseEntity) {
WrappedPacketInUseEntity useEntity = (WrappedPacketInUseEntity)packet;
Entity target = useEntity.getTarget();
if (target == null) {
return;
}
int entityId = target.getEntityId();
if (this.attacked && entityId != this.lastTargetId) {
this.fail();
} else {
this.decreaseVl(0.01);
}
this.lastTargetId = entityId;
this.attacked = true;
} else if (packet instanceof WrappedPacketInFlying) {
this.attacked = false;
}
}
@Override
public boolean canRegister() {
return this.data == null ? true : this.data.getProtocolVersion() <= 47;
}
}
@@ -0,0 +1,27 @@
package org.stellardev.anticheat.check.impl.killaura;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
@CheckInfo(type = CheckType.KILL_AURA, subType = "E", punish = false)
public class KillAuraE extends PacketCheck {
public KillAuraE(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInUseEntity && this.actionTracker.isUsingItem() && (Boolean)this.settings.getPreventVanillaAutoBlock().getValue()) {
this.data.setCancelNextPacket(true);
}
}
@Override
public boolean canRegister() {
return this.data == null ? true : this.data.getProtocolVersion() <= 47;
}
}
@@ -0,0 +1,93 @@
package org.stellardev.anticheat.check.impl.killaura;
import java.util.ArrayList;
import java.util.List;
import org.stellardev.anticheat.AntiCheat;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckState;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PositionCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.util.mc.CustomLocation;
import org.stellardev.anticheat.util.type.MovementUpdate;
import org.stellardev.anticheat.util.type.TrackedEntity;
@CheckInfo(type = CheckType.KILL_AURA, subType = "F", buffer = -1.0, state = CheckState.EXPERIMENTAL)
public class KillAuraF extends PositionCheck {
private final List<Float> targetYawDiffSamples = new ArrayList<>();
private final List<Float> deltaYawSamples = new ArrayList<>();
private double correlationBuffer;
private double pendingVl;
private final int sampleSize = 100;
private final double correlationThreshold = 0.375;
public KillAuraF(PlayerData data) {
super(data);
}
private float findClosestAngle(float target, float... candidates) {
float closest = candidates[0];
for (int i = 1; i < candidates.length; i++) {
if (Math.abs(target - closest) > Math.abs(target - candidates[i])) {
closest = candidates[i];
}
}
return closest;
}
@Override
public void handle(MovementUpdate update, long timestamp) {
boolean exempt = this.actionTracker.getLastAttackTicks() > 3 || this.movementTracker.isTeleporting(3);
if (this.pendingVl > 0.0 && this.movementTracker.getTotalMoveTicks() % 600 == 0) {
this.fail(this.pendingVl);
this.pendingVl = 0.0;
}
if (!exempt) {
int targetId = this.actionTracker.getLastTargetId();
TrackedEntity trackedEntity = (TrackedEntity)this.entityTracker.getTrackedEntities().get(targetId);
PlayerData targetData = AntiCheat.getInstance().getPlayerDataManager().getPlayerData(targetId);
if (trackedEntity == null || targetData == null) {
return;
}
float yaw = update.getTo().getYaw();
float deltaYaw = this.getAngleDistance(yaw, update.getFrom().getYaw());
if (deltaYaw > 0.0F && deltaYaw < 45.0F) {
CustomLocation currentLocation = this.movementTracker.getLocation();
CustomLocation lastPosCurrentRot = this.movementTracker.getLastLocation().withRotation(currentLocation);
CustomLocation currentPosLastRot = currentLocation.withRotation(this.movementTracker.getLastLocation());
float closestYawDiff = this.findClosestAngle(
deltaYaw,
this.getYawDifference(currentPosLastRot, trackedEntity.getCenterLocation()),
this.getYawDifference(lastPosCurrentRot, trackedEntity.getCenterLocation()),
this.getYawDifference(currentLocation, trackedEntity.getCenterLocation())
);
this.deltaYawSamples.add(deltaYaw);
this.targetYawDiffSamples.add(closestYawDiff);
if (this.deltaYawSamples.size() >= 100 && this.targetYawDiffSamples.size() >= 100) {
float correlation = this.getCorrelationSquared(this.targetYawDiffSamples, this.deltaYawSamples, 100);
if (correlation >= 0.375) {
if (++this.correlationBuffer >= 3.0) {
this.pendingVl++;
this.correlationBuffer = 3.0;
}
} else {
if (this.pendingVl > 0.0) {
this.pendingVl = Math.max(0.0, this.pendingVl - 0.1);
} else {
this.decreaseVl(0.1);
}
this.correlationBuffer = Math.max(0.0, this.correlationBuffer - 0.25);
}
this.deltaYawSamples.clear();
this.targetYawDiffSamples.clear();
}
}
}
}
}
@@ -0,0 +1,69 @@
package org.stellardev.anticheat.check.impl.killaura;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckState;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInArmAnimation;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInBlockPlace;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
import org.stellardev.anticheat.util.mc.CustomLocation;
@CheckInfo(type = CheckType.KILL_AURA, subType = "G", state = CheckState.EXPERIMENTAL)
public class KillAuraG extends PacketCheck {
private boolean swung;
private int ticksSinceAttack;
private int lastAttackDelay;
public KillAuraG(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInUseEntity) {
this.lastAttackDelay = this.ticksSinceAttack;
this.ticksSinceAttack = 0;
this.swung = false;
} else if (packet instanceof WrappedPacketInBlockPlace) {
this.swung = false;
} else if (packet instanceof WrappedPacketInArmAnimation) {
if (this.swung) {
this.buffer = 0.0;
this.decreaseVl(0.01);
}
this.swung = true;
} else if (packet instanceof WrappedPacketInFlying) {
if (!this.swung && !this.actionTracker.isDigging()) {
if (this.actionTracker.getLastAttackTicks() <= 1) {
CustomLocation location = this.movementTracker.getLocation();
CustomLocation lastLocation = this.movementTracker.getLastLocation();
float deltaPitch = this.abs(location.getPitch() - lastLocation.getPitch());
float deltaYaw = this.getAngleDistance(location.getYaw(), lastLocation.getYaw());
double deltaXZ = this.hypot(location.getX() - lastLocation.getX(), location.getZ() - lastLocation.getZ());
boolean takingVelocity = this.movementTracker.getVelocityData().getTicks() <= 50 && this.movementTracker.getVelocityData().getHorizontal() >= 0.2;
boolean validCombat = this.lastAttackDelay <= 5 && takingVelocity && deltaXZ >= 0.1 && (deltaYaw >= 2.75 || deltaPitch >= 4.5);
if (validCombat && ++this.buffer >= 50.0) {
this.fail();
this.buffer = 0.0;
}
}
} else {
this.swung = false;
this.buffer = 0.0;
this.decreaseVl(0.01);
}
this.ticksSinceAttack++;
}
}
@Override
public boolean canRegister() {
return this.data == null ? true : this.data.getProtocolVersion() <= 47;
}
}
@@ -0,0 +1,141 @@
package org.stellardev.anticheat.check.impl.reach;
import org.stellardev.anticheat.AntiCheat;
import org.stellardev.anticheat.ClientVersion;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.EntityUseActionType;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInFlying;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
import org.stellardev.anticheat.util.math.FastMath;
import org.stellardev.anticheat.util.mc.AxisAlignedBB;
import org.stellardev.anticheat.util.mc.CustomLocation;
import org.stellardev.anticheat.util.mc.Vec3;
import org.stellardev.anticheat.util.type.TrackedEntity;
@CheckInfo(type = CheckType.REACH, subType = "A", maxVl = 8, buffer = -1.0)
public class ReachA extends PacketCheck {
private AxisAlignedBB targetBox;
private TrackedEntity targetEntity;
public ReachA(PlayerData data) {
super(data);
}
@Override
public boolean canRegister() {
return this.data == null ? true : this.data.getClientVersion().isBelowOrEqual(ClientVersion.v1_16);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (!(packet instanceof WrappedPacketInUseEntity)) {
if (packet instanceof WrappedPacketInFlying && this.targetBox != null) {
CustomLocation location = this.movementTracker.getLocation();
CustomLocation lastLocation = this.movementTracker.getLastLocation();
Double minDistance = null;
float[] eyeHeights = new float[]{1.62F, 1.54F};
if (this.data.getClientVersion().isAboveOrEqual(ClientVersion.v1_9)) {
eyeHeights = new float[]{1.62F, 1.54F, 0.4F, 1.27F};
}
for (int i = 0; i <= 1; i++) {
boolean useCurrentRotation = i == 1;
float yaw = useCurrentRotation ? location.getYaw() : lastLocation.getYaw();
float pitch = useCurrentRotation ? location.getPitch() : lastLocation.getPitch();
for (float eyeHeight : eyeHeights) {
Vec3 eyePosition = new Vec3(lastLocation.getX(), lastLocation.getY() + eyeHeight, lastLocation.getZ());
Vec3 lookVector = getLookVector(yaw, pitch);
Vec3 reachEnd = eyePosition.add(lookVector.x * 6.0, lookVector.y * 6.0, lookVector.z * 6.0);
Vec3 intercept = this.targetBox.calculateIntercept(eyePosition, reachEnd);
if (this.targetBox.isVecInside(eyePosition)) {
if (minDistance == null) {
minDistance = 0.0;
}
} else if (intercept != null) {
double distance = eyePosition.distanceTo(intercept);
if (minDistance != null) {
minDistance = Math.min(minDistance, distance);
} else {
minDistance = distance;
}
}
}
}
if (minDistance != null && !(minDistance > (Double)this.settings.getReachMaxRange().getValue())) {
this.decreaseVl(0.001);
this.decreaseBuffer((Double)this.settings.getReachThresholdDecay().getValue());
this.buffer = Math.max(0.0, this.buffer - (Double)this.settings.getReachThresholdDecay().getValue());
} else {
boolean onlyCancelHitbox = (Boolean)this.settings.getReachOnlyCancelHitboxes().getValue() && minDistance == null;
this.buffer = Math.min((Double)this.settings.getReachThreshold().getValue(), this.buffer + 1.0);
if (this.buffer >= (Double)this.settings.getReachThreshold().getValue()) {
if (!onlyCancelHitbox) {
String rangeStr = minDistance != null ? minDistance.toString() : "Hit was out of the HitBox";
String playerPosStr = String.format("x: %.2f y: %.2f z: %.2f", location.getX(), location.getY(), location.getZ());
String targetPosStr = String.format(
"tX: %.2f tY: %.2f tZ: %.2f",
(this.targetBox.minX + this.targetBox.maxX) / 2.0,
(this.targetBox.minY + this.targetBox.maxY) / 2.0,
(this.targetBox.minZ + this.targetBox.maxZ) / 2.0
);
this.fail(
String.format(
"R: %s T: %d\n%s %s\nlS: %d", rangeStr, this.movementTracker.getTeleportTicks(), playerPosStr, targetPosStr, this.targetEntity.ticksSinceUpdate
)
);
}
if ((Boolean)this.settings.getReachCancelHit().getValue() || onlyCancelHitbox) {
this.data.setCancelNextHit(true);
}
}
}
this.targetEntity = null;
this.targetBox = null;
}
} else {
WrappedPacketInUseEntity useEntity = (WrappedPacketInUseEntity)packet;
boolean exempt = this.movementTracker.isTeleporting(2) || !this.attributeTracker.isSurvivalOrAdventure();
if (useEntity.getAction() == EntityUseActionType.ATTACK && !exempt) {
this.targetEntity = (TrackedEntity)this.entityTracker.getTrackedEntities().get(this.actionTracker.getLastTargetId());
PlayerData targetData = AntiCheat.getInstance().getPlayerDataManager().getPlayerData(this.actionTracker.getLastTargetId());
if (this.targetEntity == null || targetData == null) {
if (targetData != null && !this.actionTracker.isLastAttackInvalid() && this.actionTracker.getLastTargetId() >= 0) {
this.data.setCancelNextHit(true);
}
return;
}
if (!targetData.getMovementTracker().isRecentlyInVehicle() && !this.movementTracker.isRecentlyInVehicle()) {
AxisAlignedBB box = this.targetEntity.getBoundingBox().expand(0.1, 0.1, 0.1);
box = box.expand(0.005, 0.005, 0.005);
if (this.movementTracker.getPositionTicks() <= 3) {
box = box.expand(0.03, 0.03, 0.03);
}
this.targetBox = box;
}
}
}
}
public static Vec3 getLookVector(float yaw, float pitch) {
return getVectorForRotation(pitch, yaw);
}
public static Vec3 getVectorForRotation(float pitch, float yaw) {
float cosYaw = FastMath.cos(-yaw * (float) (Math.PI / 180.0) - (float) Math.PI);
float sinYaw = FastMath.sin(-yaw * (float) (Math.PI / 180.0) - (float) Math.PI);
float cosPitch = -FastMath.cos(-pitch * (float) (Math.PI / 180.0));
float sinPitch = FastMath.sin(-pitch * (float) (Math.PI / 180.0));
return new Vec3(sinYaw * cosPitch, sinPitch, cosYaw * cosPitch);
}
}
@@ -0,0 +1,40 @@
package org.stellardev.anticheat.check.impl.reach;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.stellardev.anticheat.check.CheckInfo;
import org.stellardev.anticheat.check.CheckType;
import org.stellardev.anticheat.check.type.PacketCheck;
import org.stellardev.anticheat.data.PlayerData;
import org.stellardev.anticheat.packet.wrapper.PacketWrapper;
import org.stellardev.anticheat.packet.wrapper.client.EntityUseActionType;
import org.stellardev.anticheat.packet.wrapper.client.WrappedPacketInUseEntity;
@CheckInfo(type = CheckType.REACH, subType = "B", maxVl = 1)
public class ReachB extends PacketCheck {
public ReachB(PlayerData data) {
super(data);
}
@Override
public void handle(PacketWrapper packet, long timestamp) {
if (packet instanceof WrappedPacketInUseEntity) {
WrappedPacketInUseEntity useEntity = (WrappedPacketInUseEntity)packet;
if (useEntity.getAction() != EntityUseActionType.INTERACT_AT) {
return;
}
if (!(useEntity.getTarget() instanceof Player)) {
return;
}
Vector hitVec = useEntity.getHitVec();
double hitX = this.abs(hitVec.getX());
double hitY = hitVec.getY();
double hitZ = this.abs(hitVec.getZ());
if (hitX > 0.4005 || hitZ > 0.4005 || hitY > 1.905 || hitY < -0.105) {
this.fail(String.format("%.3f %.3f %.3f", hitX, hitY, hitZ));
}
}
}
}
Loaded 100 of 286 files, more files were not shown because too many files have changed in this diff. Show more