added files.
This commit is contained in:
commit
49cdbc2c73
356 files changed
+39620
No files matched your search
@@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.bat]
|
||||
end_of_line = crlf
|
||||
@@ -0,0 +1,9 @@
|
||||
* text=auto
|
||||
*.java text eol=lf
|
||||
*.gradle text eol=lf
|
||||
*.properties text eol=lf
|
||||
*.yml text eol=lf
|
||||
*.md text eol=lf
|
||||
gradlew text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.jar binary
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
.local/
|
||||
.gradle/
|
||||
build/
|
||||
out/
|
||||
.idea/
|
||||
*.iml
|
||||
.vscode/
|
||||
.DS_Store
|
||||
|
||||
*.class
|
||||
|
||||
*.jar
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
*.zip
|
||||
|
||||
gradle-*/
|
||||
wrapper/dists/
|
||||
|
||||
tools/
|
||||
mappings/
|
||||
recovery/
|
||||
|
||||
# Local conversation exports and migration scripts.
|
||||
/opencode-session.json
|
||||
/opencode_to_codex.py
|
||||
/repair_codex_import.py
|
||||
/05-lava-motion.gif
|
||||
/10-branch-search.gif
|
||||
|
||||
# Generated server data.
|
||||
/logs/
|
||||
/plugins/
|
||||
/server.properties
|
||||
/eula.txt
|
||||
*.log
|
||||
@@ -0,0 +1,16 @@
|
||||
<h1 align="center">Vulcan Open Source</h1>
|
||||
|
||||
---
|
||||
Please fork and download this before a DMCA takedown!
|
||||
|
||||
<p align="center">
|
||||
<img src="deobf.jpg" height="300" alt="deobf" /> <img src="hack.jpg" height="300" alt="hack" />
|
||||
</p>
|
||||
|
||||
This source is only for educational and research purposes, we are NOT afiliated with Vulcan AntiCheat, all credits to frap and other Vulcan devs for making this wonderful AntiCheat.
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
./gradlew build
|
||||
```
|
||||
@@ -0,0 +1,44 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'idea'
|
||||
}
|
||||
|
||||
group = 'me.frep.vulcan'
|
||||
version = '2.9.7.28'
|
||||
|
||||
java {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = 'https://repo.papermc.io/repository/maven-public/' }
|
||||
maven { url = 'https://repo.codemc.io/repository/maven-releases/' }
|
||||
maven { url = 'https://repo.extendedclip.com/releases/' }
|
||||
maven { url = 'https://repo.opencollab.dev/main/' }
|
||||
maven { url = 'https://repo.md-5.net/content/repositories/releases/' }
|
||||
maven { url = 'https://nexus.neetgames.com/repository/maven-snapshots/' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT'
|
||||
compileOnly 'com.github.retrooper:packetevents-spigot:2.14.0'
|
||||
compileOnly 'me.clip:placeholderapi:2.11.6'
|
||||
compileOnly 'org.geysermc.floodgate:api:2.2.4-SNAPSHOT'
|
||||
compileOnly 'com.google.guava:guava:33.4.0-jre'
|
||||
compileOnly 'com.google.code.gson:gson:2.11.0'
|
||||
compileOnly 'org.jetbrains:annotations:26.0.2'
|
||||
compileOnly('com.gmail.nossr50.mcMMO:mcMMO:2.3.003-SNAPSHOT') { transitive = false }
|
||||
implementation 'org.apache.commons:commons-lang3:3.17.0'
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.release = 17
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
tasks.named('jar') {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8
|
||||
org.gradle.java.installations.auto-download=false
|
||||
Vendored
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -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
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
rootProject.name = 'vulcan-anticheat'
|
||||
@@ -0,0 +1,116 @@
|
||||
package me.frep.vulcan.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import me.frep.vulcan.api.check.Check;
|
||||
import me.frep.vulcan.api.data.IPlayerData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface VulcanAPI {
|
||||
|
||||
class Factory {
|
||||
|
||||
private static VulcanAPI api;
|
||||
|
||||
@Nullable
|
||||
public static VulcanAPI getApi() {
|
||||
return api;
|
||||
}
|
||||
|
||||
public static void setApi(VulcanAPI instance) {
|
||||
api = instance;
|
||||
}
|
||||
}
|
||||
|
||||
void toggleAlerts(Player player);
|
||||
|
||||
void toggleVerbose(Player player);
|
||||
|
||||
IPlayerData getPlayerData(Player player);
|
||||
|
||||
int getPing(Player player);
|
||||
|
||||
double getKurtosis(Player player);
|
||||
|
||||
int getTransactionPing(Player player);
|
||||
|
||||
int getSensitivity(Player player);
|
||||
|
||||
void executeBanWave();
|
||||
|
||||
void setFrozen(Player player, boolean condition);
|
||||
|
||||
double getCps(Player player);
|
||||
|
||||
int getTotalViolations(Player player);
|
||||
|
||||
boolean isFrozen(Player player);
|
||||
|
||||
int getMovementViolations(Player player);
|
||||
|
||||
int getPlayerViolations(Player player);
|
||||
|
||||
int getCombatViolations(Player player);
|
||||
|
||||
double getTps();
|
||||
|
||||
String getServerVersion();
|
||||
|
||||
Map getCheckData();
|
||||
|
||||
int getJoinTicks(Player player);
|
||||
|
||||
boolean hasAlertsEnabled(Player player);
|
||||
|
||||
Check getCheck(Player player, String text, char character);
|
||||
|
||||
String getVulcanVersion();
|
||||
|
||||
boolean isCheckEnabled(String text);
|
||||
|
||||
int getTicks();
|
||||
|
||||
List getChecks(Player player);
|
||||
|
||||
Map getEnabledChecks();
|
||||
|
||||
Map getMaxViolations();
|
||||
|
||||
Map getAlertIntervals();
|
||||
|
||||
Map getMinimumViolationsToNotify();
|
||||
|
||||
Map getPunishmentCommands();
|
||||
|
||||
Map getPunishableChecks();
|
||||
|
||||
Map getBroadcastPunishments();
|
||||
|
||||
Map getMaximumPings();
|
||||
|
||||
Map getMinimumTps();
|
||||
|
||||
Map getMaxBuffers();
|
||||
|
||||
Map getBufferDecays();
|
||||
|
||||
Map getBufferMultiples();
|
||||
|
||||
Map getHotbarShuffle();
|
||||
|
||||
Map getHotbarShuffleMinimums();
|
||||
|
||||
Map getHotbarShuffleIntervals();
|
||||
|
||||
Map getRandomRotation();
|
||||
|
||||
Map getRandomRotationMinimums();
|
||||
|
||||
Map getRandomRotationIntervals();
|
||||
|
||||
Set getChecks();
|
||||
|
||||
void flag(Player player, String text, String text2, String text3);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package me.frep.vulcan.api.check;
|
||||
|
||||
public interface Check {
|
||||
|
||||
String getCategory();
|
||||
|
||||
String getName();
|
||||
|
||||
char getType();
|
||||
|
||||
char getDisplayType();
|
||||
|
||||
int getMaxVl();
|
||||
|
||||
int getVl();
|
||||
|
||||
double getMaxBuffer();
|
||||
|
||||
boolean isExperimental();
|
||||
|
||||
double getBufferDecay();
|
||||
|
||||
double getBufferMultiple();
|
||||
|
||||
int getMinimumVlToNotify();
|
||||
|
||||
int getAlertInterval();
|
||||
|
||||
double getBuffer();
|
||||
|
||||
void setVl(int index);
|
||||
|
||||
boolean isPunishable();
|
||||
|
||||
void setBuffer(double amount);
|
||||
|
||||
String getDescription();
|
||||
|
||||
String getComplexType();
|
||||
|
||||
String getDisplayName();
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package me.frep.vulcan.api.check;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICheckData {
|
||||
|
||||
boolean isEnabled();
|
||||
|
||||
boolean isPunishable();
|
||||
|
||||
boolean isBroadcastPunishment();
|
||||
|
||||
boolean isHotbarShuffle();
|
||||
|
||||
boolean isRandomRotation();
|
||||
|
||||
int getMaxViolations();
|
||||
|
||||
int getAlertInterval();
|
||||
|
||||
int getMinimumVlToNotify();
|
||||
|
||||
int getMaxPing();
|
||||
|
||||
int getMinimumVlToRandomlyRotate();
|
||||
|
||||
int getMinimumVlToShuffleHotbar();
|
||||
|
||||
double getMinimumTps();
|
||||
|
||||
double getMaxBuffer();
|
||||
|
||||
double getBufferDecay();
|
||||
|
||||
double getBufferMultiple();
|
||||
|
||||
List<String> getPunishmentCommands();
|
||||
|
||||
int getRandomRotationInterval();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package me.frep.vulcan.api.data;
|
||||
|
||||
public interface IPlayerData {
|
||||
|
||||
int getTotalViolations();
|
||||
|
||||
int getCombatViolations();
|
||||
|
||||
int getMovementViolations();
|
||||
|
||||
int getPlayerViolations();
|
||||
|
||||
int getAutoClickerViolations();
|
||||
|
||||
int getTimerViolations();
|
||||
|
||||
int getScaffoldViolations();
|
||||
|
||||
long getJoinTime();
|
||||
|
||||
int getJoinTicks();
|
||||
|
||||
String getClientBrand();
|
||||
|
||||
long getLastClientBrandAlert();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanDisableAlertsEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private final Player player;
|
||||
|
||||
private final long timestamp = System.currentTimeMillis();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanDisableAlertsEvent(Player player2) {
|
||||
this.player = player2;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanDiscordWebhookPunishEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private final Player player;
|
||||
|
||||
private final long timestamp = System.currentTimeMillis();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanDiscordWebhookPunishEvent(Player player2) {
|
||||
super(true);
|
||||
this.player = player2;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanEnableAlertsEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private final Player player;
|
||||
|
||||
private final long timestamp = System.currentTimeMillis();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanEnableAlertsEvent(Player player2) {
|
||||
this.player = player2;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import me.frep.vulcan.api.check.Check;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanFlagEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private final Player player;
|
||||
|
||||
private final Check check;
|
||||
|
||||
private final String info;
|
||||
|
||||
private final long timestamp = System.currentTimeMillis();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanFlagEvent(Player player2, Check check2, String info2) {
|
||||
super(true);
|
||||
this.player = player2;
|
||||
this.check = check2;
|
||||
this.info = info2;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public Check getCheck() {
|
||||
return this.check;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return this.info;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanGhostBlockEvent extends Event implements Cancellable {
|
||||
|
||||
private final Player player;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private final long timestamp = System.currentTimeMillis();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanGhostBlockEvent(Player player2) {
|
||||
super(true);
|
||||
this.player = player2;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanJudgementDayEndEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanJudgementDayEndEvent() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanJudgementDayStartEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanJudgementDayStartEvent() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import me.frep.vulcan.api.check.Check;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanPostFlagEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private final Player player;
|
||||
|
||||
private final Check check;
|
||||
|
||||
private final String info;
|
||||
|
||||
private final long timestamp = System.currentTimeMillis();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanPostFlagEvent(Player player2, Check check2, String info2) {
|
||||
super(true);
|
||||
this.player = player2;
|
||||
this.check = check2;
|
||||
this.info = info2;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public Check getCheck() {
|
||||
return this.check;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return this.info;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import me.frep.vulcan.api.check.Check;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanPunishEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private final Player player;
|
||||
|
||||
private final Check check;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanPunishEvent(Player player2, Check check2) {
|
||||
super(true);
|
||||
this.player = player2;
|
||||
this.check = check2;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public Check getCheck() {
|
||||
return this.check;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanPunishmentLogCreateEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private final Player player;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanPunishmentLogCreateEvent(Player player2) {
|
||||
super(true);
|
||||
this.player = player2;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanRegisterPlayerEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private final Player player;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanRegisterPlayerEvent(Player player2) {
|
||||
super(true);
|
||||
this.player = player2;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import me.frep.vulcan.api.check.Check;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanSetbackEvent extends Event implements Cancellable {
|
||||
|
||||
private final Player player;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private final Check check;
|
||||
|
||||
private final long timestamp = System.currentTimeMillis();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public VulcanSetbackEvent(Player player2, Check check2) {
|
||||
super(true);
|
||||
this.player = player2;
|
||||
this.check = check2;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public Check getCheck() {
|
||||
return this.check;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package me.frep.vulcan.api.event;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class VulcanViolationResetEvent extends Event implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled2) {
|
||||
this.cancelled = cancelled2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package me.frep.vulcan.spigot;
|
||||
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class VulcanPlugin extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
PluginServices.INSTANCE.start(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
PluginServices.INSTANCE.stop(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package me.frep.vulcan.spigot.alert;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface AlertHandler {
|
||||
|
||||
void onChange(Object previousValue, Object currentValue);
|
||||
}
|
||||
@@ -0,0 +1,632 @@
|
||||
package me.frep.vulcan.spigot.alert;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import java.awt.Color;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.frep.vulcan.api.event.VulcanDisableAlertsEvent;
|
||||
import me.frep.vulcan.api.event.VulcanEnableAlertsEvent;
|
||||
import me.frep.vulcan.api.event.VulcanFlagEvent;
|
||||
import me.frep.vulcan.api.event.VulcanPostFlagEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.configuration.CheckUtils;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptionManager;
|
||||
import me.frep.vulcan.spigot.config.VulcanSettings;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.message.ViolationFormatter;
|
||||
import me.frep.vulcan.spigot.message.format.MessageBuilder;
|
||||
import me.frep.vulcan.spigot.util.scheduling.MainThreadExecutor;
|
||||
import me.frep.vulcan.spigot.player.collision.CollisionState;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.punishment.JudgementDay;
|
||||
import me.frep.vulcan.spigot.tracker.movement.RelativeMoveTracker;
|
||||
import me.frep.vulcan.spigot.util.minecraft.ChatColorUtils;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
import me.frep.vulcan.spigot.webhook.DiscordWebhook;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent.Action;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
|
||||
public class AlertManager {
|
||||
|
||||
private final Set<org.bukkit.entity.Player> alertStaff = new HashSet();
|
||||
|
||||
private final Set<org.bukkit.entity.Player> verboseStaff = new HashSet();
|
||||
|
||||
private final DecimalFormat decimalFormat = new DecimalFormat("##.##");
|
||||
|
||||
public void toggleAlerts(Player player) {
|
||||
if (this.alertStaff.contains(player)) {
|
||||
this.alertStaff.remove(player);
|
||||
player.sendMessage(ChatColorUtils.colorize(VulcanSettings.alertsToggledOffMessage));
|
||||
if (VulcanSettings.settingsEnableApi) {
|
||||
VulcanDisableAlertsEvent event = new VulcanDisableAlertsEvent(player);
|
||||
if (ExemptionManager.isNewerThan1_13()) {
|
||||
MainThreadExecutor.execute(() -> AlertManager.fireDisableAlertsEvent(event));
|
||||
} else {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.alertStaff.add(player);
|
||||
player.sendMessage(ChatColorUtils.colorize(VulcanSettings.alertsToggledOnMessage));
|
||||
if (VulcanSettings.settingsEnableApi) {
|
||||
VulcanEnableAlertsEvent event = new VulcanEnableAlertsEvent(player);
|
||||
if (ExemptionManager.isNewerThan1_13()) {
|
||||
MainThreadExecutor.execute(() -> AlertManager.fireEnableAlertsEvent(event));
|
||||
} else {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleVerbose(Player player) {
|
||||
if (this.verboseStaff.contains(player)) {
|
||||
this.verboseStaff.remove(player);
|
||||
player.sendMessage(ChatColorUtils.colorize(VulcanSettings.verboseToggledOffMessage));
|
||||
} else {
|
||||
this.verboseStaff.add(player);
|
||||
player.sendMessage(ChatColorUtils.colorize(VulcanSettings.verboseToggledOnMessage));
|
||||
}
|
||||
}
|
||||
|
||||
public void processViolation(AbstractCheck check, PlayerData data, String info) {
|
||||
if (!((Boolean) VulcanSettings.checkEnabled.get(check.getCheckKey())).booleanValue()) {
|
||||
return;
|
||||
}
|
||||
if (System.currentTimeMillis() - data.getLastPunishmentAtMillis() < (long) VulcanSettings.settingsPunishmentDelay) {
|
||||
return;
|
||||
}
|
||||
if (data.getPlayer() != null && !data.getPlayer().isOnline()) {
|
||||
return;
|
||||
}
|
||||
if (VulcanSettings.settingsIgnoreFloodgate && PluginServices.INSTANCE.isLegacyFloodgateEnabled() && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgatePlayer(data.getPlayer().getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
if (VulcanSettings.settingsIgnoreFloodgate && PluginServices.INSTANCE.isFloodgateEnabled() && FloodgateApi.getInstance().isFloodgatePlayer(data.getPlayer().getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
if (ExemptionManager.getTps() < (Double) VulcanSettings.minimumTps.get(check.getCheckKey())) {
|
||||
return;
|
||||
}
|
||||
Player pingPlayer = data.getPlayer();
|
||||
if (CheckUtils.getPing(pingPlayer) > (Integer) VulcanSettings.maximumPing.get(check.getCheckKey())) {
|
||||
return;
|
||||
}
|
||||
if (VulcanSettings.settingsIgnoreVivecraft && data.getClientBrand().toLowerCase().contains("vivecraft")) {
|
||||
return;
|
||||
}
|
||||
if (data.getPlayer().hasPermission("vulcan.bypass." + check.getCheckKey().toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
if (VulcanSettings.settingsIgnoreFloodgate && PluginServices.INSTANCE.isLegacyFloodgateEnabled() && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgatePlayer(data.getPlayer().getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
if (VulcanSettings.settingsIgnoreFloodgate && PluginServices.INSTANCE.isFloodgateEnabled() && FloodgateApi.getInstance().isFloodgatePlayer(data.getPlayer().getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
if (VulcanSettings.settingsIgnoreFlagsGeyserClientBrand && data.getClientBrand().toLowerCase().contains("geyser")) {
|
||||
return;
|
||||
}
|
||||
if (VulcanSettings.settingsIgnoreGeyserUuids && data.getPlayer().getUniqueId().toString().startsWith("00000")) {
|
||||
return;
|
||||
}
|
||||
if (VulcanSettings.settingsIgnoreGeyserPrefixes && data.getPlayerName().startsWith(VulcanSettings.settingsIgnoreGeyserPrefix)) {
|
||||
return;
|
||||
}
|
||||
if (VulcanSettings.settingsEnableApi) {
|
||||
VulcanFlagEvent flagEvent = new VulcanFlagEvent(data.getPlayer(), check, info);
|
||||
Bukkit.getPluginManager().callEvent(flagEvent);
|
||||
if (flagEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
String cancelHitsCheck = (check.getName() + check.getType()).toLowerCase().replace(" ", "");
|
||||
if (VulcanSettings.cancelHitsEnabledForAllChecks || VulcanSettings.cancelHitsChecks.contains(cancelHitsCheck)) {
|
||||
data.clearCancelHitsCooldown();
|
||||
}
|
||||
check.setVl(check.getVl() + 1);
|
||||
int violations = check.getVl();
|
||||
if (!check.isExperimental() && this.isCountedInvalidCheck(check)) {
|
||||
if (!check.getName().equalsIgnoreCase("timer")) {
|
||||
data.setTotalViolations(data.getTotalViolations() + 1);
|
||||
}
|
||||
if (check.getName().equalsIgnoreCase("timer")) {
|
||||
data.setTimerViolations(data.getTimerViolations() + 1);
|
||||
}
|
||||
if (check.getName().equalsIgnoreCase("autoclicker")) {
|
||||
data.setAutoClickerViolations(data.getAutoClickerViolations() + 1);
|
||||
}
|
||||
if (check.getName().equalsIgnoreCase("scaffold")) {
|
||||
data.setScaffoldViolations(data.getScaffoldViolations() + 1);
|
||||
}
|
||||
switch(check.getCategory()) {
|
||||
case "combat":
|
||||
{
|
||||
if (check.getName().equalsIgnoreCase("autoclicker"))
|
||||
break;
|
||||
data.setCombatViolations(data.getCombatViolations() + 1);
|
||||
break;
|
||||
}
|
||||
case "movement":
|
||||
{
|
||||
data.setMovementViolations(data.getMovementViolations() + 1);
|
||||
break;
|
||||
}
|
||||
case "player":
|
||||
{
|
||||
if (check.getName().equalsIgnoreCase("timer"))
|
||||
break;
|
||||
data.setPlayerViolations(data.getPlayerViolations() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
int alertInterval = (Integer) VulcanSettings.alertIntervals.get(check.getCheckKey());
|
||||
int minimumAlertViolations = (Integer) VulcanSettings.minimumAlertViolations.get(check.getCheckKey());
|
||||
int totalViolations = data.getTotalViolations();
|
||||
int maxViolations = (Integer) VulcanSettings.maximumViolations.get(check.getCheckKey());
|
||||
if (violations % alertInterval == 0 && violations >= minimumAlertViolations) {
|
||||
String experimentalSymbol;
|
||||
if (VulcanSettings.logFileEnabled) {
|
||||
PluginServices.INSTANCE.getAlertExecutor().execute(() -> AlertManager.writeViolationLog(check, data, info));
|
||||
}
|
||||
String playerName = data.getPlayerName();
|
||||
String description = check.getCheck().description();
|
||||
String checkName = check.getCheck().name();
|
||||
double locationX = data.getCollisionState().getX();
|
||||
String x = MathUtils.formatNumber(locationX);
|
||||
double locationY = data.getCollisionState().getY();
|
||||
String y = MathUtils.formatNumber(locationY);
|
||||
double locationZ = data.getCollisionState().getZ();
|
||||
String z = MathUtils.formatNumber(locationZ);
|
||||
String world = data.getPlayer().getWorld().getName();
|
||||
Player alertPingPlayer = data.getPlayer();
|
||||
String ping = Integer.toString(CheckUtils.getPing(alertPingPlayer));
|
||||
double serverTps = ExemptionManager.getTps();
|
||||
String tps = MathUtils.formatNumber(serverTps);
|
||||
String violationsText = Integer.toString(check.getVl());
|
||||
String totalViolationsText = Integer.toString(data.getTotalViolations());
|
||||
String maxViolationsText = Integer.toString(maxViolations);
|
||||
String version = data.getClientVersion().getReleaseName();
|
||||
double clicksPerSecond = data.getClickTimingData().getClicksPerSecond();
|
||||
String cps = MathUtils.formatNumber(clicksPerSecond);
|
||||
if (check.getCheck().experimental()) {
|
||||
String experimentalSymbolSetting;
|
||||
experimentalSymbolSetting = VulcanSettings.alertsExperimentalSymbol;
|
||||
experimentalSymbol = ChatColorUtils.colorize(experimentalSymbolSetting);
|
||||
} else {
|
||||
experimentalSymbol = "";
|
||||
}
|
||||
int severity = 1;
|
||||
if (VulcanSettings.settingsPerCheckSeverities) {
|
||||
if (violations >= VulcanSettings.alertsSeverityViolations2) {
|
||||
severity = 2;
|
||||
}
|
||||
if (violations >= VulcanSettings.alertsSeverityViolations3) {
|
||||
severity = 3;
|
||||
}
|
||||
if (violations >= VulcanSettings.alertsSeverityViolations4) {
|
||||
severity = 4;
|
||||
}
|
||||
if (violations >= VulcanSettings.alertsSeverityViolations5) {
|
||||
severity = 5;
|
||||
}
|
||||
if (violations >= VulcanSettings.alertsSeverityViolations6) {
|
||||
severity = 6;
|
||||
}
|
||||
if (violations >= VulcanSettings.alertsSeverityViolations7) {
|
||||
severity = 7;
|
||||
}
|
||||
if (violations >= VulcanSettings.alertsSeverityViolations8) {
|
||||
severity = 8;
|
||||
}
|
||||
if (violations >= VulcanSettings.alertsSeverityViolations9) {
|
||||
severity = 9;
|
||||
}
|
||||
if (violations >= VulcanSettings.alertsSeverityViolations10) {
|
||||
severity = 10;
|
||||
}
|
||||
} else {
|
||||
if (totalViolations >= VulcanSettings.alertsSeverityViolations2) {
|
||||
severity = 2;
|
||||
}
|
||||
if (totalViolations >= VulcanSettings.alertsSeverityViolations3) {
|
||||
severity = 3;
|
||||
}
|
||||
if (totalViolations >= VulcanSettings.alertsSeverityViolations4) {
|
||||
severity = 4;
|
||||
}
|
||||
if (totalViolations >= VulcanSettings.alertsSeverityViolations5) {
|
||||
severity = 5;
|
||||
}
|
||||
if (totalViolations >= VulcanSettings.alertsSeverityViolations6) {
|
||||
severity = 6;
|
||||
}
|
||||
if (totalViolations >= VulcanSettings.alertsSeverityViolations7) {
|
||||
severity = 7;
|
||||
}
|
||||
if (totalViolations >= VulcanSettings.alertsSeverityViolations8) {
|
||||
severity = 8;
|
||||
}
|
||||
if (totalViolations >= VulcanSettings.alertsSeverityViolations9) {
|
||||
severity = 9;
|
||||
}
|
||||
if (totalViolations >= VulcanSettings.alertsSeverityViolations10) {
|
||||
severity = 10;
|
||||
}
|
||||
}
|
||||
String bungeeMessage = check.getDisplayName() + "#VULCAN#" + check.getDisplayType() + "#VULCAN#" + violationsText + "#VULCAN#" + playerName + "#VULCAN#" + maxViolationsText + "#VULCAN#" + version + "#VULCAN#" + tps + "#VULCAN#" + ping + "#VULCAN#" + description + "#VULCAN#" + info + "#VULCAN#" + experimentalSymbol + "#VULCAN#" + this.getSeverityColor(severity);
|
||||
Player bungeePlayer = data.getPlayer();
|
||||
this.forwardAlertToBungee(bungeePlayer, bungeeMessage);
|
||||
if (VulcanSettings.alertsPrintToConsole) {
|
||||
if (!VulcanSettings.settingsIgnoreAlertsOverMaxViolations || violations <= maxViolations + VulcanSettings.settingsIgnoreAlertsOverMaxViolationsAmount) {
|
||||
String consoleExperimentalSymbol;
|
||||
String consoleOpponentName;
|
||||
String consoleTemplate = VulcanSettings.alertsConsoleFormat;
|
||||
String consoleCategory = check.getCategory().toLowerCase();
|
||||
String consoleDetails = ChatColorUtils.colorize(consoleTemplate).replace("%player%", playerName).replaceAll("%max-vl%", maxViolationsText).replaceAll("%check%", checkName).replaceAll("%info%", info).replaceAll("%server-name%", VulcanSettings.settingsServerName).replaceAll("%cps%", cps).replaceAll("%category%", ViolationFormatter.capitalize(consoleCategory)).replaceAll("%complex-type%", check.getCheck().complexType()).replaceAll("%client-brand%", data.getClientBrand()).replaceAll("%x%", x).replaceAll("%y%", y).replaceAll("%uuid%", data.getPlayer().getUniqueId().toString());
|
||||
if (data.getRelativeMoveTracker().getPlayer() == null) {
|
||||
consoleOpponentName = "None";
|
||||
} else {
|
||||
consoleOpponentName = data.getRelativeMoveTracker().getPlayer().getName();
|
||||
}
|
||||
String consoleContext = consoleDetails.replaceAll("%opponennt%", consoleOpponentName).replaceAll("%z%", z).replaceAll("%world%", world).replaceAll("%total-violations%", totalViolationsText).replaceAll("%ping%", ping).replaceAll("%description%", description).replaceAll("%tps%", tps).replaceAll("%version%", version);
|
||||
if (check.getCheck().experimental()) {
|
||||
String consoleSymbolSetting = VulcanSettings.alertsExperimentalSymbol;
|
||||
consoleExperimentalSymbol = ChatColorUtils.colorize(consoleSymbolSetting);
|
||||
} else {
|
||||
consoleExperimentalSymbol = "";
|
||||
}
|
||||
String consoleMessage = consoleContext.replaceAll("%dev%", consoleExperimentalSymbol).replaceAll("%vl%", violationsText).replaceAll("%type%", Character.toString(check.getCheck().type()));
|
||||
ExemptionManager.logColored(consoleMessage);
|
||||
}
|
||||
}
|
||||
if (!this.alertStaff.isEmpty() && (!VulcanSettings.settingsIgnoreAlertsOverMaxViolations || violations <= maxViolations + VulcanSettings.settingsIgnoreAlertsOverMaxViolationsAmount)) {
|
||||
String hoverExperimentalSymbol;
|
||||
String hoverOpponentName;
|
||||
String alertExperimentalSymbol;
|
||||
String alertOpponentName;
|
||||
String alertFormat = ChatColorUtils.colorize(VulcanSettings.alertsFormat);
|
||||
if (PluginServices.INSTANCE.isPlaceholderApiEnabled()) {
|
||||
alertFormat = PlaceholderAPI.setPlaceholders(data.getPlayer(), alertFormat);
|
||||
}
|
||||
String alertCategory = check.getCategory().toLowerCase();
|
||||
String alertDetails = ChatColorUtils.colorize(alertFormat).replace("%player%", playerName).replaceAll("%ping%", ping).replaceAll("%tps%", tps).replaceAll("%max-vl%", maxViolationsText).replaceAll("%severity%", this.getSeverityColor(severity)).replaceAll("%client-brand%", data.getClientBrand()).replaceAll("%info%", info).replaceAll("%cps%", cps).replaceAll("%server-name%", VulcanSettings.settingsServerName).replaceAll("%category%", ViolationFormatter.capitalize(alertCategory)).replaceAll("%complex-type%", check.getCheck().complexType()).replaceAll("%x%", x).replaceAll("%y%", y).replaceAll("%z%", z).replaceAll("%uuid%", data.getPlayer().getUniqueId().toString());
|
||||
if (data.getRelativeMoveTracker().getPlayer() == null) {
|
||||
alertOpponentName = "None";
|
||||
} else {
|
||||
alertOpponentName = data.getRelativeMoveTracker().getPlayer().getName();
|
||||
}
|
||||
String alertContext = alertDetails.replaceAll("%opponennt%", alertOpponentName).replaceAll("%world%", world).replaceAll("%total-violations%", totalViolationsText).replaceAll("%check%", check.getCheck().name()).replaceAll("%description%", check.getCheck().description()).replaceAll("%version%", version);
|
||||
if (check.getCheck().experimental()) {
|
||||
String alertSymbolSetting = VulcanSettings.alertsExperimentalSymbol;
|
||||
alertExperimentalSymbol = ChatColorUtils.colorize(alertSymbolSetting);
|
||||
} else {
|
||||
alertExperimentalSymbol = "";
|
||||
}
|
||||
TextComponent alertComponent = new TextComponent(TextComponent.fromLegacyText(alertContext.replaceAll("%dev%", alertExperimentalSymbol).replaceAll("%vl%", violationsText).replaceAll("%type%", Character.toString(check.getCheck().type()))));
|
||||
for (String clickCommand : VulcanSettings.alertsClickCommands) {
|
||||
alertComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, clickCommand.replace("%player%", data.getPlayer().getName()).replaceAll("%uuid%", data.getPlayer().getUniqueId().toString())));
|
||||
}
|
||||
StringBuilder hoverBuilder = new StringBuilder();
|
||||
int hoverLineCount = VulcanSettings.alertsHoverMessage.size();
|
||||
int hoverLineNumber = 1;
|
||||
for (String hoverLine : VulcanSettings.alertsHoverMessage) {
|
||||
if (hoverLineNumber == hoverLineCount) {
|
||||
hoverBuilder.append(hoverLine);
|
||||
} else {
|
||||
hoverBuilder.append(hoverLine).append("\n");
|
||||
}
|
||||
++hoverLineNumber;
|
||||
}
|
||||
String hoverTemplate = hoverBuilder.toString();
|
||||
String hoverFormat = ChatColorUtils.colorize(hoverTemplate);
|
||||
if (PluginServices.INSTANCE.isPlaceholderApiEnabled()) {
|
||||
hoverFormat = PlaceholderAPI.setPlaceholders(data.getPlayer(), hoverFormat);
|
||||
}
|
||||
String hoverCategory = check.getCategory().toLowerCase();
|
||||
String hoverDetails = hoverFormat.replace("%player%", playerName).replaceAll("%check%", checkName).replaceAll("%max-vl%", maxViolationsText).replaceAll("%server-name%", VulcanSettings.settingsServerName).replaceAll("%client-brand%", data.getClientBrand()).replaceAll("%severity", this.getSeverityColor(severity)).replaceAll("%x%", x).replaceAll("%y%", y).replaceAll("%uuid%", data.getPlayer().getUniqueId().toString()).replaceAll("%category%", ViolationFormatter.capitalize(hoverCategory)).replaceAll("%z%", z).replaceAll("%world%", world).replaceAll("%vl%", violationsText).replaceAll("%combat-violations%", Integer.toString(data.getCombatViolations())).replaceAll("%movement-violations%", Integer.toString(data.getMovementViolations())).replaceAll("%player-violations%", Integer.toString(data.getPlayerViolations())).replaceAll("%cps%", cps).replaceAll("%complex-type%", check.getCheck().complexType()).replaceAll("%version%", version).replaceAll("%total-violations%", totalViolationsText).replaceAll("%ping%", ping);
|
||||
if (data.getRelativeMoveTracker().getPlayer() == null) {
|
||||
hoverOpponentName = "None";
|
||||
} else {
|
||||
hoverOpponentName = data.getRelativeMoveTracker().getPlayer().getName();
|
||||
}
|
||||
String hoverContext = hoverDetails.replaceAll("%opponennt%", hoverOpponentName).replaceAll("%description%", description);
|
||||
if (check.getCheck().experimental()) {
|
||||
String hoverSymbolSetting = VulcanSettings.alertsExperimentalSymbol;
|
||||
hoverExperimentalSymbol = ChatColorUtils.colorize(hoverSymbolSetting);
|
||||
} else {
|
||||
hoverExperimentalSymbol = "";
|
||||
}
|
||||
String hoverMessage = hoverContext.replaceAll("%dev%", hoverExperimentalSymbol).replaceAll("%type%", Character.toString(check.getCheck().type())).replaceAll("%tps%", tps).replaceAll("%info%", info).replaceAll("%check%", check.getCheck().name());
|
||||
String hoverText = ChatColorUtils.colorize(hoverMessage);
|
||||
if (ExemptionManager.isAtLeast1_16()) {
|
||||
alertComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hoverText)));
|
||||
} else {
|
||||
alertComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(hoverText).create()));
|
||||
}
|
||||
boolean sendAlert = true;
|
||||
if (VulcanSettings.settingsEnableApi) {
|
||||
VulcanPostFlagEvent postFlagEvent = new VulcanPostFlagEvent(data.getPlayer(), check, info);
|
||||
Bukkit.getPluginManager().callEvent(postFlagEvent);
|
||||
sendAlert = !postFlagEvent.isCancelled();
|
||||
}
|
||||
if (sendAlert) {
|
||||
if (VulcanSettings.settingsAsyncAlerts) {
|
||||
this.alertStaff.forEach(recipient -> AlertManager.sendAlertComponent(alertComponent, recipient));
|
||||
} else {
|
||||
MainThreadExecutor.execute(() -> this.broadcastAlertComponent(alertComponent));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!VulcanSettings.alertsCustomCommands.isEmpty()) {
|
||||
if (PluginServices.INSTANCE.isPlaceholderApiEnabled()) {
|
||||
MainThreadExecutor.execute(() -> AlertManager.runPlaceholderAlertCommands(data, playerName, maxViolationsText, check, info, ping, x, y, z, cps, world, tps, version, violationsText));
|
||||
} else {
|
||||
MainThreadExecutor.execute(() -> AlertManager.runAlertCommands(playerName, maxViolationsText, data, info, check, ping, x, y, z, cps, world, tps, version, violationsText));
|
||||
}
|
||||
}
|
||||
if (VulcanSettings.discordWebhookAlertsEnabled && !VulcanSettings.discordWebhookAlertsUrl.equalsIgnoreCase("insert-url-here")) {
|
||||
PluginServices.INSTANCE.getPunishmentExecutor().execute(() -> AlertManager.sendViolationWebhook(check, violations, data, playerName, checkName, maxViolationsText, x, y, z, world, violationsText, cps, version, totalViolationsText, ping, description, tps, info));
|
||||
}
|
||||
}
|
||||
if (!((Boolean) VulcanSettings.checkPunishable.get(check.getCheckKey())).booleanValue()) {
|
||||
return;
|
||||
}
|
||||
if (check.getCheck().experimental()) {
|
||||
return;
|
||||
}
|
||||
if (VulcanSettings.settingsIgnoreIfInJudgementDay && JudgementDay.isQueued(data.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
if (violations >= maxViolations && data.getPlayer().isOnline()) {
|
||||
PluginServices.INSTANCE.getPunishmentHandler().punish(check, data);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendApiAlert(Player player, String checkName, String checkType, String info) {
|
||||
PlayerData data = PluginServices.INSTANCE.getPlayerDataStore().getPlayerData(player);
|
||||
if (data == null || data.getPlayer() == null)
|
||||
return;
|
||||
if (VulcanSettings.settingsIgnoreFloodgate && (PluginServices.INSTANCE.isLegacyFloodgateEnabled() || PluginServices.INSTANCE.isFloodgateEnabled()) && FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId()))
|
||||
return;
|
||||
String brand = data.getClientBrand() == null ? "Unresolved" : data.getClientBrand();
|
||||
if ((VulcanSettings.settingsIgnoreVivecraft && brand.toLowerCase(java.util.Locale.ROOT).contains("vivecraft")) || (VulcanSettings.settingsIgnoreFlagsGeyserClientBrand && brand.toLowerCase(java.util.Locale.ROOT).contains("geyser")))
|
||||
return;
|
||||
java.util.function.UnaryOperator<String> format = template -> formatApiMessage(template, data, checkName, checkType, info);
|
||||
if (VulcanSettings.alertsPrintToConsole)
|
||||
ExemptionManager.logColored(format.apply(VulcanSettings.alertsConsoleFormat));
|
||||
if (!alertStaff.isEmpty()) {
|
||||
String message = format.apply(VulcanSettings.alertsFormat);
|
||||
if (PluginServices.INSTANCE.isPlaceholderApiEnabled())
|
||||
message = PlaceholderAPI.setPlaceholders(player, message);
|
||||
TextComponent component = new TextComponent(TextComponent.fromLegacyText(message));
|
||||
for (String command : VulcanSettings.alertsClickCommands) {
|
||||
component.setClickEvent(new ClickEvent(Action.RUN_COMMAND, command.replace("%player%", player.getName()).replace("%uuid%", player.getUniqueId().toString())));
|
||||
}
|
||||
String hover = format.apply(String.join("\n", VulcanSettings.alertsHoverMessage));
|
||||
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hover)));
|
||||
Runnable send = () -> alertStaff.forEach(recipient -> recipient.spigot().sendMessage(component));
|
||||
if (VulcanSettings.settingsAsyncAlerts)
|
||||
send.run();
|
||||
else
|
||||
MainThreadExecutor.execute(send);
|
||||
}
|
||||
if (!VulcanSettings.alertsCustomCommands.isEmpty())
|
||||
MainThreadExecutor.execute(() -> {
|
||||
for (String command : VulcanSettings.alertsCustomCommands) {
|
||||
String formatted = format.apply(command);
|
||||
if (PluginServices.INSTANCE.isPlaceholderApiEnabled())
|
||||
formatted = PlaceholderAPI.setPlaceholders(player, formatted);
|
||||
ExemptionManager.dispatchConsoleCommand(formatted);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static String formatApiMessage(String template, PlayerData data, String checkName, String checkType, String info) {
|
||||
Player opponent = data.getRelativeMoveTracker().getPlayer();
|
||||
String opponentName = opponent == null ? "None" : opponent.getName();
|
||||
CollisionState collision = data.getCollisionState();
|
||||
return ChatColorUtils.colorize(template).replace("%player%", data.getPlayerName()).replace("%uuid%", data.getPlayer().getUniqueId().toString()).replace("%client-brand%", data.getClientBrand() == null ? "Unresolved" : data.getClientBrand()).replace("%server-name%", VulcanSettings.settingsServerName).replace("%opponent%", opponentName).replace("%opponennt%", opponentName).replace("%check%", checkName).replace("%type%", checkType).replace("%info%", info).replace("%x%", Integer.toString(collision.getBlockX())).replace("%y%", Integer.toString(collision.getBlockY())).replace("%z%", Integer.toString(collision.getBlockZ())).replace("%world%", data.getPlayer().getWorld().getName()).replace("%cps%", MathUtils.formatNumber(data.getClickTimingData().getClicksPerSecond())).replace("%ping%", Integer.toString(CheckUtils.getPing(data.getPlayer()))).replace("%tps%", MathUtils.formatNumber(ExemptionManager.getTps())).replace("%version%", data.getClientVersion().getReleaseName()).replace("%total-violations%", Integer.toString(data.getTotalViolations())).replace("%combat-violations%", Integer.toString(data.getCombatViolations())).replace("%movement-violations%", Integer.toString(data.getMovementViolations())).replace("%player-violations%", Integer.toString(data.getPlayerViolations()));
|
||||
}
|
||||
|
||||
private String getSeverityColor(int severity) {
|
||||
return ChatColorUtils.colorize(switch(severity) {
|
||||
case 1 ->
|
||||
VulcanSettings.alertsSeverityColors1;
|
||||
case 2 ->
|
||||
VulcanSettings.alertsSeverityColors2;
|
||||
case 3 ->
|
||||
VulcanSettings.alertsSeverityColors3;
|
||||
case 4 ->
|
||||
VulcanSettings.alertsSeverityColors4;
|
||||
case 5 ->
|
||||
VulcanSettings.alertsSeverityColors5;
|
||||
case 6 ->
|
||||
VulcanSettings.alertsSeverityColors6;
|
||||
case 7 ->
|
||||
VulcanSettings.alertsSeverityColors7;
|
||||
case 8 ->
|
||||
VulcanSettings.alertsSeverityColors8;
|
||||
case 9 ->
|
||||
VulcanSettings.alertsSeverityColors9;
|
||||
case 10 ->
|
||||
VulcanSettings.alertsSeverityColors10;
|
||||
default ->
|
||||
"";
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isCountedInvalidCheck(AbstractCheck check) {
|
||||
String checkKey = check.getName().toLowerCase() + ":" + String.valueOf(check.getType()).toLowerCase();
|
||||
List<String> countedChecks = Arrays.asList("invalid:a", "invalid:b");
|
||||
return countedChecks.contains(checkKey);
|
||||
}
|
||||
|
||||
public void broadcastAlert(String message) {
|
||||
this.alertStaff.forEach(recipient -> AlertManager.sendColoredMessage(message, recipient));
|
||||
}
|
||||
|
||||
private void forwardAlertToBungee(Player player, String message) {
|
||||
if (VulcanSettings.settingsPluginMessaging) {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("alert");
|
||||
out.writeUTF(message);
|
||||
player.sendPluginMessage(PluginServices.INSTANCE.getVulcanPlugin(), "vulcan:bungee", out.toByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
public Set getAlertStaff() {
|
||||
return this.alertStaff;
|
||||
}
|
||||
|
||||
public Set getVerboseStaff() {
|
||||
return this.verboseStaff;
|
||||
}
|
||||
|
||||
private static void sendColoredMessage(String message, Player player) {
|
||||
player.sendMessage(ChatColorUtils.colorize(message));
|
||||
}
|
||||
|
||||
private static void sendViolationWebhook(AbstractCheck check, int violations, PlayerData data, String name, String checkName, String maxViolations, String x, String y, String z, String world, String vl, String cps, String version, String totalViolations, String ping, String description, String tps, String info) {
|
||||
int interval = (Integer) VulcanSettings.discordAlertIntervals.get(check.getCheckKey());
|
||||
if (interval <= 0 || violations % interval != 0)
|
||||
return;
|
||||
if (VulcanSettings.discordWebhookCooldown && PluginServices.INSTANCE.getPunishmentsInWindow() >= VulcanSettings.discordWebhookCooldownMaxWebhooks)
|
||||
return;
|
||||
Player opponent = data.getRelativeMoveTracker().getPlayer();
|
||||
String opponentName = opponent == null ? "None" : opponent.getName();
|
||||
java.util.function.UnaryOperator<String> format = template -> {
|
||||
String message = template.replace("%player%", name).replace("%name%", name).replace("%uuid%", data.getUniqueId().toString()).replace("%check%", checkName).replace("%max-vl%", maxViolations).replace("%server-name%", VulcanSettings.settingsServerName).replace("%client-brand%", data.getClientBrand()).replace("%client-version%", data.getUser().getClientVersion().getReleaseName()).replace("%x%", x).replace("%y%", y).replace("%z%", z).replace("%world%", world).replace("%vl%", vl).replace("%cps%", cps).replace("%version%", version).replace("%total-violations%", totalViolations).replace("%ping%", ping).replace("%description%", description).replace("%complex-type%", check.getCheck().complexType()).replace("%category%", ViolationFormatter.capitalize(check.getCategory().toLowerCase(java.util.Locale.ROOT))).replace("%opponent%", opponentName).replace("%opponennt%", opponentName).replace("%dev%", check.getCheck().experimental() ? ChatColorUtils.colorize(VulcanSettings.alertsExperimentalSymbol) : "").replace("%type%", Character.toString(check.getCheck().type())).replace("%tps%", tps).replace("%info%", info);
|
||||
return PluginServices.INSTANCE.isPlaceholderApiEnabled() ? PlaceholderAPI.setPlaceholders(data.getPlayer(), message) : message;
|
||||
};
|
||||
DiscordWebhook webhook = new DiscordWebhook(VulcanSettings.discordWebhookAlertsUrl);
|
||||
webhook.setAvatarUrl(VulcanSettings.discordWebhookAlertsAvatar);
|
||||
webhook.setUsername(VulcanSettings.discordWebhookAlertsUsername);
|
||||
MessageBuilder embed = new MessageBuilder().setTitle(format.apply(VulcanSettings.discordWebhookAlertsTitle)).setThumbnail(format.apply(VulcanSettings.discordWebhookAlertsThumbnail)).setColor(new Color(VulcanSettings.discordWebhookAlertsColorR, VulcanSettings.discordWebhookAlertsColorG, VulcanSettings.discordWebhookAlertsColorB)).setDescription(format.apply(VulcanSettings.discordWebhookAlertsDescription));
|
||||
if (VulcanSettings.discordWebhookAlertsDescriptionField)
|
||||
embed.addField("Description", description, true);
|
||||
if (VulcanSettings.discordWebhookAlertsInformationField)
|
||||
embed.addField("Information", info, true);
|
||||
if (VulcanSettings.discordWebhookAlertsServerNameField)
|
||||
embed.addField("Server Name", VulcanSettings.settingsServerName, true);
|
||||
if (VulcanSettings.discordWebhookAlertsClientBrandField)
|
||||
embed.addField("Client Brand", data.getClientBrand(), true);
|
||||
if (VulcanSettings.discordWebhookAlertsClientVersionField)
|
||||
embed.addField("Client Version", data.getUser().getClientVersion().getReleaseName(), true);
|
||||
if (VulcanSettings.discordWebhookAlertsPingTpsField)
|
||||
embed.addField("Ping | TPS", ping + "ms | " + tps, true);
|
||||
if (VulcanSettings.discordWebhookAlertsLocationField)
|
||||
embed.addField("Location", "(" + world + ", " + x + ", " + y + ", " + z + ")", true);
|
||||
webhook.addEmbed(embed);
|
||||
if (!VulcanSettings.discordWebhookAlertsContent.isEmpty())
|
||||
webhook.setContent(format.apply(VulcanSettings.discordWebhookAlertsContent));
|
||||
webhook.send();
|
||||
if (VulcanSettings.discordWebhookCooldown)
|
||||
PluginServices.INSTANCE.setPunishmentsInWindow(PluginServices.INSTANCE.getPunishmentsInWindow() + 1);
|
||||
}
|
||||
|
||||
private static void runAlertCommands(String playerName, String maxViolations, PlayerData data, String info, AbstractCheck check, String ping, String x, String y, String z, String cps, String world, String tps, String version, String violations) {
|
||||
VulcanSettings.alertsCustomCommands.forEach(line -> AlertManager.runAlertCommand(playerName, maxViolations, data, info, check, ping, x, y, z, cps, world, tps, version, violations, line));
|
||||
}
|
||||
|
||||
private static void runAlertCommand(String playerName, String maxViolations, PlayerData data, String info, AbstractCheck check, String ping, String x, String y, String z, String cps, String world, String tps, String version, String violations, String command) {
|
||||
String formattedCommand = command.replace("%player%", playerName).replaceAll("%max-vl%", maxViolations).replaceAll("%client-brand%", data.getClientBrand()).replaceAll("%server-name%", VulcanSettings.settingsServerName).replaceAll("%info%", info);
|
||||
RelativeMoveTracker opponentTracker = data.getRelativeMoveTracker();
|
||||
String opponentName;
|
||||
if (opponentTracker.getPlayer() == null) {
|
||||
opponentName = "None";
|
||||
} else {
|
||||
opponentTracker = data.getRelativeMoveTracker();
|
||||
opponentName = opponentTracker.getPlayer().getName();
|
||||
}
|
||||
formattedCommand = formattedCommand.replaceAll("%opponennt%", opponentName);
|
||||
formattedCommand = formattedCommand.replaceAll("%complex-type%", check.getCheck().complexType());
|
||||
formattedCommand = formattedCommand.replaceAll("%check%", check.getCheck().name()).replaceAll("%ping%", ping);
|
||||
formattedCommand = formattedCommand.replaceAll("%description%", check.getCheck().description()).replaceAll("%x%", x).replaceAll("%y%", y).replaceAll("%z%", z);
|
||||
formattedCommand = formattedCommand.replaceAll("%uuid%", data.getPlayer().getUniqueId().toString());
|
||||
String category = check.getCategory().toLowerCase();
|
||||
formattedCommand = formattedCommand.replaceAll("%category%", ViolationFormatter.capitalize(category)).replaceAll("%cps%", cps).replaceAll("%world%", world).replaceAll("%total-violations%", Integer.toString(data.getTotalViolations())).replaceAll("%tps%", tps);
|
||||
formattedCommand = formattedCommand.replaceAll("%version%", version);
|
||||
String experimentalSymbol;
|
||||
if (check.getCheck().experimental()) {
|
||||
String experimentalSymbolSetting = VulcanSettings.alertsExperimentalSymbol;
|
||||
experimentalSymbol = ChatColorUtils.colorize(experimentalSymbolSetting);
|
||||
} else {
|
||||
experimentalSymbol = "";
|
||||
}
|
||||
formattedCommand = formattedCommand.replaceAll("%dev%", experimentalSymbol).replaceAll("%vl%", violations);
|
||||
String commandToDispatch = formattedCommand.replaceAll("%type%", Character.toString(check.getCheck().type()));
|
||||
ExemptionManager.dispatchConsoleCommand(commandToDispatch);
|
||||
}
|
||||
|
||||
private static void runPlaceholderAlertCommands(PlayerData data, String playerName, String maxViolations, AbstractCheck check, String info, String ping, String x, String y, String z, String cps, String world, String tps, String version, String violations) {
|
||||
VulcanSettings.alertsCustomCommands.forEach(line -> AlertManager.runPlaceholderAlertCommand(data, playerName, maxViolations, check, info, ping, x, y, z, cps, world, tps, version, violations, line));
|
||||
}
|
||||
|
||||
private static void runPlaceholderAlertCommand(PlayerData data, String playerName, String maxViolations, AbstractCheck check, String info, String ping, String x, String y, String z, String cps, String world, String tps, String version, String violations, String command) {
|
||||
Player player = data.getPlayer();
|
||||
String formattedCommand = command.replace("%player%", playerName).replaceAll("%max-vl%", maxViolations).replaceAll("%client-brand%", data.getClientBrand());
|
||||
String category = check.getCategory().toLowerCase();
|
||||
formattedCommand = formattedCommand.replaceAll("%category%", ViolationFormatter.capitalize(category)).replaceAll("%server-name%", VulcanSettings.settingsServerName).replaceAll("%info%", info);
|
||||
formattedCommand = formattedCommand.replaceAll("%complex-type%", check.getCheck().complexType());
|
||||
formattedCommand = formattedCommand.replaceAll("%check%", check.getCheck().name()).replaceAll("%ping%", ping);
|
||||
formattedCommand = formattedCommand.replaceAll("%description%", check.getCheck().description()).replaceAll("%x%", x);
|
||||
formattedCommand = formattedCommand.replaceAll("%uuid%", data.getPlayer().getUniqueId().toString());
|
||||
RelativeMoveTracker opponentTracker = data.getRelativeMoveTracker();
|
||||
String opponentName;
|
||||
if (opponentTracker.getPlayer() == null) {
|
||||
opponentName = "None";
|
||||
} else {
|
||||
opponentTracker = data.getRelativeMoveTracker();
|
||||
opponentName = opponentTracker.getPlayer().getName();
|
||||
}
|
||||
formattedCommand = formattedCommand.replaceAll("%opponennt%", opponentName).replaceAll("%y%", y).replaceAll("%z%", z).replaceAll("%cps%", cps).replaceAll("%world%", world).replaceAll("%total-violations%", Integer.toString(data.getTotalViolations())).replaceAll("%tps%", tps);
|
||||
formattedCommand = formattedCommand.replaceAll("%version%", version);
|
||||
String experimentalSymbol;
|
||||
if (check.getCheck().experimental()) {
|
||||
String experimentalSymbolSetting = VulcanSettings.alertsExperimentalSymbol;
|
||||
experimentalSymbol = ChatColorUtils.colorize(experimentalSymbolSetting);
|
||||
} else {
|
||||
experimentalSymbol = "";
|
||||
}
|
||||
formattedCommand = formattedCommand.replaceAll("%dev%", experimentalSymbol).replaceAll("%vl%", violations);
|
||||
String commandToDispatch = PlaceholderAPI.setPlaceholders(player, formattedCommand.replaceAll("%type%", Character.toString(check.getCheck().type())));
|
||||
ExemptionManager.dispatchConsoleCommand(commandToDispatch);
|
||||
}
|
||||
|
||||
private void broadcastAlertComponent(TextComponent component) {
|
||||
this.alertStaff.forEach(player -> player.spigot().sendMessage(component));
|
||||
}
|
||||
|
||||
private static void sendVerboseComponent(TextComponent component, Player player) {
|
||||
player.spigot().sendMessage(component);
|
||||
}
|
||||
|
||||
private static void sendAlertComponent(TextComponent component, Player player) {
|
||||
player.spigot().sendMessage(component);
|
||||
}
|
||||
|
||||
private static void writeViolationLog(AbstractCheck check, PlayerData data, String info) {
|
||||
ViolationFormatter.writeViolationLog(check, data, info);
|
||||
}
|
||||
|
||||
private static void fireEnableAlertsEvent(VulcanEnableAlertsEvent event) {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
private static void fireDisableAlertsEvent(VulcanDisableAlertsEvent event) {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
package me.frep.vulcan.spigot.api;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import me.frep.vulcan.api.VulcanAPI;
|
||||
import me.frep.vulcan.api.check.Check;
|
||||
import me.frep.vulcan.api.data.IPlayerData;
|
||||
import me.frep.vulcan.spigot.alert.AlertManager;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.configuration.CheckUtils;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptionManager;
|
||||
import me.frep.vulcan.spigot.check.manager.CheckManager;
|
||||
import me.frep.vulcan.spigot.config.VulcanSettings;
|
||||
import me.frep.vulcan.spigot.data.PlayerDataStore;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.collision.CollisionState;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.punishment.JudgementDay;
|
||||
import me.frep.vulcan.spigot.tracker.confirmation.ConfirmationTracker;
|
||||
import me.frep.vulcan.spigot.task.TickProcessor;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class VulcanSpigotAPI implements VulcanAPI {
|
||||
|
||||
@Override
|
||||
public IPlayerData getPlayerData(Player player2) {
|
||||
PlayerDataStore playerDataStore = PluginServices.INSTANCE.getPlayerDataStore();
|
||||
return playerDataStore.getPlayerData(player2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPing(Player player2) {
|
||||
return CheckUtils.getPing(player2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeBanWave() {
|
||||
JudgementDay.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFrozen(Player player2) {
|
||||
PlayerData playerData2 = (PlayerData) this.getPlayerData(player2);
|
||||
CollisionState collisionState = playerData2.getCollisionState();
|
||||
return collisionState.isFrozen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getKurtosis(Player player2) {
|
||||
PlayerData playerData2 = (PlayerData) this.getPlayerData(player2);
|
||||
return playerData2.getClickTimingData().getKurtosis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFrozen(Player player2, boolean condition) {
|
||||
PlayerData playerData2 = (PlayerData) this.getPlayerData(player2);
|
||||
if (playerData2 != null) {
|
||||
playerData2.getCollisionState().setFrozen(condition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSensitivity(Player player2) {
|
||||
PlayerData playerData2 = (PlayerData) this.getPlayerData(player2);
|
||||
RotationTracker rotationTracker = playerData2.getRotationTracker();
|
||||
return rotationTracker.getSensitivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCps(Player player2) {
|
||||
PlayerData playerData2 = (PlayerData) this.getPlayerData(player2);
|
||||
ClickTimingData clickTimingData = playerData2.getClickTimingData();
|
||||
return clickTimingData.getClicksPerSecond();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransactionPing(Player player2) {
|
||||
PlayerData playerData2 = (PlayerData) this.getPlayerData(player2);
|
||||
ConfirmationTracker confirmationTracker = playerData2.getConfirmationTracker();
|
||||
return (int) confirmationTracker.getTransactionPingMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalViolations(Player player2) {
|
||||
return this.getPlayerData(player2).getTotalViolations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCombatViolations(Player player2) {
|
||||
return this.getPlayerData(player2).getCombatViolations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMovementViolations(Player player2) {
|
||||
return this.getPlayerData(player2).getMovementViolations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerViolations(Player player2) {
|
||||
return this.getPlayerData(player2).getPlayerViolations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTps() {
|
||||
return ExemptionManager.getTps();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTicks() {
|
||||
TickProcessor tickProcessor = PluginServices.INSTANCE.getTickProcessor();
|
||||
return tickProcessor.getTotalTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getJoinTicks(Player player2) {
|
||||
return this.getPlayerData(player2).getJoinTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVulcanVersion() {
|
||||
return PluginServices.INSTANCE.getVulcanPlugin().getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Check getCheck(Player player, String string, char c) {
|
||||
Player player2 = player;
|
||||
PlayerData playerData = PluginServices.INSTANCE.getPlayerDataStore().getPlayerData(player2);
|
||||
if (playerData == null) {
|
||||
return null;
|
||||
}
|
||||
for (AbstractCheck abstractCheck : playerData.getChecks()) {
|
||||
if (!abstractCheck.getName().equals(string) || !Character.toString(abstractCheck.getType()).equals(Character.toString(c)))
|
||||
continue;
|
||||
return abstractCheck;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getCheckData() {
|
||||
return VulcanSettings.checkDataByName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAlertsEnabled(Player player2) {
|
||||
return PluginServices.INSTANCE.getAlertManager().getAlertStaff().contains(player2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCheckEnabled(String text) {
|
||||
for (Constructor constructor : CheckManager.constructors) {
|
||||
if (constructor.getClass().getSimpleName().equalsIgnoreCase(text)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersion() {
|
||||
return ExemptionManager.getServerVersion().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set getChecks() {
|
||||
return VulcanSettings.checkEnabled.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getEnabledChecks() {
|
||||
return VulcanSettings.checkEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getMaxViolations() {
|
||||
return VulcanSettings.maximumViolations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getAlertIntervals() {
|
||||
return VulcanSettings.alertIntervals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getMinimumViolationsToNotify() {
|
||||
return VulcanSettings.minimumAlertViolations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getPunishmentCommands() {
|
||||
return VulcanSettings.punishmentCommands;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getPunishableChecks() {
|
||||
return VulcanSettings.checkPunishable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getBroadcastPunishments() {
|
||||
return VulcanSettings.broadcastPunishments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getMaximumPings() {
|
||||
return VulcanSettings.maximumPing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getMinimumTps() {
|
||||
return VulcanSettings.minimumTps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getMaxBuffers() {
|
||||
return VulcanSettings.maximumBuffers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getBufferDecays() {
|
||||
return VulcanSettings.bufferDecays;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getBufferMultiples() {
|
||||
return VulcanSettings.bufferMultipliers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getHotbarShuffle() {
|
||||
return VulcanSettings.hotbarShuffleEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getHotbarShuffleMinimums() {
|
||||
return VulcanSettings.minimumShuffleViolations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getHotbarShuffleIntervals() {
|
||||
return VulcanSettings.shuffleIntervals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getRandomRotation() {
|
||||
return VulcanSettings.randomRotationEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getRandomRotationMinimums() {
|
||||
return VulcanSettings.minimumRotationViolations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getRandomRotationIntervals() {
|
||||
return VulcanSettings.rotationIntervals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getChecks(Player player2) {
|
||||
PlayerData playerData2 = (PlayerData) this.getPlayerData(player2);
|
||||
return playerData2.getChecks().stream().map(VulcanSpigotAPI::asCheck).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleAlerts(Player player2) {
|
||||
PluginServices.INSTANCE.getAlertManager().toggleAlerts(player2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleVerbose(Player player2) {
|
||||
PluginServices.INSTANCE.getAlertManager().toggleVerbose(player2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flag(Player player2, String text, String text2, String text3) {
|
||||
AlertManager alertManager = PluginServices.INSTANCE.getAlertManager();
|
||||
alertManager.sendApiAlert(player2, text, text2, text3);
|
||||
}
|
||||
|
||||
private static Check asCheck(AbstractCheck abstractCheck2) {
|
||||
return (Check) abstractCheck2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package me.frep.vulcan.spigot.bukkit;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.Callable;
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
public class AdvancedBarChart extends CustomChart {
|
||||
|
||||
private final Callable<?> callable;
|
||||
|
||||
private static final String text = "values";
|
||||
|
||||
public AdvancedBarChart(String text2, Callable<?> callable2) {
|
||||
super(text2);
|
||||
this.callable = callable2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObject getValue() throws Exception {
|
||||
Map<?, ?> map;
|
||||
JsonObject jsonObject;
|
||||
JsonObject jsonObject2;
|
||||
jsonObject2 = new JsonObject();
|
||||
jsonObject = new JsonObject();
|
||||
map = (Map<?, ?>) this.callable.call();
|
||||
if ((map == null)) {
|
||||
return null;
|
||||
}
|
||||
if ((map.isEmpty())) {
|
||||
return null;
|
||||
}
|
||||
boolean condition = true;
|
||||
for (Map.Entry<?, ?> entry : map.entrySet()) {
|
||||
if (((int[]) entry.getValue()).length == 0) {
|
||||
continue;
|
||||
}
|
||||
condition = false;
|
||||
JsonArray jsonArray = new JsonArray();
|
||||
for (int index : (int[]) entry.getValue()) {
|
||||
jsonArray.add((JsonElement) new JsonPrimitive((Number) index));
|
||||
}
|
||||
jsonObject.add((String) entry.getKey(), (JsonElement) jsonArray);
|
||||
}
|
||||
if (condition) {
|
||||
return null;
|
||||
}
|
||||
jsonObject2.add(text, (JsonElement) jsonObject);
|
||||
return jsonObject2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package me.frep.vulcan.spigot.bukkit;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.Callable;
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
public class AdvancedPie extends CustomChart {
|
||||
|
||||
private final Callable<?> callable;
|
||||
|
||||
private static final String text = "values";
|
||||
|
||||
public AdvancedPie(String text2, Callable<?> callable2) {
|
||||
super(text2);
|
||||
this.callable = callable2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObject getValue() throws Exception {
|
||||
Map<?, ?> map;
|
||||
JsonObject jsonObject;
|
||||
JsonObject jsonObject2;
|
||||
jsonObject2 = new JsonObject();
|
||||
jsonObject = new JsonObject();
|
||||
map = (Map<?, ?>) this.callable.call();
|
||||
if ((map == null)) {
|
||||
return null;
|
||||
}
|
||||
if ((map.isEmpty())) {
|
||||
return null;
|
||||
}
|
||||
boolean condition = true;
|
||||
for (Map.Entry<?, ?> entry : map.entrySet()) {
|
||||
if ((Integer) entry.getValue() == 0) {
|
||||
continue;
|
||||
}
|
||||
condition = false;
|
||||
jsonObject.addProperty((String) entry.getKey(), (Number) entry.getValue());
|
||||
}
|
||||
if (condition) {
|
||||
return null;
|
||||
}
|
||||
jsonObject2.add(text, (JsonElement) jsonObject);
|
||||
return jsonObject2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package me.frep.vulcan.spigot.bukkit;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
public abstract class CustomChart {
|
||||
|
||||
final public String text;
|
||||
|
||||
CustomChart(String text2) {
|
||||
if (!(text2 != null && !text2.isEmpty())) {
|
||||
throw new IllegalArgumentException("ChartId cannot be null or empty!");
|
||||
}
|
||||
this.text = text2;
|
||||
}
|
||||
|
||||
private JsonObject getChartData() {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("chartId", this.text);
|
||||
try {
|
||||
JsonObject data = this.getValue();
|
||||
if (data == null)
|
||||
return null;
|
||||
jsonObject.add("data", data);
|
||||
return jsonObject;
|
||||
} catch (Exception ex) {
|
||||
java.util.logging.Logger.getLogger(CustomChart.class.getName()).log(java.util.logging.Level.WARNING, "Cannot collect chart: " + text, ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract JsonObject getValue() throws Exception;
|
||||
|
||||
static JsonObject getValue(CustomChart customChart) {
|
||||
return customChart.getChartData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package me.frep.vulcan.spigot.bukkit;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.Callable;
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
public class DrilldownPie extends CustomChart {
|
||||
|
||||
private final Callable<?> callable;
|
||||
|
||||
private static final String text = "values";
|
||||
|
||||
public DrilldownPie(String text2, Callable<?> callable2) {
|
||||
super(text2);
|
||||
this.callable = callable2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject getValue() throws Exception {
|
||||
Map<?, ?> map;
|
||||
JsonObject jsonObject;
|
||||
JsonObject jsonObject2;
|
||||
jsonObject2 = new JsonObject();
|
||||
jsonObject = new JsonObject();
|
||||
map = (Map<?, ?>) this.callable.call();
|
||||
if ((map == null)) {
|
||||
return null;
|
||||
}
|
||||
if ((map.isEmpty())) {
|
||||
return null;
|
||||
}
|
||||
boolean condition = true;
|
||||
for (Map.Entry<?, ?> entry : map.entrySet()) {
|
||||
JsonObject jsonObject3 = new JsonObject();
|
||||
boolean condition2 = true;
|
||||
for (Map.Entry<?, ?> entry2 : ((Map<?, ?>) map.get(entry.getKey())).entrySet()) {
|
||||
jsonObject3.addProperty((String) entry2.getKey(), (Number) entry2.getValue());
|
||||
condition2 = false;
|
||||
}
|
||||
if (condition2)
|
||||
continue;
|
||||
condition = false;
|
||||
jsonObject.add((String) entry.getKey(), (JsonElement) jsonObject3);
|
||||
}
|
||||
if (condition) {
|
||||
return null;
|
||||
}
|
||||
jsonObject2.add(text, (JsonElement) jsonObject);
|
||||
return jsonObject2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package me.frep.vulcan.spigot.bukkit;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
|
||||
public class Metrics {
|
||||
|
||||
public static final int B_STATS_VERSION = 1;
|
||||
|
||||
private static final String SUBMISSION_URL = "https://bStats.org/submitData/bukkit";
|
||||
|
||||
private final Plugin plugin;
|
||||
|
||||
private final int pluginId;
|
||||
|
||||
private final List<CustomChart> charts = new ArrayList<>();
|
||||
|
||||
private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(task -> {
|
||||
Thread thread = new Thread(task, "bStats-Metrics");
|
||||
thread.setDaemon(true);
|
||||
return thread;
|
||||
});
|
||||
|
||||
private final boolean enabled;
|
||||
|
||||
private final boolean logFailedRequests;
|
||||
|
||||
private final boolean logSentData;
|
||||
|
||||
private final boolean logResponseStatusText;
|
||||
|
||||
private final String serverUUID;
|
||||
|
||||
public Metrics(Plugin plugin, int pluginId) {
|
||||
if (plugin == null)
|
||||
throw new IllegalArgumentException("Plugin cannot be null!");
|
||||
this.plugin = plugin;
|
||||
this.pluginId = pluginId;
|
||||
File file = new File(new File(plugin.getDataFolder().getParentFile(), "bStats"), "config.yml");
|
||||
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(file);
|
||||
if (!configuration.isSet("serverUuid")) {
|
||||
configuration.addDefault("enabled", true);
|
||||
configuration.addDefault("serverUuid", UUID.randomUUID().toString());
|
||||
configuration.addDefault("logFailedRequests", false);
|
||||
configuration.addDefault("logSentData", false);
|
||||
configuration.addDefault("logResponseStatusText", false);
|
||||
configuration.options().copyDefaults(true);
|
||||
try {
|
||||
configuration.save(file);
|
||||
} catch (IOException failure) {
|
||||
plugin.getLogger().warning("Cannot save bStats configuration: " + failure.getMessage());
|
||||
}
|
||||
}
|
||||
enabled = configuration.getBoolean("enabled", true);
|
||||
serverUUID = configuration.getString("serverUuid");
|
||||
logFailedRequests = configuration.getBoolean("logFailedRequests", false);
|
||||
logSentData = configuration.getBoolean("logSentData", false);
|
||||
logResponseStatusText = configuration.getBoolean("logResponseStatusText", false);
|
||||
if (enabled) {
|
||||
boolean alreadyRegistered = false;
|
||||
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
|
||||
try {
|
||||
service.getField("B_STATS_VERSION");
|
||||
alreadyRegistered = true;
|
||||
break;
|
||||
} catch (NoSuchFieldException absent) {
|
||||
}
|
||||
}
|
||||
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
|
||||
if (!alreadyRegistered)
|
||||
startSubmitting();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void addCustomChart(CustomChart chart) {
|
||||
if (chart == null)
|
||||
throw new IllegalArgumentException("Chart cannot be null!");
|
||||
charts.add(chart);
|
||||
}
|
||||
|
||||
private void startSubmitting() {
|
||||
long initialDelay = (long) (60000.0 * (3.0 + Math.random() * 3.0));
|
||||
long secondDelay = (long) (60000.0 * Math.random() * 30.0);
|
||||
scheduler.schedule(this::scheduleSubmission, initialDelay, TimeUnit.MILLISECONDS);
|
||||
scheduler.scheduleAtFixedRate(this::scheduleSubmission, initialDelay + secondDelay, 1800000L, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
private void scheduleSubmission() {
|
||||
if (!plugin.isEnabled()) {
|
||||
scheduler.shutdown();
|
||||
return;
|
||||
}
|
||||
me.frep.vulcan.spigot.lifecycle.PluginServices.INSTANCE.getScheduler().execute(this::submitData);
|
||||
}
|
||||
|
||||
public JsonObject getPluginData() {
|
||||
JsonObject data = new JsonObject();
|
||||
data.addProperty("pluginName", plugin.getDescription().getName());
|
||||
data.addProperty("id", pluginId);
|
||||
data.addProperty("pluginVersion", plugin.getDescription().getVersion());
|
||||
JsonArray customCharts = new JsonArray();
|
||||
for (CustomChart chart : charts) {
|
||||
JsonObject value = CustomChart.getValue(chart);
|
||||
if (value != null)
|
||||
customCharts.add(value);
|
||||
}
|
||||
data.add("customCharts", customCharts);
|
||||
return data;
|
||||
}
|
||||
|
||||
private JsonObject getServerData() {
|
||||
JsonObject data = new JsonObject();
|
||||
data.addProperty("serverUUID", serverUUID);
|
||||
data.addProperty("playerAmount", Bukkit.getOnlinePlayers().size());
|
||||
data.addProperty("onlineMode", Bukkit.getOnlineMode() ? 1 : 0);
|
||||
data.addProperty("bukkitVersion", Bukkit.getVersion());
|
||||
data.addProperty("bukkitName", Bukkit.getName());
|
||||
data.addProperty("javaVersion", System.getProperty("java.version"));
|
||||
data.addProperty("osName", System.getProperty("os.name"));
|
||||
data.addProperty("osArch", System.getProperty("os.arch"));
|
||||
data.addProperty("osVersion", System.getProperty("os.version"));
|
||||
data.addProperty("coreCount", Runtime.getRuntime().availableProcessors());
|
||||
return data;
|
||||
}
|
||||
|
||||
private void submitData() {
|
||||
JsonObject data = getServerData();
|
||||
JsonArray plugins = new JsonArray();
|
||||
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
|
||||
try {
|
||||
service.getField("B_STATS_VERSION");
|
||||
for (RegisteredServiceProvider<?> registration : Bukkit.getServicesManager().getRegistrations(service)) {
|
||||
Object value = service.getMethod("getPluginData").invoke(registration.getProvider());
|
||||
if (value != null)
|
||||
plugins.add(JsonParser.parseString(value.toString()).getAsJsonObject());
|
||||
}
|
||||
} catch (ReflectiveOperationException | IllegalArgumentException failure) {
|
||||
if (logFailedRequests)
|
||||
plugin.getLogger().warning("Cannot collect metrics for " + service.getName() + ": " + failure.getMessage());
|
||||
}
|
||||
}
|
||||
data.add("plugins", plugins);
|
||||
scheduler.execute(() -> {
|
||||
try {
|
||||
sendData(data);
|
||||
} catch (IOException failure) {
|
||||
if (logFailedRequests)
|
||||
plugin.getLogger().warning("Cannot submit bStats metrics: " + failure.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendData(JsonObject data) throws IOException {
|
||||
if (Bukkit.isPrimaryThread())
|
||||
throw new IllegalStateException("Metrics submission must run asynchronously");
|
||||
if (logSentData)
|
||||
plugin.getLogger().info("Sending data to bStats: " + data);
|
||||
byte[] compressed = compress(data.toString());
|
||||
HttpsURLConnection connection = (HttpsURLConnection) new URL(SUBMISSION_URL).openConnection();
|
||||
connection.setConnectTimeout(10000);
|
||||
connection.setReadTimeout(10000);
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setRequestProperty("Content-Encoding", "gzip");
|
||||
connection.setRequestProperty("User-Agent", "MC-Server/1");
|
||||
connection.setFixedLengthStreamingMode(compressed.length);
|
||||
connection.setDoOutput(true);
|
||||
try {
|
||||
try (var output = connection.getOutputStream()) {
|
||||
output.write(compressed);
|
||||
}
|
||||
try (var input = connection.getInputStream()) {
|
||||
String response = new String(input.readAllBytes(), StandardCharsets.UTF_8);
|
||||
if (logResponseStatusText)
|
||||
plugin.getLogger().info("bStats response: " + response);
|
||||
}
|
||||
} finally {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] compress(String text) throws IOException {
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
try (GZIPOutputStream gzip = new GZIPOutputStream(bytes)) {
|
||||
gzip.write(text.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
return bytes.toByteArray();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package me.frep.vulcan.spigot.bukkit;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.Callable;
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
public class MultiLineChart extends CustomChart {
|
||||
|
||||
private final Callable<?> callable;
|
||||
|
||||
private static final String text = "values";
|
||||
|
||||
public MultiLineChart(String text2, Callable<?> callable2) {
|
||||
super(text2);
|
||||
this.callable = callable2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObject getValue() throws Exception {
|
||||
Map<?, ?> map;
|
||||
JsonObject jsonObject;
|
||||
JsonObject jsonObject2;
|
||||
jsonObject2 = new JsonObject();
|
||||
jsonObject = new JsonObject();
|
||||
map = (Map<?, ?>) this.callable.call();
|
||||
if ((map == null)) {
|
||||
return null;
|
||||
}
|
||||
if ((map.isEmpty())) {
|
||||
return null;
|
||||
}
|
||||
boolean condition = true;
|
||||
for (Map.Entry<?, ?> entry : map.entrySet()) {
|
||||
if ((Integer) entry.getValue() == 0) {
|
||||
continue;
|
||||
}
|
||||
condition = false;
|
||||
jsonObject.addProperty((String) entry.getKey(), (Number) entry.getValue());
|
||||
}
|
||||
if (condition) {
|
||||
return null;
|
||||
}
|
||||
jsonObject2.add(text, (JsonElement) jsonObject);
|
||||
return jsonObject2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package me.frep.vulcan.spigot.bukkit;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.Callable;
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
public class SimpleBarChart extends CustomChart {
|
||||
|
||||
private final Callable<?> callable;
|
||||
|
||||
private static final String text = "values";
|
||||
|
||||
public SimpleBarChart(String text2, Callable<?> callable2) {
|
||||
super(text2);
|
||||
this.callable = callable2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObject getValue() throws Exception {
|
||||
Map<?, ?> map;
|
||||
JsonObject jsonObject;
|
||||
JsonObject jsonObject2;
|
||||
jsonObject2 = new JsonObject();
|
||||
jsonObject = new JsonObject();
|
||||
map = (Map<?, ?>) this.callable.call();
|
||||
if ((map == null)) {
|
||||
return null;
|
||||
}
|
||||
if ((map.isEmpty())) {
|
||||
return null;
|
||||
}
|
||||
for (Map.Entry<?, ?> entry : map.entrySet()) {
|
||||
JsonArray jsonArray = new JsonArray();
|
||||
jsonArray.add((JsonElement) new JsonPrimitive((Number) entry.getValue()));
|
||||
jsonObject.add((String) entry.getKey(), (JsonElement) jsonArray);
|
||||
}
|
||||
jsonObject2.add(text, (JsonElement) jsonObject);
|
||||
return jsonObject2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package me.frep.vulcan.spigot.bukkit;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class SimplePie extends CustomChart {
|
||||
|
||||
private final Callable<?> callable;
|
||||
|
||||
private static final String text = "value";
|
||||
|
||||
public SimplePie(String text2, Callable<?> callable2) {
|
||||
super(text2);
|
||||
this.callable = callable2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObject getValue() throws Exception {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
String text2 = (String) this.callable.call();
|
||||
if (text2 == null) {
|
||||
return null;
|
||||
}
|
||||
if (text2.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
jsonObject.addProperty(text, text2);
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package me.frep.vulcan.spigot.bukkit;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class SingleLineChart extends CustomChart {
|
||||
|
||||
private final Callable<?> callable;
|
||||
|
||||
private static final String text = "value";
|
||||
|
||||
public SingleLineChart(String text2, Callable<?> callable2) {
|
||||
super(text2);
|
||||
this.callable = callable2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObject getValue() throws Exception {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
int index = (Integer) this.callable.call();
|
||||
if (index == 0) {
|
||||
return null;
|
||||
}
|
||||
jsonObject.addProperty(text, index);
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,412 @@
|
||||
package me.frep.vulcan.spigot.check;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;
|
||||
import com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType.Play.Client;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType.Play.Server;
|
||||
import java.util.Objects;
|
||||
import me.frep.vulcan.api.check.Check;
|
||||
import me.frep.vulcan.api.event.VulcanSetbackEvent;
|
||||
import me.frep.vulcan.spigot.alert.AlertManager;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.configuration.CheckUtils;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptionManager;
|
||||
import me.frep.vulcan.spigot.config.VulcanSettings;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.punishment.PunishmentHandler;
|
||||
import me.frep.vulcan.spigot.task.TickProcessor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
public abstract class AbstractCheck implements Check {
|
||||
|
||||
protected final PlayerData playerData;
|
||||
|
||||
private int violations;
|
||||
|
||||
private double buffer;
|
||||
|
||||
public final String checkName;
|
||||
|
||||
public final double maximumBuffer;
|
||||
|
||||
public final double bufferDecay;
|
||||
|
||||
public final double bufferMultiplier;
|
||||
|
||||
public AbstractCheck(PlayerData playerData2) {
|
||||
this.checkName = this.getClass().getSimpleName();
|
||||
this.maximumBuffer = ((Integer) VulcanSettings.maximumBuffers.get(this.checkName)).intValue();
|
||||
this.bufferDecay = (Double) VulcanSettings.bufferDecays.get(this.checkName);
|
||||
this.bufferMultiplier = (Double) VulcanSettings.bufferMultipliers.get(this.checkName);
|
||||
this.playerData = playerData2;
|
||||
}
|
||||
|
||||
public void fail(Object value) {
|
||||
Object value2 = value;
|
||||
if (this.playerData.getPlayer() == null) {
|
||||
return;
|
||||
}
|
||||
if ((((Boolean) VulcanSettings.setbackEnabled.get(this.getCheckKey())).booleanValue()) && (this.getVl() > (Integer) VulcanSettings.minimumSetbackViolations.get(this.getCheckKey()))) {
|
||||
if (VulcanSettings.settingsEnableApi) {
|
||||
VulcanSetbackEvent vulcanSetbackEvent = new VulcanSetbackEvent(this.playerData.getPlayer(), this);
|
||||
Bukkit.getPluginManager().callEvent((Event) vulcanSetbackEvent);
|
||||
if (!vulcanSetbackEvent.isCancelled()) {
|
||||
this.playerData.getCollisionState().requestSetback();
|
||||
}
|
||||
} else if (!this.playerData.getPlayer().hasPermission("vulcan.bypass.setback." + this.getCheckKey().toLowerCase())) {
|
||||
this.playerData.getCollisionState().requestSetback();
|
||||
}
|
||||
}
|
||||
this.applyConfiguredMitigation();
|
||||
this.applyConfiguredCommands();
|
||||
this.multiplyBuffer(this.bufferMultiplier);
|
||||
PluginServices.INSTANCE.getViolationExecutor().execute(() -> this.reportViolationWithDetails(value2));
|
||||
}
|
||||
|
||||
public void fail() {
|
||||
if (this.playerData.getPlayer() == null) {
|
||||
return;
|
||||
}
|
||||
if ((((Boolean) VulcanSettings.setbackEnabled.get(this.getCheckKey())).booleanValue()) && (this.getVl() > (Integer) VulcanSettings.minimumSetbackViolations.get(this.getCheckKey()))) {
|
||||
if (VulcanSettings.settingsEnableApi) {
|
||||
VulcanSetbackEvent vulcanSetbackEvent = new VulcanSetbackEvent(this.playerData.getPlayer(), this);
|
||||
Bukkit.getPluginManager().callEvent((Event) vulcanSetbackEvent);
|
||||
if (!vulcanSetbackEvent.isCancelled()) {
|
||||
this.playerData.getCollisionState().requestSetback();
|
||||
}
|
||||
} else if (!this.playerData.getPlayer().hasPermission("vulcan.bypass.setback." + this.getCheckKey().toLowerCase())) {
|
||||
this.playerData.getCollisionState().requestSetback();
|
||||
}
|
||||
}
|
||||
this.applyConfiguredMitigation();
|
||||
this.applyConfiguredCommands();
|
||||
this.multiplyBuffer(this.bufferMultiplier);
|
||||
PluginServices.INSTANCE.getViolationExecutor().execute(() -> this.reportViolation());
|
||||
}
|
||||
|
||||
public void update() {
|
||||
PluginServices.INSTANCE.getViolationExecutor().execute(() -> this.executePunishment());
|
||||
}
|
||||
|
||||
protected boolean isExempt(ExemptType[] exemptions) {
|
||||
return playerData.getPlayerToggles().isAnyExempt(exemptions);
|
||||
}
|
||||
|
||||
public int getCurrentTick() {
|
||||
TickProcessor tickProcessor = PluginServices.INSTANCE.getTickProcessor();
|
||||
return tickProcessor.getTotalTicks();
|
||||
}
|
||||
|
||||
public double increaseBuffer() {
|
||||
return this.buffer = Math.min(10000.0, this.buffer + 1.0);
|
||||
}
|
||||
|
||||
public double decreaseBuffer(double amount) {
|
||||
return this.buffer = Math.max(0.0, this.buffer - amount);
|
||||
}
|
||||
|
||||
public double increaseBuffer(double amount) {
|
||||
return this.buffer = Math.min(10000.0, this.buffer + amount);
|
||||
}
|
||||
|
||||
public void setBuffer() {
|
||||
this.buffer = 0.0;
|
||||
}
|
||||
|
||||
public void multiplyBuffer(double amount) {
|
||||
this.buffer *= amount;
|
||||
}
|
||||
|
||||
public void decayBuffer() {
|
||||
this.decreaseBuffer(this.bufferDecay);
|
||||
}
|
||||
|
||||
public int getAttackTicks() {
|
||||
return this.playerData.getRelativeMoveTracker().getTicksSinceAttack();
|
||||
}
|
||||
|
||||
public boolean hasRecentAttack(int ticks) {
|
||||
if (this.playerData.getRelativeMoveTracker().getTicksSinceAttack() < ticks && this.playerData.getRelativeMoveTracker().getTicksSinceAttackGiven() < ticks * 6) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public CheckInfo getCheck() {
|
||||
CheckInfo info = getClass().getAnnotation(CheckInfo.class);
|
||||
if (info == null)
|
||||
throw new IllegalStateException("Missing CheckInfo on " + checkName);
|
||||
return info;
|
||||
}
|
||||
|
||||
public void debug(Object value) {
|
||||
ExemptionManager.debug(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCategory() {
|
||||
String packageName = getClass().getPackageName();
|
||||
if (packageName.contains(".combat."))
|
||||
return "combat";
|
||||
if (packageName.contains(".movement."))
|
||||
return "movement";
|
||||
if (packageName.contains(".player."))
|
||||
return "player";
|
||||
throw new IllegalStateException("Unknown check category: " + packageName);
|
||||
}
|
||||
|
||||
public boolean isTeleporting() {
|
||||
return this.playerData.getMotionState().isTeleporting();
|
||||
}
|
||||
|
||||
public boolean isSetbackPending() {
|
||||
return this.playerData.getCollisionState().isSetbackPending();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.getCheck().name().toLowerCase().replaceAll(" ", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getType() {
|
||||
return Character.toLowerCase(this.getCheck().type());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVl() {
|
||||
return this.violations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVl() {
|
||||
return (Integer) VulcanSettings.maximumViolations.get(this.checkName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumVlToNotify() {
|
||||
return (Integer) VulcanSettings.minimumAlertViolations.get(this.checkName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxBuffer() {
|
||||
return this.maximumBuffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.getCheck().description();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComplexType() {
|
||||
return this.getCheck().complexType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBufferDecay() {
|
||||
return this.bufferDecay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAlertInterval() {
|
||||
return (Integer) VulcanSettings.alertIntervals.get(this.checkName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBufferMultiple() {
|
||||
return this.bufferMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExperimental() {
|
||||
return this.getCheck().experimental();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPunishable() {
|
||||
return (Boolean) VulcanSettings.checkPunishable.get(this.checkName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return this.getCheck().name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getDisplayType() {
|
||||
return this.getCheck().type();
|
||||
}
|
||||
|
||||
public void applyConfiguredMitigation() {
|
||||
if (this.playerData != null) {
|
||||
PlayerData playerData2 = this.playerData;
|
||||
if (playerData2.getPlayer() != null) {
|
||||
boolean condition = (Boolean) VulcanSettings.hotbarShuffleEnabled.get(this.checkName);
|
||||
int index = (Integer) VulcanSettings.minimumShuffleViolations.get(this.checkName);
|
||||
int index2 = (Integer) VulcanSettings.shuffleIntervals.get(this.checkName);
|
||||
if (condition && this.violations >= index && this.violations % index2 == 0) {
|
||||
playerData2 = this.playerData;
|
||||
CheckUtils.sendHotbarShuffle(playerData2.getPlayer());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void applyConfiguredCommands() {
|
||||
if (this.playerData.getPlayer() != null) {
|
||||
boolean condition = (Boolean) VulcanSettings.randomRotationEnabled.get(this.checkName);
|
||||
int index = (Integer) VulcanSettings.minimumRotationViolations.get(this.checkName);
|
||||
int index2 = (Integer) VulcanSettings.rotationIntervals.get(this.checkName);
|
||||
if (condition && this.violations >= index && this.violations % index2 == 0) {
|
||||
CheckUtils.rotatePlayerRandomly(this.playerData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRotationUpdatePacket(PacketEvent packetEvent) {
|
||||
return !(packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent) ? false : packetPlayReceiveEvent.getPacketType() == Client.PLAYER_ROTATION || packetPlayReceiveEvent.getPacketType() == Client.PLAYER_POSITION_AND_ROTATION;
|
||||
}
|
||||
|
||||
public boolean isAttackPacket(PacketEvent event) {
|
||||
return event instanceof PacketPlayReceiveEvent packet && (packet.getPacketType() == Client.INTERACT_ENTITY || packet.getPacketType() == Client.ATTACK);
|
||||
}
|
||||
|
||||
public boolean isMovementPacket(PacketEvent packetEvent) {
|
||||
return !(packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent) ? false : packetPlayReceiveEvent.getPacketType() == Client.PLAYER_FLYING || packetPlayReceiveEvent.getPacketType() == Client.PLAYER_POSITION || packetPlayReceiveEvent.getPacketType() == Client.PLAYER_ROTATION || packetPlayReceiveEvent.getPacketType() == Client.PLAYER_POSITION_AND_ROTATION;
|
||||
}
|
||||
|
||||
public boolean isBlockPlacementPacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.PLAYER_BLOCK_PLACEMENT : false;
|
||||
}
|
||||
|
||||
public boolean isUseItemPacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.USE_ITEM : false;
|
||||
}
|
||||
|
||||
public boolean isPositionUpdatePacket(PacketEvent packetEvent) {
|
||||
if (!(packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent)) {
|
||||
return false;
|
||||
}
|
||||
Client packetType = packetPlayReceiveEvent.getPacketType();
|
||||
return packetType == Client.PLAYER_POSITION || packetType == Client.PLAYER_POSITION_AND_ROTATION;
|
||||
}
|
||||
|
||||
public boolean isArmAnimationPacket(PacketEvent packetEvent) {
|
||||
return !(packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent) ? false : packetPlayReceiveEvent.getPacketType() == Client.ANIMATION || packetPlayReceiveEvent.getPacketType() == Client.PUNCH;
|
||||
}
|
||||
|
||||
public boolean isVehicleMovePacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.VEHICLE_MOVE : false;
|
||||
}
|
||||
|
||||
public boolean isEntityActionPacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.ENTITY_ACTION : false;
|
||||
}
|
||||
|
||||
public boolean isDiggingPacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.PLAYER_DIGGING : false;
|
||||
}
|
||||
|
||||
public boolean isAbilitiesPacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.PLAYER_ABILITIES : false;
|
||||
}
|
||||
|
||||
public boolean isSteerVehiclePacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.STEER_VEHICLE : false;
|
||||
}
|
||||
|
||||
public boolean isClientStatusPacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.CLIENT_STATUS : false;
|
||||
}
|
||||
|
||||
public boolean isHeldItemChangePacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.HELD_ITEM_CHANGE : false;
|
||||
}
|
||||
|
||||
public boolean isKeepAlivePacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.KEEP_ALIVE : false;
|
||||
}
|
||||
|
||||
public boolean isClickWindowPacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.CLICK_WINDOW : false;
|
||||
}
|
||||
|
||||
public boolean isSpectatePacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.SPECTATE : false;
|
||||
}
|
||||
|
||||
public boolean isServerPositionPacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlaySendEvent packetPlaySendEvent ? packetPlaySendEvent.getPacketType() == Server.PLAYER_POSITION_AND_LOOK : false;
|
||||
}
|
||||
|
||||
public boolean isClientTickEndPacket(PacketEvent packetEvent) {
|
||||
return packetEvent instanceof PacketPlayReceiveEvent packetPlayReceiveEvent ? packetPlayReceiveEvent.getPacketType() == Client.CLIENT_TICK_END : false;
|
||||
}
|
||||
|
||||
public PlayerData getPlayerData() {
|
||||
return this.playerData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBuffer() {
|
||||
return this.buffer;
|
||||
}
|
||||
|
||||
public String getCheckKey() {
|
||||
return this.checkName;
|
||||
}
|
||||
|
||||
public double getBufferThreshold() {
|
||||
return this.maximumBuffer;
|
||||
}
|
||||
|
||||
public double getConfiguredBufferDecay() {
|
||||
return this.bufferDecay;
|
||||
}
|
||||
|
||||
public double getConfiguredBufferMultiplier() {
|
||||
return this.bufferMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVl(int violations2) {
|
||||
this.violations = violations2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuffer(double buffer2) {
|
||||
this.buffer = buffer2;
|
||||
}
|
||||
|
||||
private void executePunishment() {
|
||||
PunishmentHandler punishmentHandler = PluginServices.INSTANCE.getPunishmentHandler();
|
||||
punishmentHandler.punish(this, this.playerData);
|
||||
}
|
||||
|
||||
private void reportViolation() {
|
||||
AlertManager alertManager = PluginServices.INSTANCE.getAlertManager();
|
||||
alertManager.processViolation(this, this.playerData, "");
|
||||
}
|
||||
|
||||
private void reportViolationWithDetails(Object value) {
|
||||
AlertManager alertManager = PluginServices.INSTANCE.getAlertManager();
|
||||
alertManager.processViolation(this, this.playerData, Objects.toString(value));
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent event) {
|
||||
}
|
||||
|
||||
public void handleEvent(org.bukkit.event.Event event) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package me.frep.vulcan.spigot.check;
|
||||
|
||||
import java.util.List;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.data.CheckData;
|
||||
import me.frep.vulcan.spigot.check.manager.CheckManager;
|
||||
import me.frep.vulcan.spigot.config.VulcanSettings;
|
||||
|
||||
public final class CheckSettingsLoader {
|
||||
|
||||
public static void clearCheckSettings() {
|
||||
VulcanSettings.checkDataByName.clear();
|
||||
VulcanSettings.checkEnabled.clear();
|
||||
VulcanSettings.maximumViolations.clear();
|
||||
VulcanSettings.alertIntervals.clear();
|
||||
VulcanSettings.minimumAlertViolations.clear();
|
||||
VulcanSettings.punishmentCommands.clear();
|
||||
VulcanSettings.checkPunishable.clear();
|
||||
VulcanSettings.broadcastPunishments.clear();
|
||||
VulcanSettings.setbackEnabled.clear();
|
||||
VulcanSettings.maximumBuffers.clear();
|
||||
VulcanSettings.bufferDecays.clear();
|
||||
VulcanSettings.bufferMultipliers.clear();
|
||||
VulcanSettings.hotbarShuffleEnabled.clear();
|
||||
VulcanSettings.minimumShuffleViolations.clear();
|
||||
VulcanSettings.shuffleIntervals.clear();
|
||||
VulcanSettings.randomRotationEnabled.clear();
|
||||
VulcanSettings.minimumRotationViolations.clear();
|
||||
VulcanSettings.rotationIntervals.clear();
|
||||
VulcanSettings.discordAlertIntervals.clear();
|
||||
VulcanSettings.minimumSetbackViolations.clear();
|
||||
}
|
||||
|
||||
public static void loadCheckSettings() {
|
||||
Class<?>[] checkTypes = CheckManager.checkTypes;
|
||||
int checkCount = checkTypes.length;
|
||||
for (int checkIndex = 0; checkIndex < checkCount; ++checkIndex) {
|
||||
Class<?> checkType = checkTypes[checkIndex];
|
||||
CheckInfo information = checkType.getAnnotation(CheckInfo.class);
|
||||
String category = "";
|
||||
if (checkType.getName().contains("combat")) {
|
||||
category = "combat";
|
||||
} else if (checkType.getName().contains("movement")) {
|
||||
category = "movement";
|
||||
} else if (checkType.getName().contains("player")) {
|
||||
category = "player";
|
||||
}
|
||||
String checkName = information.name().replaceAll(" ", "").toLowerCase();
|
||||
char checkVariant = Character.toLowerCase(information.type());
|
||||
String path = "checks." + category + "." + checkName + "." + checkVariant + ".";
|
||||
boolean enabled = VulcanSettings.getBoolean(path + "enabled");
|
||||
int maximumViolations = VulcanSettings.getInt(path + "max-violations");
|
||||
int minimumAlertViolations = VulcanSettings.getInt(path + "dont-alert-until");
|
||||
int alertInterval = VulcanSettings.getInt(path + "alert-interval");
|
||||
int maximumPing = VulcanSettings.getInt(path + "maximum-ping");
|
||||
double minimumTps = VulcanSettings.getDouble(path + "minimum-tps");
|
||||
List<String> punishmentCommands = VulcanSettings.getStringList(path + "punishment-commands");
|
||||
boolean punishable = VulcanSettings.getBoolean(path + "punishable");
|
||||
boolean broadcastPunishment = VulcanSettings.getBoolean(path + "broadcast-punishment");
|
||||
boolean setback = VulcanSettings.getBoolean(path + "setback");
|
||||
int discordAlertInterval = VulcanSettings.getInt(path + "discord-alert-interval");
|
||||
int minimumSetbackViolations = VulcanSettings.getInt(path + "min-vl-to-setback");
|
||||
VulcanSettings.checkEnabled.put(checkType.getSimpleName(), enabled);
|
||||
VulcanSettings.maximumViolations.put(checkType.getSimpleName(), maximumViolations);
|
||||
VulcanSettings.minimumAlertViolations.put(checkType.getSimpleName(), minimumAlertViolations);
|
||||
VulcanSettings.alertIntervals.put(checkType.getSimpleName(), alertInterval);
|
||||
VulcanSettings.maximumPing.put(checkType.getSimpleName(), maximumPing);
|
||||
VulcanSettings.minimumTps.put(checkType.getSimpleName(), minimumTps);
|
||||
VulcanSettings.punishmentCommands.put(checkType.getSimpleName(), punishmentCommands);
|
||||
VulcanSettings.checkPunishable.put(checkType.getSimpleName(), punishable);
|
||||
VulcanSettings.broadcastPunishments.put(checkType.getSimpleName(), broadcastPunishment);
|
||||
VulcanSettings.setbackEnabled.put(checkType.getSimpleName(), setback);
|
||||
VulcanSettings.discordAlertIntervals.put(checkType.getSimpleName(), discordAlertInterval);
|
||||
VulcanSettings.minimumSetbackViolations.put(checkType.getSimpleName(), minimumSetbackViolations);
|
||||
int maximumBuffer = VulcanSettings.getInt(path + "buffer.max");
|
||||
double bufferMultiplier = VulcanSettings.getDouble(path + "buffer.multiple");
|
||||
double bufferDecay = VulcanSettings.getDouble(path + "buffer.decay");
|
||||
VulcanSettings.maximumBuffers.put(checkType.getSimpleName(), maximumBuffer);
|
||||
VulcanSettings.bufferMultipliers.put(checkType.getSimpleName(), bufferMultiplier);
|
||||
VulcanSettings.bufferDecays.put(checkType.getSimpleName(), bufferDecay);
|
||||
boolean hotbarShuffle = VulcanSettings.getBoolean(path + "hotbar-shuffle.enabled");
|
||||
int minimumShuffleViolations = VulcanSettings.getInt(path + "hotbar-shuffle.minimum-vl-to-shuffle");
|
||||
int shuffleInterval = VulcanSettings.getInt(path + "hotbar-shuffle.shuffle-every");
|
||||
VulcanSettings.hotbarShuffleEnabled.put(checkType.getSimpleName(), hotbarShuffle);
|
||||
VulcanSettings.minimumShuffleViolations.put(checkType.getSimpleName(), minimumShuffleViolations);
|
||||
VulcanSettings.shuffleIntervals.put(checkType.getSimpleName(), shuffleInterval);
|
||||
boolean randomRotation = VulcanSettings.getBoolean(path + "random-rotation.enabled");
|
||||
int minimumRotationViolations = VulcanSettings.getInt(path + "random-rotation.minimum-vl-to-randomly-rotate");
|
||||
int rotationInterval = VulcanSettings.getInt(path + "random-rotation.rotate-every");
|
||||
VulcanSettings.randomRotationEnabled.put(checkType.getSimpleName(), randomRotation);
|
||||
VulcanSettings.minimumRotationViolations.put(checkType.getSimpleName(), minimumRotationViolations);
|
||||
VulcanSettings.rotationIntervals.put(checkType.getSimpleName(), rotationInterval);
|
||||
if (!VulcanSettings.settingsEnableApi)
|
||||
continue;
|
||||
CheckData checkData = new CheckData(checkType.getSimpleName());
|
||||
checkData.setEnabled(enabled);
|
||||
checkData.setPunishable(punishable);
|
||||
checkData.setBroadcastPunishment(broadcastPunishment);
|
||||
checkData.setHotbarShuffle(hotbarShuffle);
|
||||
checkData.setRandomRotation(randomRotation);
|
||||
checkData.setMaxViolations(maximumViolations);
|
||||
checkData.setAlertInterval(alertInterval);
|
||||
checkData.setMinimumVlToNotify(minimumAlertViolations);
|
||||
checkData.setMaxPing(maximumPing);
|
||||
checkData.setRandomRotationInterval(rotationInterval);
|
||||
checkData.setMinimumVlToRandomlyRotate(minimumRotationViolations);
|
||||
checkData.setMinimumVlToShuffleHotbar(minimumShuffleViolations);
|
||||
checkData.setHotbarShuffleInterval(shuffleInterval);
|
||||
checkData.setMinimumTps(minimumTps);
|
||||
checkData.setMaxBuffer((double) maximumBuffer);
|
||||
checkData.setBufferDecay(bufferDecay);
|
||||
checkData.setBufferMultiple(bufferMultiplier);
|
||||
checkData.setPunishmentCommands(punishmentCommands);
|
||||
VulcanSettings.checkDataByName.put(checkType.getSimpleName(), checkData);
|
||||
}
|
||||
}
|
||||
|
||||
private CheckSettingsLoader() {
|
||||
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package me.frep.vulcan.spigot.check.api;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface CheckInfo {
|
||||
|
||||
String name();
|
||||
|
||||
char type();
|
||||
|
||||
String complexType() default "N/A";
|
||||
|
||||
boolean experimental() default false;
|
||||
|
||||
boolean punish() default true;
|
||||
|
||||
String description() default "No description.";
|
||||
}
|
||||
@@ -0,0 +1,667 @@
|
||||
package me.frep.vulcan.spigot.check.configuration;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.manager.protocol.ProtocolManager;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerHeldItemChange;
|
||||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPing;
|
||||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerPositionAndLook;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptionManager;
|
||||
import me.frep.vulcan.spigot.data.PlayerDataStore;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.util.scheduling.MainThreadExecutor;
|
||||
import me.frep.vulcan.spigot.player.collision.CollisionState;
|
||||
import me.frep.vulcan.spigot.player.movement.MotionState;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
import me.frep.vulcan.spigot.world.block.BlockUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public final class CheckUtils {
|
||||
|
||||
public static int getPing(Player player2) {
|
||||
return PacketEvents.getAPI().getPlayerManager().getPing(player2);
|
||||
}
|
||||
|
||||
public static void sendPacket(PlayerData playerData3, PacketWrapper packetWrapper) {
|
||||
ProtocolManager protocolManager = PacketEvents.getAPI().getProtocolManager();
|
||||
protocolManager.sendPacket(playerData3.getUser().getChannel(), packetWrapper);
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_17(PlayerData data) {
|
||||
return data.getUser().getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_17);
|
||||
}
|
||||
|
||||
public static boolean isNewerThan1_9(PlayerData playerData3) {
|
||||
return playerData3.getUser().getClientVersion().isNewerThan(ClientVersion.V_1_9);
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_13(PlayerData playerData3) {
|
||||
return playerData3.getUser().getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_13);
|
||||
}
|
||||
|
||||
public static void sendPingPacket(PlayerData playerData3, int index) {
|
||||
sendPacket(playerData3, (PacketWrapper) new WrapperPlayServerPing(index));
|
||||
}
|
||||
|
||||
public static boolean isSwimming(PlayerData data) {
|
||||
return data.getPlayer() != null && ExemptionManager.isNewerThan1_13() && data.getPlayer().isSwimming();
|
||||
}
|
||||
|
||||
public static boolean isEnclosedInSolidBlocks(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterials() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterials().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if ((collisionState.getSurroundingMaterials().get(16)).isSolid()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if ((collisionState.getSurroundingMaterials().get(19)).isSolid()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEnclosedInSolidBlocksLegacy(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterialsLegacy() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterialsLegacy().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if ((collisionState.getSurroundingMaterialsLegacy().get(16)).isSolid()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if ((collisionState.getSurroundingMaterialsLegacy().get(19)).isSolid()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean touchesSolidBlocks(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterialsLegacy() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterialsLegacy().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!(collisionState.getSurroundingMaterialsLegacy().get(16)).isSolid()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!(collisionState.getSurroundingMaterialsLegacy().get(19)).isSolid()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasDolphinsGrace(PlayerData playerData3) {
|
||||
if (playerData3.getPlayer() == null) {
|
||||
return false;
|
||||
}
|
||||
if ((ExemptionManager.isNewerThan1_13()) && (playerData3.getPlayer().hasPotionEffect(PotionEffectType.DOLPHINS_GRACE))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean touchesBubbleColumn(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterials() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterials().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!BlockUtils.isBubbleColumn(collisionState.getSurroundingMaterials().get(16))) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!BlockUtils.isBubbleColumn(collisionState.getSurroundingMaterials().get(19))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static double getYawDifference(Player player2, Player player3) {
|
||||
return Math.abs(180.0F - Math.abs(player2.getLocation().getYaw() - player3.getLocation().getYaw()));
|
||||
}
|
||||
|
||||
public static List getFloorMaterials(PlayerData playerData3) {
|
||||
LinkedList linkedList = new LinkedList();
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
List packedMaterials = collisionState.getSurroundingMaterials();
|
||||
if (!(packedMaterials != null && !packedMaterials.isEmpty())) {
|
||||
return linkedList;
|
||||
}
|
||||
linkedList.add((Material) packedMaterials.get(0));
|
||||
linkedList.add((Material) packedMaterials.get(1));
|
||||
linkedList.add((Material) packedMaterials.get(2));
|
||||
linkedList.add((Material) packedMaterials.get(12));
|
||||
linkedList.add((Material) packedMaterials.get(13));
|
||||
linkedList.add((Material) packedMaterials.get(14));
|
||||
linkedList.add((Material) packedMaterials.get(24));
|
||||
linkedList.add((Material) packedMaterials.get(25));
|
||||
linkedList.add((Material) packedMaterials.get(26));
|
||||
return linkedList;
|
||||
}
|
||||
|
||||
public static List getHeadMaterials(PlayerData playerData3) {
|
||||
LinkedList linkedList = new LinkedList();
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
List packedMaterials = collisionState.getSurroundingMaterials();
|
||||
if (!(packedMaterials != null && !packedMaterials.isEmpty())) {
|
||||
return linkedList;
|
||||
}
|
||||
linkedList.add((Material) packedMaterials.get(6));
|
||||
linkedList.add((Material) packedMaterials.get(7));
|
||||
linkedList.add((Material) packedMaterials.get(8));
|
||||
linkedList.add((Material) packedMaterials.get(18));
|
||||
linkedList.add((Material) packedMaterials.get(19));
|
||||
linkedList.add((Material) packedMaterials.get(20));
|
||||
linkedList.add((Material) packedMaterials.get(30));
|
||||
linkedList.add((Material) packedMaterials.get(31));
|
||||
linkedList.add((Material) packedMaterials.get(32));
|
||||
return linkedList;
|
||||
}
|
||||
|
||||
public static List getHeadMaterialsLegacy(PlayerData playerData3) {
|
||||
LinkedList linkedList = new LinkedList();
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
List packedMaterialsLegacy = collisionState.getSurroundingMaterialsLegacy();
|
||||
if (!(packedMaterialsLegacy != null && !packedMaterialsLegacy.isEmpty())) {
|
||||
return linkedList;
|
||||
}
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(6));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(7));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(8));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(18));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(19));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(20));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(30));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(31));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(32));
|
||||
return linkedList;
|
||||
}
|
||||
|
||||
public static List getFloorMaterialsLegacy(PlayerData playerData3) {
|
||||
LinkedList linkedList = new LinkedList();
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
List packedMaterialsLegacy = collisionState.getSurroundingMaterialsLegacy();
|
||||
if (!(packedMaterialsLegacy != null && !packedMaterialsLegacy.isEmpty())) {
|
||||
return linkedList;
|
||||
}
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(0));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(1));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(2));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(12));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(13));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(14));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(24));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(25));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(26));
|
||||
return linkedList;
|
||||
}
|
||||
|
||||
public static List getBodyMaterials(PlayerData playerData3) {
|
||||
LinkedList linkedList = new LinkedList();
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
List packedMaterials = collisionState.getSurroundingMaterials();
|
||||
if (!(packedMaterials != null && !packedMaterials.isEmpty())) {
|
||||
return linkedList;
|
||||
}
|
||||
linkedList.add((Material) packedMaterials.get(3));
|
||||
linkedList.add((Material) packedMaterials.get(4));
|
||||
linkedList.add((Material) packedMaterials.get(5));
|
||||
linkedList.add((Material) packedMaterials.get(6));
|
||||
linkedList.add((Material) packedMaterials.get(7));
|
||||
linkedList.add((Material) packedMaterials.get(8));
|
||||
linkedList.add((Material) packedMaterials.get(15));
|
||||
linkedList.add((Material) packedMaterials.get(16));
|
||||
linkedList.add((Material) packedMaterials.get(17));
|
||||
linkedList.add((Material) packedMaterials.get(18));
|
||||
linkedList.add((Material) packedMaterials.get(19));
|
||||
linkedList.add((Material) packedMaterials.get(20));
|
||||
linkedList.add((Material) packedMaterials.get(27));
|
||||
linkedList.add((Material) packedMaterials.get(28));
|
||||
linkedList.add((Material) packedMaterials.get(29));
|
||||
linkedList.add((Material) packedMaterials.get(30));
|
||||
linkedList.add((Material) packedMaterials.get(31));
|
||||
linkedList.add((Material) packedMaterials.get(32));
|
||||
return linkedList;
|
||||
}
|
||||
|
||||
public static List getBodyMaterialsLegacy(PlayerData playerData3) {
|
||||
LinkedList linkedList = new LinkedList();
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
List packedMaterialsLegacy = collisionState.getSurroundingMaterialsLegacy();
|
||||
if (!(packedMaterialsLegacy != null && !packedMaterialsLegacy.isEmpty())) {
|
||||
return linkedList;
|
||||
}
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(3));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(4));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(5));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(6));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(7));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(8));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(15));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(16));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(17));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(18));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(19));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(20));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(27));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(28));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(29));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(30));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(31));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(32));
|
||||
return linkedList;
|
||||
}
|
||||
|
||||
public static List getCeilingMaterialsLegacy(PlayerData playerData3) {
|
||||
LinkedList linkedList = new LinkedList();
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
List packedMaterialsLegacy = collisionState.getSurroundingMaterialsLegacy();
|
||||
if (!(packedMaterialsLegacy != null && !packedMaterialsLegacy.isEmpty())) {
|
||||
return linkedList;
|
||||
}
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(9));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(10));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(11));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(21));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(22));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(23));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(33));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(34));
|
||||
linkedList.add((Material) packedMaterialsLegacy.get(35));
|
||||
return linkedList;
|
||||
}
|
||||
|
||||
public static List getCeilingMaterials(PlayerData playerData3) {
|
||||
LinkedList linkedList = new LinkedList();
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
List packedMaterials = collisionState.getSurroundingMaterials();
|
||||
if (!(packedMaterials != null && !packedMaterials.isEmpty())) {
|
||||
return linkedList;
|
||||
}
|
||||
linkedList.add((Material) packedMaterials.get(9));
|
||||
linkedList.add((Material) packedMaterials.get(10));
|
||||
linkedList.add((Material) packedMaterials.get(11));
|
||||
linkedList.add((Material) packedMaterials.get(21));
|
||||
linkedList.add((Material) packedMaterials.get(22));
|
||||
linkedList.add((Material) packedMaterials.get(23));
|
||||
linkedList.add((Material) packedMaterials.get(33));
|
||||
linkedList.add((Material) packedMaterials.get(34));
|
||||
linkedList.add((Material) packedMaterials.get(35));
|
||||
return linkedList;
|
||||
}
|
||||
|
||||
public static boolean isRiptiding(PlayerData playerData3) {
|
||||
if (playerData3.getPlayer() == null) {
|
||||
return false;
|
||||
}
|
||||
if ((ExemptionManager.isNewerThan1_13()) && (playerData3.getPlayer().isRiptiding())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isGliding(PlayerData playerData3) {
|
||||
if (playerData3.getPlayer() == null) {
|
||||
return false;
|
||||
}
|
||||
if ((ExemptionManager.isAtLeast1_9()) && (playerData3.getPlayer().isGliding())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getPotionAmplifier(Player player2, PotionEffectType potionEffectType) {
|
||||
int id = potionEffectType.getId();
|
||||
for (PotionEffect potionEffect : player2.getActivePotionEffects()) {
|
||||
if (potionEffect.getType().getId() == id) {
|
||||
return potionEffect.getAmplifier() + 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean touchesIceLegacy(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterialsLegacy() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterialsLegacy().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!BlockUtils.isIce(collisionState.getSurroundingMaterialsLegacy().get(13))) {
|
||||
if (!BlockUtils.isIce(playerData3.getCollisionState().getSubGroundMaterialLegacy())) {
|
||||
if (!BlockUtils.isIce(playerData3.getCollisionState().getDeepGroundMaterialLegacy())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean touchesWeb(PlayerData data) {
|
||||
List<Material> materials = data.getCollisionState().getSurroundingMaterials();
|
||||
return materials != null && materials.size() > 19 && (BlockUtils.isWeb(materials.get(16)) || BlockUtils.isWeb(materials.get(19)));
|
||||
}
|
||||
|
||||
public static boolean touchesWebLegacy(PlayerData data) {
|
||||
List<Material> materials = data.getCollisionState().getSurroundingMaterialsLegacy();
|
||||
return materials != null && materials.size() > 19 && (BlockUtils.isWeb(materials.get(16)) || BlockUtils.isWeb(materials.get(19)));
|
||||
}
|
||||
|
||||
public static boolean touchesLiquid(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterials() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterials().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!BlockUtils.isLiquid(collisionState.getSurroundingMaterials().get(16))) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!BlockUtils.isLiquid(collisionState.getSurroundingMaterials().get(19))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean touchesLiquidLegacy(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterialsLegacy() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterialsLegacy().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!BlockUtils.isLiquid(collisionState.getSurroundingMaterialsLegacy().get(16))) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!BlockUtils.isLiquid(collisionState.getSurroundingMaterialsLegacy().get(19))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean touchesClimbable(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterials() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterials().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (BlockUtils.isClimbable(collisionState.getSurroundingMaterials().get(16))) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (BlockUtils.isClimbable(collisionState.getSurroundingMaterials().get(19))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean touchesClimbableLegacy(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterialsLegacy() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterialsLegacy().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (BlockUtils.isClimbable(collisionState.getSurroundingMaterialsLegacy().get(16))) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (BlockUtils.isClimbable(collisionState.getSurroundingMaterialsLegacy().get(19))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getSpeedPotionLevel(LivingEntity livingEntity) {
|
||||
for (PotionEffect potionEffect : livingEntity.getActivePotionEffects()) {
|
||||
if (potionEffect.getType().toString().toLowerCase().contains("speed")) {
|
||||
return potionEffect.getAmplifier() + 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean isValidBlockPlacement(BlockPlaceEvent blockPlaceEvent) {
|
||||
Material material;
|
||||
BlockPlaceEvent blockPlaceEvent2 = blockPlaceEvent;
|
||||
Player player = blockPlaceEvent2.getPlayer();
|
||||
if (!blockPlaceEvent2.getBlock().getType().isSolid())
|
||||
return false;
|
||||
Material type = blockPlaceEvent2.getBlock().getType();
|
||||
if (BlockUtils.isDirtPath(type))
|
||||
return false;
|
||||
if (BlockUtils.isFarmland(blockPlaceEvent2.getBlock()))
|
||||
return false;
|
||||
if (BlockUtils.isSand(blockPlaceEvent2.getBlock().getType()))
|
||||
return false;
|
||||
if (BlockUtils.isConcretePowder(blockPlaceEvent2.getBlock().getType()))
|
||||
return false;
|
||||
if (BlockUtils.isGravel(blockPlaceEvent2.getBlock().getType())) {
|
||||
return false;
|
||||
}
|
||||
Player player2 = player;
|
||||
PlayerData playerData = PluginServices.INSTANCE.getPlayerDataStore().getPlayerData(player2);
|
||||
if (playerData == null)
|
||||
return false;
|
||||
if (ExemptionManager.isNewerThan1_13()) {
|
||||
material = playerData.getCollisionState().getSubGroundMaterial();
|
||||
} else {
|
||||
material = playerData.getCollisionState().getSubGroundMaterialLegacy();
|
||||
}
|
||||
BlockFace blockFace = blockPlaceEvent2.getBlockAgainst().getFace(blockPlaceEvent2.getBlock());
|
||||
double x = blockPlaceEvent2.getBlockAgainst().getX();
|
||||
double y = blockPlaceEvent2.getBlockAgainst().getY();
|
||||
double z = blockPlaceEvent2.getBlockAgainst().getZ();
|
||||
double x2 = playerData.getCollisionState().getX();
|
||||
double y2 = playerData.getCollisionState().getY();
|
||||
double z2 = playerData.getCollisionState().getZ();
|
||||
Double xDifference = null;
|
||||
Double zDifference = Math.abs(z - z2);
|
||||
xDifference = Math.abs(x - x2);
|
||||
double amount = MathUtils.hypot(xDifference, zDifference);
|
||||
List<Material> list = playerData.getCollisionState().getFloorMaterials();
|
||||
if (list == null) {
|
||||
return false;
|
||||
}
|
||||
int index = (int) list.stream().filter(material2 -> BlockUtils.isAir(material2)).count();
|
||||
if (material == null)
|
||||
return false;
|
||||
if (blockFace == null)
|
||||
return false;
|
||||
if (blockFace == BlockFace.UP)
|
||||
return false;
|
||||
if (!BlockUtils.isAir(material))
|
||||
return false;
|
||||
if (!(amount < 2.25))
|
||||
return false;
|
||||
if (!(y < y2))
|
||||
return false;
|
||||
if (index <= 6)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isFullySubmerged(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterials() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterials().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (BlockUtils.isLiquid(collisionState.getSurroundingMaterials().get(16))) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (BlockUtils.isLiquid(collisionState.getSurroundingMaterials().get(19))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isFullySubmergedLegacy(PlayerData playerData3) {
|
||||
CollisionState collisionState = playerData3.getCollisionState();
|
||||
if (collisionState.getSurroundingMaterialsLegacy() != null) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (!collisionState.getSurroundingMaterialsLegacy().isEmpty()) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (BlockUtils.isLiquid(collisionState.getSurroundingMaterialsLegacy().get(16))) {
|
||||
collisionState = playerData3.getCollisionState();
|
||||
if (BlockUtils.isLiquid(collisionState.getSurroundingMaterialsLegacy().get(19))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean holdsRiptideTrident(PlayerData playerData3) {
|
||||
if (playerData3.getPlayer() == null) {
|
||||
return false;
|
||||
}
|
||||
if (!ExemptionManager.isNewerThan1_13()) {
|
||||
return false;
|
||||
}
|
||||
if ((playerData3.getPlayer().getInventory().getItemInMainHand().getType().toString().contains("TRIDENT")) && (playerData3.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.RIPTIDE) > 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((playerData3.getPlayer().getInventory().getItemInOffHand().getType().toString().contains("TRIDENT")) && (playerData3.getPlayer().getInventory().getItemInOffHand().getEnchantmentLevel(Enchantment.RIPTIDE) > 0)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void sendHotbarShuffle(Player player2) {
|
||||
int index = ThreadLocalRandom.current().nextInt(8);
|
||||
PlayerDataStore playerDataStore = PluginServices.INSTANCE.getPlayerDataStore();
|
||||
sendPacket(playerDataStore.getPlayerData(player2), (PacketWrapper) new WrapperPlayServerHeldItemChange(index));
|
||||
}
|
||||
|
||||
public static float getMaxSpeed(PlayerData playerData3, float amount) {
|
||||
MotionState motionState = playerData3.getMotionState();
|
||||
float scaledSpeedAmplifier = motionState.getSpeedAmplifier() * 0.0675F;
|
||||
float adjustedAdjustedScaledWalkSpeedDifference = amount + (scaledSpeedAmplifier + (playerData3.getCollisionState().getWalkSpeed() - 0.2F) * 3.5F);
|
||||
if (!(adjustedAdjustedScaledWalkSpeedDifference < amount)) {
|
||||
return amount;
|
||||
}
|
||||
MotionState motionState2 = playerData3.getMotionState();
|
||||
return amount + motionState2.getSpeedAmplifier() * 0.0675F;
|
||||
}
|
||||
|
||||
public static void rotatePlayerRandomly(PlayerData playerData) {
|
||||
PlayerData playerData2 = playerData;
|
||||
if (playerData2.getPlayer() == null) {
|
||||
return;
|
||||
}
|
||||
World world = playerData2.getPlayer().getWorld();
|
||||
double x = playerData2.getPlayer().getLocation().getX();
|
||||
double y = playerData2.getPlayer().getLocation().getY();
|
||||
double z = playerData2.getPlayer().getLocation().getZ();
|
||||
float amount = (float) ThreadLocalRandom.current().nextDouble(360.0) - 180.0f;
|
||||
float amount2 = (float) ThreadLocalRandom.current().nextDouble(180.0) - 90.0f;
|
||||
Location location = new Location(world, x, y, z, amount, amount2);
|
||||
if (PluginServices.INSTANCE.isFoliaServer()) {
|
||||
WrapperPlayServerPlayerPositionAndLook wrapperPlayServerPlayerPositionAndLook = new WrapperPlayServerPlayerPositionAndLook(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), (byte) 0, 69, false);
|
||||
playerData2.getUser().sendPacket((PacketWrapper) wrapperPlayServerPlayerPositionAndLook);
|
||||
} else {
|
||||
Runnable value = (() -> CheckUtils.teleportRotatedPlayerData(playerData2, location));
|
||||
MainThreadExecutor.execute(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void rotatePlayerRandomly(Player player) {
|
||||
PlayerData playerData;
|
||||
Player player4 = player;
|
||||
playerData = PluginServices.INSTANCE.getPlayerDataStore().getPlayerData(player4);
|
||||
if ((playerData == null)) {
|
||||
return;
|
||||
}
|
||||
if ((playerData.getPlayer() == null)) {
|
||||
return;
|
||||
}
|
||||
World world = player.getWorld();
|
||||
double x = player.getLocation().getX();
|
||||
double y = player.getLocation().getY();
|
||||
double z = player.getLocation().getZ();
|
||||
float amount = (float) ThreadLocalRandom.current().nextDouble(360.0) - 180.0f;
|
||||
float amount2 = (float) ThreadLocalRandom.current().nextDouble(180.0) - 90.0f;
|
||||
Location location = new Location(world, x, y, z, amount, amount2);
|
||||
if (PluginServices.INSTANCE.isFoliaServer()) {
|
||||
WrapperPlayServerPlayerPositionAndLook wrapperPlayServerPlayerPositionAndLook = new WrapperPlayServerPlayerPositionAndLook(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), (byte) 0, 69, false);
|
||||
playerData.getUser().sendPacket((PacketWrapper) wrapperPlayServerPlayerPositionAndLook);
|
||||
} else {
|
||||
Runnable runnable = (() -> CheckUtils.teleportRotatedPlayer(player, location));
|
||||
MainThreadExecutor.execute(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isWearingNetheriteArmor(PlayerData playerData3) {
|
||||
if ((ExemptionManager.isAtLeast1_16()) && (playerData3.getPlayer() != null)) {
|
||||
if (playerData3.getPlayer().getInventory().getHelmet() != null) {
|
||||
return playerData3.getPlayer().getInventory().getHelmet().getType() == Material.NETHERITE_HELMET;
|
||||
}
|
||||
if (playerData3.getPlayer().getInventory().getChestplate() != null) {
|
||||
return playerData3.getPlayer().getInventory().getChestplate().getType() == Material.NETHERITE_CHESTPLATE;
|
||||
}
|
||||
if (playerData3.getPlayer().getInventory().getLeggings() != null) {
|
||||
return playerData3.getPlayer().getInventory().getLeggings().getType() == Material.NETHERITE_LEGGINGS;
|
||||
}
|
||||
if (playerData3.getPlayer().getInventory().getBoots() != null) {
|
||||
return playerData3.getPlayer().getInventory().getBoots().getType() == Material.NETHERITE_BOOTS;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private CheckUtils() {
|
||||
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
|
||||
}
|
||||
|
||||
private static void teleportRotatedPlayer(Player player2, Location location2) {
|
||||
player2.teleport(location2, TeleportCause.UNKNOWN);
|
||||
}
|
||||
|
||||
private static void teleportRotatedPlayerData(PlayerData playerData3, Location location2) {
|
||||
playerData3.getPlayer().teleport(location2, TeleportCause.UNKNOWN);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
package me.frep.vulcan.spigot.check.data;
|
||||
|
||||
import java.util.List;
|
||||
import me.frep.vulcan.api.check.ICheckData;
|
||||
|
||||
public class CheckData implements ICheckData {
|
||||
|
||||
private boolean enabled;
|
||||
|
||||
private boolean punishable;
|
||||
|
||||
private boolean broadcastPunishment;
|
||||
|
||||
private boolean hotbarShuffle;
|
||||
|
||||
private boolean randomRotation;
|
||||
|
||||
private int maxViolations;
|
||||
|
||||
private int alertInterval;
|
||||
|
||||
private int minimumVlToNotify;
|
||||
|
||||
private int maxPing;
|
||||
|
||||
private int minimumVlToRandomlyRotate;
|
||||
|
||||
private int minimumVlToShuffleHotbar;
|
||||
|
||||
private int randomRotationInterval;
|
||||
|
||||
private int hotbarShuffleInterval;
|
||||
|
||||
private double minimumTps;
|
||||
|
||||
private double maxBuffer;
|
||||
|
||||
private double bufferDecay;
|
||||
|
||||
private double bufferMultiple;
|
||||
|
||||
private List<String> punishmentCommands;
|
||||
|
||||
private String checkName;
|
||||
|
||||
public CheckData(String checkName2) {
|
||||
this.checkName = checkName2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{checkName=" + this.checkName + " enabled=" + this.enabled + " punishable=" + this.punishable + " broadcastPunishment=" + this.broadcastPunishment + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPunishable() {
|
||||
return this.punishable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBroadcastPunishment() {
|
||||
return this.broadcastPunishment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHotbarShuffle() {
|
||||
return this.hotbarShuffle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRandomRotation() {
|
||||
return this.randomRotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxViolations() {
|
||||
return this.maxViolations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAlertInterval() {
|
||||
return this.alertInterval;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumVlToNotify() {
|
||||
return this.minimumVlToNotify;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPing() {
|
||||
return this.maxPing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumVlToRandomlyRotate() {
|
||||
return this.minimumVlToRandomlyRotate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumVlToShuffleHotbar() {
|
||||
return this.minimumVlToShuffleHotbar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMinimumTps() {
|
||||
return this.minimumTps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxBuffer() {
|
||||
return this.maxBuffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBufferDecay() {
|
||||
return this.bufferDecay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBufferMultiple() {
|
||||
return this.bufferMultiple;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getPunishmentCommands() {
|
||||
return this.punishmentCommands;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRandomRotationInterval() {
|
||||
return this.randomRotationInterval;
|
||||
}
|
||||
|
||||
public int getMaxPing2() {
|
||||
return this.maxPing;
|
||||
}
|
||||
|
||||
public int getMinimumVlToRandomlyRotate2() {
|
||||
return this.minimumVlToRandomlyRotate;
|
||||
}
|
||||
|
||||
public int getMinimumVlToShuffleHotbar2() {
|
||||
return this.minimumVlToShuffleHotbar;
|
||||
}
|
||||
|
||||
public int getHotbarShuffleInterval() {
|
||||
return this.hotbarShuffleInterval;
|
||||
}
|
||||
|
||||
public String getCheckName() {
|
||||
return this.checkName;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled2) {
|
||||
this.enabled = enabled2;
|
||||
}
|
||||
|
||||
public void setPunishable(boolean punishable2) {
|
||||
this.punishable = punishable2;
|
||||
}
|
||||
|
||||
public void setBroadcastPunishment(boolean broadcastPunishment2) {
|
||||
this.broadcastPunishment = broadcastPunishment2;
|
||||
}
|
||||
|
||||
public void setHotbarShuffle(boolean hotbarShuffle2) {
|
||||
this.hotbarShuffle = hotbarShuffle2;
|
||||
}
|
||||
|
||||
public void setRandomRotation(boolean randomRotation2) {
|
||||
this.randomRotation = randomRotation2;
|
||||
}
|
||||
|
||||
public void setMaxViolations(int maxViolations2) {
|
||||
this.maxViolations = maxViolations2;
|
||||
}
|
||||
|
||||
public void setAlertInterval(int alertInterval2) {
|
||||
this.alertInterval = alertInterval2;
|
||||
}
|
||||
|
||||
public void setMinimumVlToNotify(int minimumVlToNotify2) {
|
||||
this.minimumVlToNotify = minimumVlToNotify2;
|
||||
}
|
||||
|
||||
public void setMaxPing(int maxPing2) {
|
||||
this.maxPing = maxPing2;
|
||||
}
|
||||
|
||||
public void setMinimumVlToRandomlyRotate(int minimumVlToRandomlyRotate2) {
|
||||
this.minimumVlToRandomlyRotate = minimumVlToRandomlyRotate2;
|
||||
}
|
||||
|
||||
public void setMinimumVlToShuffleHotbar(int minimumVlToShuffleHotbar2) {
|
||||
this.minimumVlToShuffleHotbar = minimumVlToShuffleHotbar2;
|
||||
}
|
||||
|
||||
public void setRandomRotationInterval(int randomRotationInterval2) {
|
||||
this.randomRotationInterval = randomRotationInterval2;
|
||||
}
|
||||
|
||||
public void setHotbarShuffleInterval(int hotbarShuffleInterval2) {
|
||||
this.hotbarShuffleInterval = hotbarShuffleInterval2;
|
||||
}
|
||||
|
||||
public void setMinimumTps(double minimumTps2) {
|
||||
this.minimumTps = minimumTps2;
|
||||
}
|
||||
|
||||
public void setMaxBuffer(double maxBuffer2) {
|
||||
this.maxBuffer = maxBuffer2;
|
||||
}
|
||||
|
||||
public void setBufferDecay(double bufferDecay2) {
|
||||
this.bufferDecay = bufferDecay2;
|
||||
}
|
||||
|
||||
public void setBufferMultiple(double bufferMultiple2) {
|
||||
this.bufferMultiple = bufferMultiple2;
|
||||
}
|
||||
|
||||
public void setPunishmentCommands(List<String> punishmentCommands2) {
|
||||
this.punishmentCommands = punishmentCommands2;
|
||||
}
|
||||
|
||||
public void setCheckName(String checkName2) {
|
||||
this.checkName = checkName2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package me.frep.vulcan.spigot.check.exemption;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public final class ConditionUtils {
|
||||
|
||||
public static boolean anyMatch(Collection collection, Predicate predicate) {
|
||||
Predicate predicate2 = predicate;
|
||||
if (predicate == null) {
|
||||
return false;
|
||||
}
|
||||
for (Object value : collection) {
|
||||
if (predicate2.test(value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean allMatch(Collection collection, Predicate predicate) {
|
||||
Predicate predicate2 = predicate;
|
||||
if (predicate == null) {
|
||||
return false;
|
||||
}
|
||||
for (Object value : collection) {
|
||||
if (!predicate2.test(value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private ConditionUtils() {
|
||||
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,186 @@
|
||||
package me.frep.vulcan.spigot.check.exemption;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import io.github.retrooper.packetevents.util.SpigotReflectionUtil;
|
||||
import me.frep.vulcan.spigot.config.VulcanSettings;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.util.scheduling.MainThreadExecutor;
|
||||
import me.frep.vulcan.spigot.util.minecraft.ChatColorUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
|
||||
public final class ExemptionManager {
|
||||
|
||||
private static final boolean newerThan1_7_10 = getServerVersion().isNewerThan(ServerVersion.V_1_7_10);
|
||||
|
||||
private static final boolean atLeast1_8 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_8);
|
||||
|
||||
private static final boolean atLeast1_9 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_9);
|
||||
|
||||
private static final boolean before1_13 = getServerVersion().isOlderThan(ServerVersion.V_1_13);
|
||||
|
||||
private static final boolean before1_8 = getServerVersion().isOlderThan(ServerVersion.V_1_8);
|
||||
|
||||
private static final boolean before1_9 = getServerVersion().isOlderThan(ServerVersion.V_1_9);
|
||||
|
||||
private static final boolean newerThan1_13 = getServerVersion().isNewerThan(ServerVersion.V_1_13);
|
||||
|
||||
private static final boolean atLeast1_16 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_16);
|
||||
|
||||
private static final boolean atLeast1_12 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_12);
|
||||
|
||||
private static final boolean atLeast1_11 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_11);
|
||||
|
||||
private static final boolean atLeast1_17 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_17);
|
||||
|
||||
private static final boolean atLeast1_14 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_14);
|
||||
|
||||
private static final boolean atLeast1_18 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_18);
|
||||
|
||||
private static final boolean atLeast1_19 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_19);
|
||||
|
||||
private static final boolean atLeast1_20 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_20);
|
||||
|
||||
private static final boolean atLeast1_20_2 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_20_2);
|
||||
|
||||
private static final boolean before1_21 = getServerVersion().isOlderThan(ServerVersion.V_1_21);
|
||||
|
||||
private static final boolean atLeast1_12_2 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_12_2);
|
||||
|
||||
private static final boolean atLeast1_21_2 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_21_2);
|
||||
|
||||
private static final boolean atLeast26_1 = getServerVersion().isNewerThanOrEquals(ServerVersion.V_26_1);
|
||||
|
||||
public static double getTps() {
|
||||
return PluginServices.INSTANCE.isFoliaServer() ? 20.0 : Math.min(20.0, SpigotReflectionUtil.getTPS());
|
||||
}
|
||||
|
||||
public static void logInfo(String message) {
|
||||
PluginServices.INSTANCE.getLogger().info(ChatColorUtils.colorize(message));
|
||||
}
|
||||
|
||||
public static void logColored(String message) {
|
||||
PluginServices.INSTANCE.getLogger().info(ChatColorUtils.colorize(message));
|
||||
}
|
||||
|
||||
public static ServerVersion getServerVersion() {
|
||||
return PacketEvents.getAPI().getServerManager().getVersion();
|
||||
}
|
||||
|
||||
public static boolean isFolia() {
|
||||
try {
|
||||
Class.forName("io.papermc.paper.threadedregions.RegionizedServer", false, ExemptionManager.class.getClassLoader());
|
||||
return true;
|
||||
} catch (ClassNotFoundException exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isAtLeast26_1() {
|
||||
return atLeast26_1;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_17() {
|
||||
return atLeast1_17;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_19() {
|
||||
return atLeast1_19;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_14() {
|
||||
return atLeast1_14;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_11() {
|
||||
return atLeast1_11;
|
||||
}
|
||||
|
||||
public static boolean isNewerThan1_7_10() {
|
||||
return newerThan1_7_10;
|
||||
}
|
||||
|
||||
public static boolean isBefore1_9() {
|
||||
return before1_9;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_8() {
|
||||
return atLeast1_8;
|
||||
}
|
||||
|
||||
public static boolean isNewerThan1_13() {
|
||||
return newerThan1_13;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_16() {
|
||||
return atLeast1_16;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_9() {
|
||||
return atLeast1_9;
|
||||
}
|
||||
|
||||
public static boolean isBefore1_13() {
|
||||
return before1_13;
|
||||
}
|
||||
|
||||
public static boolean isBefore1_8() {
|
||||
return before1_8;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_18() {
|
||||
return atLeast1_18;
|
||||
}
|
||||
|
||||
public static boolean isBefore1_21() {
|
||||
return before1_21;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_20() {
|
||||
return atLeast1_20;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_20_2() {
|
||||
return atLeast1_20_2;
|
||||
}
|
||||
|
||||
public static void debug(Object value) {
|
||||
if (VulcanSettings.settingsDebug) {
|
||||
broadcast("&c[!] &7" + value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void dispatchConsoleCommand(String command) {
|
||||
MainThreadExecutor.execute(() -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ChatColorUtils.colorize(command)));
|
||||
}
|
||||
|
||||
public static void broadcast(String message) {
|
||||
MainThreadExecutor.execute(() -> Bukkit.broadcastMessage(ChatColorUtils.colorize(message)));
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_12() {
|
||||
return atLeast1_12;
|
||||
}
|
||||
|
||||
public static boolean isBefore1_17() {
|
||||
return getServerVersion().isOlderThan(ServerVersion.V_1_17);
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_12_2() {
|
||||
return atLeast1_12_2;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast1_21_2() {
|
||||
return atLeast1_21_2;
|
||||
}
|
||||
|
||||
private ExemptionManager() {
|
||||
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
|
||||
}
|
||||
|
||||
private static void executeConsoleCommand(String text) {
|
||||
ConsoleCommandSender consoleSender = Bukkit.getConsoleSender();
|
||||
Bukkit.dispatchCommand(consoleSender, ChatColorUtils.colorize(text));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.pattern;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'C', complexType = "Repeated", description = "Repeated yaw values.")
|
||||
public class AimC extends AbstractCheck {
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "deltaYaw=";
|
||||
|
||||
public AimC(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.hasRecentAttack(3))) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
float previousDeltaYaw = this.playerData.getRotationTracker().getPreviousDeltaYaw();
|
||||
boolean condition = deltaYaw > 1.25F && previousDeltaYaw > 1.25F && deltaYaw == previousDeltaYaw;
|
||||
if (condition) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + deltaYaw);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.pattern;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'I', complexType = "Constant", experimental = false, description = "Not constant rotations.")
|
||||
public class AimI extends AbstractCheck {
|
||||
|
||||
public AimI(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker.getDeltaPitch();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float previousDeltaPitch = rotationTracker2.getPreviousDeltaPitch();
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker3.getDeltaYaw();
|
||||
long scaledRotationGcdScale = (long) (MathUtils.ROTATION_GCD_SCALE * deltaPitch);
|
||||
long scaledRotationGcdScale2 = (long) (MathUtils.ROTATION_GCD_SCALE * previousDeltaPitch);
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CINEMATIC });
|
||||
long longValue3 = MathUtils.approximateGcd(scaledRotationGcdScale, scaledRotationGcdScale2);
|
||||
RotationTracker rotationTracker4 = this.playerData.getRotationTracker();
|
||||
boolean hasKnownSensitivity2 = rotationTracker4.hasKnownSensitivity();
|
||||
boolean condition = deltaYaw > 0.25F && deltaPitch > 0.25F && deltaPitch < 20.0F && deltaYaw < 20.0F;
|
||||
boolean condition2 = !exempt && longValue3 < 131072L;
|
||||
if (condition2 && condition && !hasKnownSensitivity2) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("rotation=" + longValue3 / 1000L + " deltaPitch=" + deltaPitch + " deltaYaw=" + deltaYaw);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.pattern;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'K', complexType = "Linear", experimental = false, description = "Not constant rotations.")
|
||||
public class AimK extends AbstractCheck {
|
||||
|
||||
public AimK(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker2.getDeltaPitch();
|
||||
float previousDeltaYaw = this.playerData.getRotationTracker().getPreviousDeltaYaw();
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
float previousDeltaPitch = rotationTracker3.getPreviousDeltaPitch();
|
||||
long scaledDeltaYaw = (long) (deltaYaw * MathUtils.ROTATION_GCD_SCALE);
|
||||
long scaledPreviousDeltaYaw = (long) (previousDeltaYaw * MathUtils.ROTATION_GCD_SCALE);
|
||||
double amount = MathUtils.approximateGcd(scaledDeltaYaw, scaledPreviousDeltaYaw);
|
||||
long scaledDeltaPitch = (long) (deltaPitch * MathUtils.ROTATION_GCD_SCALE);
|
||||
scaledPreviousDeltaYaw = (long) (previousDeltaPitch * MathUtils.ROTATION_GCD_SCALE);
|
||||
double amount2 = MathUtils.approximateGcd(scaledDeltaPitch, scaledPreviousDeltaYaw);
|
||||
double scaledRotationGcdScale = amount / MathUtils.ROTATION_GCD_SCALE;
|
||||
double scaledRotationGcdScale2 = amount2 / MathUtils.ROTATION_GCD_SCALE;
|
||||
double scaledDeltaYaw2 = deltaYaw / scaledRotationGcdScale;
|
||||
double scaledDeltaPitch2 = deltaPitch / scaledRotationGcdScale2;
|
||||
double scaledPreviousDeltaYaw2 = previousDeltaYaw / scaledRotationGcdScale;
|
||||
double scaledPreviousDeltaPitch = previousDeltaPitch / scaledRotationGcdScale2;
|
||||
if (deltaYaw > 0.1F && deltaPitch > 0.1F && deltaYaw < 20.0F && deltaPitch < 20.0F) {
|
||||
double scaledDeltaYaw2Remainder = scaledDeltaYaw2 % scaledPreviousDeltaYaw2;
|
||||
double scaledDeltaPitch2Remainder = scaledDeltaPitch2 % scaledPreviousDeltaPitch;
|
||||
double scaledDeltaYaw2RemainderDifference = Math.abs(Math.floor(scaledDeltaYaw2Remainder) - scaledDeltaYaw2Remainder);
|
||||
double scaledDeltaPitch2RemainderDifference = Math.abs(Math.floor(scaledDeltaPitch2Remainder) - scaledDeltaPitch2Remainder);
|
||||
boolean condition = scaledDeltaYaw2Remainder > 60.0 && scaledDeltaYaw2RemainderDifference > 0.1;
|
||||
boolean condition2 = scaledDeltaPitch2Remainder > 60.0 && scaledDeltaPitch2RemainderDifference > 0.1;
|
||||
RotationTracker rotationTracker4 = this.playerData.getRotationTracker();
|
||||
double sensitivity = rotationTracker4.getSensitivity();
|
||||
boolean condition3 = sensitivity < 100.0 && sensitivity > -1.0;
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CINEMATIC });
|
||||
if (condition && condition2 && !exempt && !condition3) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.pattern;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'W', complexType = "Analysis", description = "Generic rotation analysis heuristic.")
|
||||
public class AimW extends AbstractCheck {
|
||||
|
||||
public AimW(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker2.getDeltaPitch();
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
int sensitivity = rotationTracker3.getSensitivity();
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CINEMATIC });
|
||||
boolean condition = sensitivity < -10 && deltaYaw > 1.25F && deltaPitch > 1.25F;
|
||||
if (condition && !exempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("sens=" + sensitivity + " deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.pattern;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'X', complexType = "Analysis", description = "Generic rotation analysis heuristic.")
|
||||
public class AimX extends AbstractCheck {
|
||||
|
||||
public AimX(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker2.getDeltaPitch();
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
int sensitivity = rotationTracker3.getSensitivity();
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CINEMATIC, ExemptType.SPECTATOR });
|
||||
boolean condition = sensitivity > 205 && deltaYaw > 1.25F && deltaPitch > 1.25F;
|
||||
if (condition && !exempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("sens=" + sensitivity + " deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.rotation;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'A', complexType = "Slope", description = "Invalid pitch change.")
|
||||
public class AimA extends AbstractCheck {
|
||||
|
||||
public AimA(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker2.getDeltaPitch();
|
||||
boolean condition = MathUtils.isSmallScientificNotation(deltaPitch) && deltaYaw > 0.5F;
|
||||
if (condition) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.rotation;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.data.PlayerDataStore;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.movement.RelativeMoveTracker;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'D', complexType = "Straight", experimental = false, description = "Invalid pitch change.")
|
||||
public class AimD extends AbstractCheck {
|
||||
|
||||
public AimD(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
boolean condition;
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.hasRecentAttack(3))) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float pitch = rotationTracker.getPitch();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker2.getDeltaYaw();
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker3.getDeltaPitch();
|
||||
RelativeMoveTracker relativeMoveTracker = this.playerData.getRelativeMoveTracker();
|
||||
double attackDistance = relativeMoveTracker.getAttackDistance();
|
||||
RelativeMoveTracker relativeMoveTracker2 = this.playerData.getRelativeMoveTracker();
|
||||
Entity entity = relativeMoveTracker2.getLastAttackedEntity();
|
||||
if (entity == null || !(entity instanceof Player player)) {
|
||||
return;
|
||||
}
|
||||
PlayerDataStore playerDataStore = PluginServices.INSTANCE.getPlayerDataStore();
|
||||
PlayerData playerData = playerDataStore.getPlayerData(player);
|
||||
if (playerData == null) {
|
||||
return;
|
||||
}
|
||||
condition = (deltaYaw > 2.75F && deltaPitch == 0.0F && Math.abs(pitch) < 65.0F && attackDistance > 1.0) && ((playerData.getCollisionState()).getDeltaXZ() > 0.03);
|
||||
boolean condition2 = condition;
|
||||
if (condition2) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.rotation;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'E', complexType = "Ratio", experimental = false, description = "Invalid yaw change.")
|
||||
public class AimE extends AbstractCheck {
|
||||
|
||||
public AimE(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker2.getDeltaPitch();
|
||||
boolean condition = MathUtils.isSmallScientificNotation(deltaYaw) && deltaPitch > 0.125F;
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.VEHICLE });
|
||||
if (condition && !exempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.rotation;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.data.PlayerDataStore;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.player.settings.PlayerToggles;
|
||||
import me.frep.vulcan.spigot.tracker.movement.RelativeMoveTracker;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'F', complexType = "Straight", description = "Invalid yaw change.")
|
||||
public class AimF extends AbstractCheck {
|
||||
|
||||
public AimF(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
boolean condition;
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.hasRecentAttack(3))) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker2.getDeltaPitch();
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
float pitch = rotationTracker3.getPitch();
|
||||
RelativeMoveTracker relativeMoveTracker = this.playerData.getRelativeMoveTracker();
|
||||
double attackDistance = relativeMoveTracker.getAttackDistance();
|
||||
RelativeMoveTracker relativeMoveTracker2 = this.playerData.getRelativeMoveTracker();
|
||||
Entity entity = relativeMoveTracker2.getLastAttackedEntity();
|
||||
if (entity == null || !(entity instanceof Player player)) {
|
||||
return;
|
||||
}
|
||||
PlayerDataStore playerDataStore = PluginServices.INSTANCE.getPlayerDataStore();
|
||||
PlayerData playerData = playerDataStore.getPlayerData(player);
|
||||
if (playerData == null) {
|
||||
return;
|
||||
}
|
||||
boolean exempt;
|
||||
PlayerToggles playerToggles = playerData.getPlayerToggles();
|
||||
exempt = playerToggles.isExempt(ExemptType.VEHICLE);
|
||||
condition = (deltaPitch == 0.0F && deltaYaw > 1.825F && Math.abs(pitch) < 60.0F && attackDistance > 1.0) && ((playerData.getCollisionState()).getDeltaXZ() > 0.03);
|
||||
boolean condition2 = condition;
|
||||
if (condition2 && !exempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.rotation;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.data.PlayerDataStore;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.player.settings.PlayerToggles;
|
||||
import me.frep.vulcan.spigot.tracker.movement.RelativeMoveTracker;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'G', complexType = "Ratio", description = "Too large yaw change.")
|
||||
public class AimG extends AbstractCheck {
|
||||
|
||||
public AimG(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.hasRecentAttack(2))) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker2.getDeltaPitch();
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
float pitch = rotationTracker3.getPitch();
|
||||
RelativeMoveTracker relativeMoveTracker = this.playerData.getRelativeMoveTracker();
|
||||
double attackDistance = relativeMoveTracker.getAttackDistance();
|
||||
RelativeMoveTracker relativeMoveTracker2 = this.playerData.getRelativeMoveTracker();
|
||||
Entity entity = relativeMoveTracker2.getLastAttackedEntity();
|
||||
if (entity == null || !(entity instanceof Player player)) {
|
||||
return;
|
||||
}
|
||||
PlayerDataStore playerDataStore = PluginServices.INSTANCE.getPlayerDataStore();
|
||||
PlayerData playerData = playerDataStore.getPlayerData(player);
|
||||
if (playerData == null) {
|
||||
return;
|
||||
}
|
||||
PlayerToggles playerToggles = playerData.getPlayerToggles();
|
||||
boolean exempt = playerToggles.isExempt(ExemptType.VEHICLE);
|
||||
boolean condition = deltaYaw > 15.0F && deltaPitch < 0.1 && Math.abs(pitch) < 65.0F && attackDistance > 1.0;
|
||||
if (condition && !exempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.rotation;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'L', complexType = "Direction", description = "Switching directions too quickly.")
|
||||
public class AimL extends AbstractCheck {
|
||||
|
||||
private float ratio;
|
||||
|
||||
private int samePitchDirectionTicks;
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "deltaPitch=";
|
||||
|
||||
public AimL(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.hasRecentAttack(3))) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float pitch = rotationTracker.getPitch();
|
||||
float previousPitch = this.playerData.getRotationTracker().getPreviousPitch();
|
||||
float ratio2 = pitch - previousPitch;
|
||||
if ((!(ratio2 < 0.0F) || !(this.ratio > 0.0F)) && (!(ratio2 > 0.0F) || !(this.ratio < 0.0F))) {
|
||||
this.samePitchDirectionTicks++;
|
||||
} else {
|
||||
this.samePitchDirectionTicks = 0;
|
||||
}
|
||||
boolean condition = this.samePitchDirectionTicks == 0 && Math.abs(ratio2) > 5.0F;
|
||||
if (condition) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + ratio2);
|
||||
}
|
||||
} else {
|
||||
this.setBuffer();
|
||||
}
|
||||
this.ratio = ratio2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.rotation;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.data.PlayerDataStore;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.player.collision.CollisionState;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.movement.RelativeMoveTracker;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'N', complexType = "Small Yaw", experimental = false, description = "Too small yaw change.")
|
||||
public class AimN extends AbstractCheck {
|
||||
|
||||
public AimN(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.hasRecentAttack(3))) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker2.getDeltaPitch();
|
||||
boolean condition = deltaYaw < 0.05 && deltaYaw > 0.0F && deltaPitch == 0.0F;
|
||||
RelativeMoveTracker relativeMoveTracker = this.playerData.getRelativeMoveTracker();
|
||||
Entity entity = relativeMoveTracker.getLastAttackedEntity();
|
||||
if (entity == null || !(entity instanceof Player player)) {
|
||||
return;
|
||||
}
|
||||
PlayerDataStore playerDataStore = PluginServices.INSTANCE.getPlayerDataStore();
|
||||
PlayerData playerData = playerDataStore.getPlayerData(player);
|
||||
if (playerData == null) {
|
||||
return;
|
||||
}
|
||||
CollisionState collisionState = playerData.getCollisionState();
|
||||
if (collisionState.getDeltaXZ() < 0.03) {
|
||||
return;
|
||||
}
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.VEHICLE, ExemptType.BOAT });
|
||||
if (condition && !exempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("deltaYaw=" + deltaYaw + " deltaPitch=" + deltaPitch);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.rotation;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.data.PlayerDataStore;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.player.collision.CollisionState;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.movement.RelativeMoveTracker;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'O', complexType = "Small Yaw", description = "Too small pitch change.")
|
||||
public class AimO extends AbstractCheck {
|
||||
|
||||
public AimO(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.hasRecentAttack(2))) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker2.getDeltaPitch();
|
||||
boolean condition = deltaPitch < 0.05 && deltaPitch > 0.0F && deltaYaw == 0.0F;
|
||||
RelativeMoveTracker relativeMoveTracker = this.playerData.getRelativeMoveTracker();
|
||||
Entity entity = relativeMoveTracker.getLastAttackedEntity();
|
||||
if (entity == null || !(entity instanceof Player player)) {
|
||||
return;
|
||||
}
|
||||
PlayerDataStore playerDataStore = PluginServices.INSTANCE.getPlayerDataStore();
|
||||
PlayerData playerData = playerDataStore.getPlayerData(player);
|
||||
if (playerData == null) {
|
||||
return;
|
||||
}
|
||||
CollisionState collisionState = playerData.getCollisionState();
|
||||
if (collisionState.getDeltaXZ() < 0.03) {
|
||||
return;
|
||||
}
|
||||
if (condition) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("deltaPitch=" + deltaPitch + " deltaYaw=" + deltaYaw);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.rotation;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.movement.RelativeMoveTracker;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'P', complexType = "Yaw Acceleration", experimental = false, description = "Large yaw acceleration.")
|
||||
public class AimP extends AbstractCheck {
|
||||
|
||||
public AimP(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.hasRecentAttack(3))) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float pitch = rotationTracker.getPitch();
|
||||
float yawAcceleration = this.playerData.getRotationTracker().getYawAcceleration();
|
||||
float pitchAcceleration = this.playerData.getRotationTracker().getPitchAcceleration();
|
||||
RelativeMoveTracker relativeMoveTracker = this.playerData.getRelativeMoveTracker();
|
||||
double targetDistance = relativeMoveTracker.getTargetDistance();
|
||||
boolean condition = yawAcceleration > 20.0F && pitchAcceleration < 0.05 && Math.abs(pitch) < 60.0F && targetDistance > 1.0;
|
||||
if (condition) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("yawAccel=" + yawAcceleration + " pitchAccel=" + pitchAcceleration);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.rotation;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.movement.RelativeMoveTracker;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'Y', complexType = "Rotation", description = "Generic rotation analysis heuristic.")
|
||||
public class AimY extends AbstractCheck {
|
||||
|
||||
public AimY(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3) && (!this.isTeleporting())) {
|
||||
float difference;
|
||||
double attackDistance;
|
||||
boolean condition;
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float previousYawSmoothing = rotationTracker.getPreviousYawSmoothing();
|
||||
float yawSmoothing = this.playerData.getRotationTracker().getYawSmoothing();
|
||||
difference = Math.abs(yawSmoothing - previousYawSmoothing);
|
||||
RelativeMoveTracker relativeMoveTracker = this.playerData.getRelativeMoveTracker();
|
||||
attackDistance = relativeMoveTracker.getAttackDistance();
|
||||
condition = (this.isExempt(new ExemptType[] { ExemptType.TELEPORT, ExemptType.DEATH, ExemptType.WORLD_CHANGE })) || (!((this.playerData.getMotionState()).getTicksSinceServerPosition() >= 20));
|
||||
boolean condition2 = condition;
|
||||
if (condition2) {
|
||||
return;
|
||||
}
|
||||
if (attackDistance > 0.6 && difference > 20.0F && attackDistance < 10.0) {
|
||||
this.fail("diff=" + difference + " dist=" + attackDistance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.sensitivity;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'B', complexType = "Modulo", description = "Invalid yaw change.")
|
||||
public class AimB extends AbstractCheck {
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "deltaYaw=";
|
||||
|
||||
public AimB(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker.getDeltaYaw();
|
||||
boolean condition = deltaYaw > 0.0F && (deltaYaw % 0.25 == 0.0 || deltaYaw % 0.1 == 0.0);
|
||||
if (condition) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + deltaYaw);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.sensitivity;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.data.PlayerDataStore;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.movement.RelativeMoveTracker;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'H', complexType = "Negative", experimental = false, description = "Invalid sensitivity.")
|
||||
public class AimH extends AbstractCheck {
|
||||
|
||||
public AimH(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
boolean condition;
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
double sensitivityEstimate = rotationTracker.getSensitivityEstimate();
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
double deltaPitch = rotationTracker2.getDeltaPitch();
|
||||
RelativeMoveTracker relativeMoveTracker = this.playerData.getRelativeMoveTracker();
|
||||
Entity entity = relativeMoveTracker.getLastAttackedEntity();
|
||||
if (entity == null || !(entity instanceof Player player)) {
|
||||
return;
|
||||
}
|
||||
PlayerDataStore playerDataStore = PluginServices.INSTANCE.getPlayerDataStore();
|
||||
PlayerData playerData = playerDataStore.getPlayerData(player);
|
||||
if (playerData == null) {
|
||||
return;
|
||||
}
|
||||
boolean exempt;
|
||||
boolean hasKnownSensitivity2;
|
||||
exempt = this.isExempt(new ExemptType[] { ExemptType.CINEMATIC });
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
hasKnownSensitivity2 = rotationTracker3.hasKnownSensitivity();
|
||||
condition = (sensitivityEstimate < -1.0 && deltaPitch < 20.0 && deltaPitch > 0.25 && deltaPitch > 1.25) && ((playerData.getCollisionState()).getDeltaXZ() > 0.01);
|
||||
boolean condition2 = condition;
|
||||
if (condition2 && !exempt && !hasKnownSensitivity2) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("final=" + sensitivityEstimate + " deltaPitch=" + deltaPitch);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.sensitivity;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.movement.RelativeMoveTracker;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'Q', complexType = "GCD Modulo", description = "GCD bypass flaw detected.")
|
||||
public class AimQ extends AbstractCheck {
|
||||
|
||||
public AimQ(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
boolean hasValidSensitivity2 = rotationTracker.hasValidSensitivity();
|
||||
if (hasValidSensitivity2) {
|
||||
double sensitivityStep = this.playerData.getRotationTracker().getSensitivityStep();
|
||||
if (sensitivityStep < 0.01) {
|
||||
return;
|
||||
}
|
||||
float adjustedScaledSensitivityStep = (float) sensitivityStep * 0.6F + 0.2F;
|
||||
float scaledScaledScaledAdjustedScaledSensitivityStep = adjustedScaledSensitivityStep * adjustedScaledSensitivityStep * adjustedScaledSensitivityStep * 1.2F;
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float yaw = rotationTracker2.getYaw();
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
float pitch = rotationTracker3.getPitch();
|
||||
float yawDifference = yaw - yaw % scaledScaledScaledAdjustedScaledSensitivityStep;
|
||||
float pitchDifference = pitch - pitch % scaledScaledScaledAdjustedScaledSensitivityStep;
|
||||
float yawDifference2 = Math.abs(yaw - yawDifference);
|
||||
float pitchDifference2 = Math.abs(pitch - pitchDifference);
|
||||
RotationTracker rotationTracker4 = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker4.getDeltaYaw();
|
||||
RotationTracker rotationTracker5 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker5.getDeltaPitch();
|
||||
float adjustedDeltaYaw = deltaYaw + deltaPitch;
|
||||
RelativeMoveTracker relativeMoveTracker = this.playerData.getRelativeMoveTracker();
|
||||
double attackDistance = relativeMoveTracker.getAttackDistance();
|
||||
boolean condition = (yawDifference2 == 0.0F || pitchDifference2 == 0.0F) && adjustedDeltaYaw > 0.75F;
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CREATIVE, ExemptType.SPECTATOR });
|
||||
if (condition && attackDistance > 1.0 && !exempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("yawDifference=" + yawDifference2 + " pitchDifference=" + pitchDifference2 + " combined=" + adjustedDeltaYaw);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.sensitivity;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'S', complexType = "Divisor Y", experimental = false, description = "Subtle aim assist modifications.")
|
||||
public class AimS extends AbstractCheck {
|
||||
|
||||
public AimS(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
boolean hasValidSensitivity2 = rotationTracker.hasValidSensitivity();
|
||||
if (hasValidSensitivity2) {
|
||||
double sensitivityStep = this.playerData.getRotationTracker().getSensitivityStep();
|
||||
if (sensitivityStep < 0.01) {
|
||||
return;
|
||||
}
|
||||
float adjustedScaledSensitivityStep = (float) sensitivityStep * 0.6F + 0.2F;
|
||||
float scaledScaledScaledAdjustedScaledSensitivityStep = adjustedScaledSensitivityStep * adjustedScaledSensitivityStep * adjustedScaledSensitivityStep * 1.2F;
|
||||
if (scaledScaledScaledAdjustedScaledSensitivityStep < 1.0E-4) {
|
||||
return;
|
||||
}
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float deltaYaw = rotationTracker2.getDeltaYaw();
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
float deltaPitch = rotationTracker3.getDeltaPitch();
|
||||
double scaledDeltaYaw = deltaYaw / scaledScaledScaledAdjustedScaledSensitivityStep;
|
||||
double scaledDeltaPitch = deltaPitch / scaledScaledScaledAdjustedScaledSensitivityStep;
|
||||
double divisorX = Math.abs(Math.round(scaledDeltaYaw) - scaledDeltaYaw);
|
||||
double divisorY = Math.abs(Math.round(scaledDeltaPitch) - scaledDeltaPitch);
|
||||
if (divisorY > 0.03 && divisorX < 1.0E-4) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("divisorX=" + divisorX + " divisorY=" + divisorY);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.aim.sensitivity;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
|
||||
@CheckInfo(name = "Aim", type = 'U', complexType = "GCD Flaw", description = "GCD bypass.")
|
||||
public class AimU extends AbstractCheck {
|
||||
|
||||
public AimU(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isRotationUpdatePacket(packetEvent)) && (this.getAttackTicks() < 3)) {
|
||||
RotationTracker rotationTracker = this.playerData.getRotationTracker();
|
||||
boolean hasValidSensitivity2 = rotationTracker.hasValidSensitivity();
|
||||
if (hasValidSensitivity2) {
|
||||
double sensitivityStep = this.playerData.getRotationTracker().getSensitivityStep();
|
||||
float adjustedScaledSensitivityStep = (float) sensitivityStep * 0.6F + 0.2F;
|
||||
float scaledScaledScaledAdjustedScaledSensitivityStep = adjustedScaledSensitivityStep * adjustedScaledSensitivityStep * adjustedScaledSensitivityStep * 1.2F;
|
||||
RotationTracker rotationTracker2 = this.playerData.getRotationTracker();
|
||||
float yaw = rotationTracker2.getYaw();
|
||||
RotationTracker rotationTracker3 = this.playerData.getRotationTracker();
|
||||
float pitch = rotationTracker3.getPitch();
|
||||
float yawDifference = yaw - yaw % scaledScaledScaledAdjustedScaledSensitivityStep;
|
||||
float pitchDifference = pitch - pitch % scaledScaledScaledAdjustedScaledSensitivityStep;
|
||||
float yawDiff = Math.abs(yaw - yawDifference);
|
||||
float pitchDifference2 = Math.abs(pitch - pitchDifference);
|
||||
if (yawDiff == 0.01F || pitchDifference2 == 0.01F) {
|
||||
this.fail("[I] yawDiff=" + yawDiff + " pitchDiff=" + pitchDifference2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoblock;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity.InteractAction;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
|
||||
@CheckInfo(name = "Auto Block", type = 'A', complexType = "Sequence", description = "Attacked while sending BlockPlace packet.")
|
||||
public class AutoBlockA extends AbstractCheck {
|
||||
|
||||
public AutoBlockA(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if (this.isAttackPacket(packetEvent)) {
|
||||
if (this.playerData.getLastInteractionPacket().getAction() == InteractAction.ATTACK) {
|
||||
boolean itemUseReceived = this.playerData.getMotionState().isItemUseReceived();
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CLIENT_VERSION });
|
||||
if (itemUseReceived && !exempt) {
|
||||
this.fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoblock;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity.InteractAction;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
|
||||
@CheckInfo(name = "Auto Block", type = 'B', complexType = "Packet", description = "Attacked while sending BlockDig packet.")
|
||||
public class AutoBlockB extends AbstractCheck {
|
||||
|
||||
public AutoBlockB(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if (this.isAttackPacket(packetEvent)) {
|
||||
if (this.playerData.getLastInteractionPacket().getAction() == InteractAction.ATTACK) {
|
||||
boolean releaseUseItemReceived = this.playerData.getMotionState().isReleaseUseItemReceived();
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CLIENT_VERSION });
|
||||
if (releaseUseItemReceived && !exempt) {
|
||||
this.fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoblock;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity.InteractAction;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
|
||||
@CheckInfo(name = "Auto Block", type = 'C', complexType = "Order", description = "Attacked while sending BlockDig packet.")
|
||||
public class AutoBlockC extends AbstractCheck {
|
||||
|
||||
private static final String SWORD_MATERIAL_SUFFIX = "SWORD";
|
||||
|
||||
public AutoBlockC(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if (this.isAttackPacket(packetEvent)) {
|
||||
if (this.playerData.getLastInteractionPacket().getAction() == InteractAction.ATTACK) {
|
||||
if (this.playerData.getPlayer() == null) {
|
||||
return;
|
||||
}
|
||||
boolean holdingSword = this.playerData.getPlayer().getItemInHand().getType().toString().contains(SWORD_MATERIAL_SUFFIX);
|
||||
boolean diggingPacketReceived = this.playerData.getMotionState().isDiggingPacketReceived();
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CLIENT_VERSION });
|
||||
if (diggingPacketReceived && holdingSword && !exempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail();
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoblock;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
|
||||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity.InteractAction;
|
||||
|
||||
@CheckInfo(name = "Auto Block", type = 'D', complexType = "Order", description = "Invalid attack order.")
|
||||
public class AutoBlockD extends AbstractCheck {
|
||||
|
||||
private boolean interacted;
|
||||
|
||||
private boolean attacked;
|
||||
|
||||
public AutoBlockD(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if (this.isMovementPacket(packetEvent)) {
|
||||
this.attacked = false;
|
||||
this.interacted = false;
|
||||
} else if (this.isAttackPacket(packetEvent)) {
|
||||
WrapperPlayClientInteractEntity interaction = this.playerData.getLastInteractionPacket();
|
||||
if (interaction.getAction() == InteractAction.ATTACK) {
|
||||
this.attacked = true;
|
||||
}
|
||||
if (interaction.getAction() == InteractAction.INTERACT || interaction.getAction() == InteractAction.INTERACT_AT) {
|
||||
this.interacted = true;
|
||||
}
|
||||
} else if (this.isBlockPlacementPacket(packetEvent)) {
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CLIENT_VERSION });
|
||||
if (!exempt && this.attacked && !this.interacted) {
|
||||
this.fail("a=" + this.attacked + " i=" + this.interacted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.consistency;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'H', complexType = "Average Deviation", description = "Similar deviation values.")
|
||||
public class AutoClickerH extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
private double previousDeviation;
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "difference=";
|
||||
|
||||
public AutoClickerH(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 20) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 20) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double previousDeviation2;
|
||||
previousDeviation2 = MathUtils.rootSumSquaredDeviations((Collection) deque2);
|
||||
double previousDeviation2Difference = Math.abs(previousDeviation2 - this.previousDeviation);
|
||||
double previousDeviation2DifferenceDifference;
|
||||
int index = (previousDeviation2DifferenceDifference = previousDeviation2Difference - 7.52) == 0.0 ? 0 : (previousDeviation2DifferenceDifference < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index >= 0) {
|
||||
this.decayBuffer();
|
||||
this.previousDeviation = previousDeviation2;
|
||||
} else {
|
||||
double previousDeviationDifference;
|
||||
index = (previousDeviationDifference = this.increaseBuffer() - this.previousDeviation) == 0.0 ? 0 : (previousDeviationDifference < 0.0 ? -1 : 1);
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + previousDeviation2Difference);
|
||||
}
|
||||
this.previousDeviation = previousDeviation2;
|
||||
}
|
||||
} else {
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + previousDeviation2Difference);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.previousDeviation = previousDeviation2;
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.consistency;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'K', complexType = "Average Difference", description = "Similar average values.")
|
||||
public class AutoClickerK extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
private double previousAverage;
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "difference=";
|
||||
|
||||
public AutoClickerK(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double previousAverage2;
|
||||
previousAverage2 = MathUtils.average((Collection) deque2);
|
||||
double previousAverage2Difference = Math.abs(previousAverage2 - this.previousAverage);
|
||||
double previousAverage2DifferenceDifference;
|
||||
int index = (previousAverage2DifferenceDifference = previousAverage2Difference - 2.56) == 0.0 ? 0 : (previousAverage2DifferenceDifference < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index >= 0) {
|
||||
this.decayBuffer();
|
||||
this.previousAverage = previousAverage2;
|
||||
} else {
|
||||
double previousAverageDifference;
|
||||
index = (previousAverageDifference = this.increaseBuffer() - this.previousAverage) == 0.0 ? 0 : (previousAverageDifference < 0.0 ? -1 : 1);
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + previousAverage2Difference);
|
||||
}
|
||||
this.previousAverage = previousAverage2;
|
||||
}
|
||||
} else {
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + previousAverage2Difference);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.previousAverage = previousAverage2;
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.consistency;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'L', complexType = "Kurtosis Difference", description = "Similar kurtosis values.")
|
||||
public class AutoClickerL extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
private double previousKurtosis;
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "difference=";
|
||||
|
||||
public AutoClickerL(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double previousKurtosis2;
|
||||
previousKurtosis2 = MathUtils.kurtosis((Collection) deque2) / 1000.0;
|
||||
double previousKurtosis2Difference = Math.abs(previousKurtosis2 - this.previousKurtosis);
|
||||
double previousKurtosis2DifferenceDifference;
|
||||
int index = (previousKurtosis2DifferenceDifference = previousKurtosis2Difference - 8.35) == 0.0 ? 0 : (previousKurtosis2DifferenceDifference < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index >= 0) {
|
||||
this.decayBuffer();
|
||||
this.previousKurtosis = previousKurtosis2;
|
||||
} else {
|
||||
double previousKurtosisDifference;
|
||||
index = (previousKurtosisDifference = this.increaseBuffer() - this.previousKurtosis) == 0.0 ? 0 : (previousKurtosisDifference < 0.0 ? -1 : 1);
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + previousKurtosis2Difference);
|
||||
}
|
||||
this.previousKurtosis = previousKurtosis2;
|
||||
}
|
||||
} else {
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + previousKurtosis2Difference);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.previousKurtosis = previousKurtosis2;
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.consistency;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'M', complexType = "Variance Difference", description = "Similar variance values.")
|
||||
public class AutoClickerM extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
private double previousSquaredDeviations;
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "difference=";
|
||||
|
||||
public AutoClickerM(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double previousSquaredDeviations2;
|
||||
previousSquaredDeviations2 = MathUtils.sumSquaredDeviations((Collection) deque2) / 1000.0;
|
||||
double previousSquaredDeviations2Difference = Math.abs(previousSquaredDeviations2 - this.previousSquaredDeviations);
|
||||
double previousSquaredDeviations2DifferenceDifference;
|
||||
int index = (previousSquaredDeviations2DifferenceDifference = previousSquaredDeviations2Difference - 5.28) == 0.0 ? 0 : (previousSquaredDeviations2DifferenceDifference < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index >= 0) {
|
||||
this.decayBuffer();
|
||||
this.previousSquaredDeviations = previousSquaredDeviations2;
|
||||
} else {
|
||||
double previousSquaredDeviationsDifference;
|
||||
index = (previousSquaredDeviationsDifference = this.increaseBuffer() - this.previousSquaredDeviations) == 0.0 ? 0 : (previousSquaredDeviationsDifference < 0.0 ? -1 : 1);
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + previousSquaredDeviations2Difference);
|
||||
}
|
||||
this.previousSquaredDeviations = previousSquaredDeviations2;
|
||||
}
|
||||
} else {
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + previousSquaredDeviations2Difference);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.previousSquaredDeviations = previousSquaredDeviations2;
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.consistency;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import java.util.Collection;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.collection.list.EvictingList;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'N', complexType = "Deviation Difference", description = "Low deviation difference.")
|
||||
public class AutoClickerN extends AbstractCheck {
|
||||
|
||||
private final EvictingList<Long> clickIntervals = new EvictingList<>(25);
|
||||
|
||||
private double previousDeviation;
|
||||
|
||||
public AutoClickerN(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
me.frep.vulcan.spigot.collection.list.EvictingList<Long> evictingList2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int index = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
evictingList2 = this.clickIntervals;
|
||||
index = (evictingList2.isFull() ? 1 : 0);
|
||||
if (index == 0) {
|
||||
return;
|
||||
}
|
||||
evictingList2 = this.clickIntervals;
|
||||
} else {
|
||||
if (index == 0) {
|
||||
return;
|
||||
}
|
||||
evictingList2 = this.clickIntervals;
|
||||
}
|
||||
double previousDeviation2;
|
||||
previousDeviation2 = MathUtils.rootSumSquaredDeviations((Collection) evictingList2);
|
||||
double difference = Math.abs(previousDeviation2 - this.previousDeviation);
|
||||
double scaledAdjustedPreviousDeviation2 = Math.abs(previousDeviation2 + this.previousDeviation) / 2.0;
|
||||
double differenceDifference;
|
||||
int index2 = (differenceDifference = difference - 0.25) == 0.0 ? 0 : (differenceDifference < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index2 >= 0) {
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
double scaledAdjustedPreviousDeviation2Difference;
|
||||
index2 = (scaledAdjustedPreviousDeviation2Difference = scaledAdjustedPreviousDeviation2 - 150.0) == 0.0 ? 0 : (scaledAdjustedPreviousDeviation2Difference < 0.0 ? -1 : 1);
|
||||
if (index2 >= 0) {
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
double previousDeviationDifference;
|
||||
index2 = (previousDeviationDifference = this.increaseBuffer() - this.previousDeviation) == 0.0 ? 0 : (previousDeviationDifference < 0.0 ? -1 : 1);
|
||||
if (!(index2 <= 0)) {
|
||||
this.fail("difference=" + difference + " average=" + scaledAdjustedPreviousDeviation2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!(index2 <= 0)) {
|
||||
this.fail("difference=" + difference + " average=" + scaledAdjustedPreviousDeviation2);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.previousDeviation = previousDeviation2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.consistency;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'P', complexType = "Identical", description = "Identical statistical values.")
|
||||
public class AutoClickerP extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
private double previousDeviation;
|
||||
|
||||
private double previousSkewness;
|
||||
|
||||
private double previousKurtosis;
|
||||
|
||||
public AutoClickerP(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 15) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 15) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double deviation = MathUtils.rootSumSquaredDeviations((Collection) deque2);
|
||||
double skewness = MathUtils.skewness((Collection) this.clickIntervals);
|
||||
double kurtosis = MathUtils.kurtosis((Collection) this.clickIntervals);
|
||||
if (abstractChecks == null) {
|
||||
boolean identical = deviation - this.previousDeviation == 0.0 && skewness - this.previousSkewness == 0.0 && kurtosis - this.previousKurtosis == 0.0;
|
||||
if (!identical) {
|
||||
this.setBuffer();
|
||||
} else {
|
||||
double bufferDifference = this.increaseBuffer() - this.previousDeviation;
|
||||
if (!(bufferDifference <= 0.0)) {
|
||||
this.fail();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
double deviationDifference = deviation - this.previousDeviation;
|
||||
if (!(deviationDifference <= 0.0)) {
|
||||
this.fail();
|
||||
this.setBuffer();
|
||||
}
|
||||
}
|
||||
this.previousDeviation = deviation;
|
||||
this.previousSkewness = skewness;
|
||||
this.previousKurtosis = kurtosis;
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.consistency;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import java.util.Collection;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.collection.list.EvictingList;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'Q', complexType = "Average Deviation", description = "Too low average deviation.")
|
||||
public class AutoClickerQ extends AbstractCheck {
|
||||
|
||||
private final EvictingList<Long> clickIntervals = new EvictingList<>(40);
|
||||
|
||||
private double previousDeviation;
|
||||
|
||||
public AutoClickerQ(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
me.frep.vulcan.spigot.collection.list.EvictingList<Long> evictingList2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int index = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
evictingList2 = this.clickIntervals;
|
||||
index = (evictingList2.isFull() ? 1 : 0);
|
||||
if (index == 0) {
|
||||
return;
|
||||
}
|
||||
evictingList2 = this.clickIntervals;
|
||||
} else {
|
||||
if (index == 0) {
|
||||
return;
|
||||
}
|
||||
evictingList2 = this.clickIntervals;
|
||||
}
|
||||
double previousDeviation2;
|
||||
previousDeviation2 = MathUtils.rootSumSquaredDeviations((Collection) evictingList2);
|
||||
double difference = Math.abs(previousDeviation2 - this.previousDeviation);
|
||||
double scaledAdjustedPreviousDeviation2 = Math.abs(previousDeviation2 + this.previousDeviation) / 2.0;
|
||||
double differenceDifference;
|
||||
int index2 = (differenceDifference = difference - 3.0) == 0.0 ? 0 : (differenceDifference < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index2 >= 0) {
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
double scaledAdjustedPreviousDeviation2Difference;
|
||||
index2 = (scaledAdjustedPreviousDeviation2Difference = scaledAdjustedPreviousDeviation2 - 150.0) == 0.0 ? 0 : (scaledAdjustedPreviousDeviation2Difference < 0.0 ? -1 : 1);
|
||||
if (index2 >= 0) {
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
double previousDeviationDifference;
|
||||
index2 = (previousDeviationDifference = this.increaseBuffer() - this.previousDeviation) == 0.0 ? 0 : (previousDeviationDifference < 0.0 ? -1 : 1);
|
||||
if (!(index2 <= 0)) {
|
||||
this.fail("difference=" + difference + " average=" + scaledAdjustedPreviousDeviation2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!(index2 <= 0)) {
|
||||
this.fail("difference=" + difference + " average=" + scaledAdjustedPreviousDeviation2);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.previousDeviation = previousDeviation2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.consistency;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import java.util.Collection;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.collection.list.EvictingList;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'R', complexType = "Consistency", description = "Impossible consistency.")
|
||||
public class AutoClickerR extends AbstractCheck {
|
||||
|
||||
private final EvictingList<Long> clickIntervals = new EvictingList<>(30);
|
||||
|
||||
public AutoClickerR(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
double average2;
|
||||
long index2;
|
||||
AbstractCheck[] abstractCheckArray;
|
||||
long longValue4;
|
||||
int index;
|
||||
boolean armAnimationPacket;
|
||||
abstractCheckArray = AutoClickerT.getAbstractChecks();
|
||||
armAnimationPacket = this.isArmAnimationPacket((packetEvent));
|
||||
if ((abstractCheckArray == null)) {
|
||||
if (!armAnimationPacket)
|
||||
return;
|
||||
ExemptType[] value = new ExemptType[] { ExemptType.AUTOCLICKER };
|
||||
armAnimationPacket = this.isExempt(value);
|
||||
if (armAnimationPacket)
|
||||
return;
|
||||
} else if (armAnimationPacket)
|
||||
return;
|
||||
long clickInterval = this.playerData.getClickTimingData().getClickInterval();
|
||||
long clickIntervalDifference = clickInterval - 5000L;
|
||||
index = clickIntervalDifference == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractCheckArray == null) {
|
||||
if (index > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
index = this.clickIntervals.isFull() ? 1 : 0;
|
||||
}
|
||||
if ((abstractCheckArray == null)) {
|
||||
if (index == 0)
|
||||
return;
|
||||
index = (int) this.clickIntervals.stream().filter(longValue -> AutoClickerR.isLongClickInterval(longValue)).count();
|
||||
}
|
||||
index2 = index;
|
||||
Collection<Long> clickIntervals2 = this.clickIntervals;
|
||||
average2 = MathUtils.average(clickIntervals2);
|
||||
longValue4 = index2;
|
||||
if ((abstractCheckArray == null)) {
|
||||
if ((longValue4 == 0L)) {
|
||||
double maximumBufferDifference = this.increaseBuffer() - this.maximumBuffer;
|
||||
longValue4 = maximumBufferDifference == 0.0 ? 0 : (maximumBufferDifference > 0.0 ? 1 : -1);
|
||||
if (longValue4 <= 0)
|
||||
return;
|
||||
Object adjustedAverage2 = null;
|
||||
adjustedAverage2 = "outliers=" + (int) index2 + " average=" + average2;
|
||||
this.fail(adjustedAverage2);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (longValue4 <= 0)
|
||||
return;
|
||||
Object adjustedAverage22 = null;
|
||||
adjustedAverage22 = "outliers=" + (int) index2 + " average=" + average2;
|
||||
this.fail(adjustedAverage22);
|
||||
}
|
||||
this.decayBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
|
||||
private static boolean isLongClickInterval(Long longValue) {
|
||||
AbstractCheck[] abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
long longValue2;
|
||||
int index = (longValue2 = longValue - 150L) == 0L ? 0 : (longValue2 < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
index = index > 0 ? 1 : 0;
|
||||
}
|
||||
return (index != 0);
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'B', complexType = "Deviation", description = "Too low standard deviation.")
|
||||
public class AutoClickerB extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
public AutoClickerB(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double deviation = MathUtils.rootSumSquaredDeviations((Collection) deque2);
|
||||
double average2 = MathUtils.average((Collection) this.clickIntervals);
|
||||
double deviationDifference;
|
||||
int index = (deviationDifference = deviation - 167.0) == 0.0 ? 0 : (deviationDifference < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (!(index >= 0)) {
|
||||
double maximumBufferDifference;
|
||||
index = (maximumBufferDifference = this.increaseBuffer() - this.maximumBuffer) == 0.0 ? 0 : (maximumBufferDifference < 0.0 ? -1 : 1);
|
||||
if (index > 0) {
|
||||
this.fail("deviation=" + deviation + " average=" + average2);
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
} else if (index > 0) {
|
||||
this.fail("deviation=" + deviation + " average=" + average2);
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'D', complexType = "Skewness", description = "Too low skewness values.")
|
||||
public class AutoClickerD extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
private static final String STATISTIC_NAME = "skewness";
|
||||
|
||||
public AutoClickerD(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double skewness2 = MathUtils.skewness((Collection) deque2);
|
||||
double skewness2Difference;
|
||||
int index = (skewness2Difference = skewness2 - -0.01) == 0.0 ? 0 : (skewness2Difference < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index >= 0) {
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
double maximumBufferDifference;
|
||||
index = (maximumBufferDifference = this.increaseBuffer() - this.maximumBuffer) == 0.0 ? 0 : (maximumBufferDifference < 0.0 ? -1 : 1);
|
||||
if (!(index <= 0)) {
|
||||
this.fail(STATISTIC_NAME + skewness2);
|
||||
}
|
||||
}
|
||||
} else if (!(index <= 0)) {
|
||||
this.fail(STATISTIC_NAME + skewness2);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'E', complexType = "Variance", description = "Too low variance.")
|
||||
public class AutoClickerE extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "variance=";
|
||||
|
||||
public AutoClickerE(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double amount = MathUtils.sumSquaredDeviations((Collection) deque2);
|
||||
double amount2 = amount / 1000.0;
|
||||
double amount3;
|
||||
int index = (amount3 = amount2 - 28.2) == 0.0 ? 0 : (amount3 < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index >= 0) {
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
double maximumBufferDifference;
|
||||
index = (maximumBufferDifference = this.increaseBuffer() - this.maximumBuffer) == 0.0 ? 0 : (maximumBufferDifference < 0.0 ? -1 : 1);
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + amount2);
|
||||
}
|
||||
}
|
||||
} else if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + amount2);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'F', complexType = "Distinct", description = "Not enough distinct values.")
|
||||
public class AutoClickerF extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "distinct=";
|
||||
|
||||
public AutoClickerF(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
dequeSize = this.clickIntervals.size();
|
||||
}
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
dequeSize = MathUtils.distinctCount(this.clickIntervals);
|
||||
}
|
||||
int dequeSize2 = dequeSize;
|
||||
int dequeSize22 = dequeSize2;
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize2 >= 13) {
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
double maximumBufferDifference;
|
||||
dequeSize22 = (maximumBufferDifference = this.increaseBuffer() - this.maximumBuffer) == 0.0 ? 0 : (maximumBufferDifference < 0.0 ? -1 : 1);
|
||||
if (!(dequeSize22 <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + dequeSize2);
|
||||
}
|
||||
}
|
||||
} else if (!(dequeSize22 <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + dequeSize2);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'G', complexType = "Outliers", description = "Too low outliers.")
|
||||
public class AutoClickerG extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
public AutoClickerG(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
long index22;
|
||||
double average2;
|
||||
long index2;
|
||||
AbstractCheck[] abstractCheckArray;
|
||||
int index;
|
||||
boolean armAnimationPacket;
|
||||
abstractCheckArray = AutoClickerT.getAbstractChecks();
|
||||
armAnimationPacket = this.isArmAnimationPacket((packetEvent));
|
||||
if ((abstractCheckArray == null)) {
|
||||
if (!armAnimationPacket)
|
||||
return;
|
||||
ExemptType[] value = new ExemptType[] { ExemptType.AUTOCLICKER };
|
||||
armAnimationPacket = this.isExempt(value);
|
||||
if (armAnimationPacket)
|
||||
return;
|
||||
} else if (armAnimationPacket)
|
||||
return;
|
||||
long clickInterval = this.playerData.getClickTimingData().getClickInterval();
|
||||
long clickIntervalDifference = clickInterval - 5000L;
|
||||
index = clickIntervalDifference == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractCheckArray == null) {
|
||||
if (index > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
index = this.clickIntervals.size();
|
||||
}
|
||||
if ((abstractCheckArray == null)) {
|
||||
if (index != 50)
|
||||
return;
|
||||
index = (int) this.clickIntervals.stream().filter(longValue -> AutoClickerG.isLongClickInterval(longValue)).count();
|
||||
}
|
||||
index2 = index;
|
||||
Collection<Long> clickIntervals2 = this.clickIntervals;
|
||||
average2 = MathUtils.average(clickIntervals2);
|
||||
index22 = index2;
|
||||
if ((abstractCheckArray == null)) {
|
||||
if (!(index22 >= 3)) {
|
||||
double maximumBufferDifference = this.increaseBuffer() - this.maximumBuffer;
|
||||
index22 = maximumBufferDifference == 0.0 ? 0 : (maximumBufferDifference > 0.0 ? 1 : -1);
|
||||
if (!(index22 <= 0)) {
|
||||
Object adjustedAverage2 = null;
|
||||
adjustedAverage2 = "outliers=" + (int) index2 + " average=" + average2;
|
||||
this.fail(adjustedAverage2);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
} else if (!(index22 <= 0)) {
|
||||
Object adjustedAverage22 = null;
|
||||
adjustedAverage22 = "outliers=" + (int) index2 + " average=" + average2;
|
||||
this.fail(adjustedAverage22);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
|
||||
private static boolean isLongClickInterval(Long longValue) {
|
||||
AbstractCheck[] abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
long longValue2;
|
||||
int index = (longValue2 = longValue - 150L) == 0L ? 0 : (longValue2 < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
index = index > 0 ? 1 : 0;
|
||||
}
|
||||
return (index != 0);
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'I', complexType = "Kurtosis", description = "Too low kurtosis.")
|
||||
public class AutoClickerI extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "kurtosis=";
|
||||
|
||||
public AutoClickerI(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 50) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double kurtosis2 = MathUtils.kurtosis((Collection) deque2);
|
||||
double scaledKurtosis2 = kurtosis2 / 1000.0;
|
||||
double scaledKurtosis2Difference;
|
||||
int index = (scaledKurtosis2Difference = scaledKurtosis2 - 41.78) == 0.0 ? 0 : (scaledKurtosis2Difference < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index >= 0) {
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
double maximumBufferDifference;
|
||||
index = (maximumBufferDifference = this.increaseBuffer() - this.maximumBuffer) == 0.0 ? 0 : (maximumBufferDifference < 0.0 ? -1 : 1);
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + scaledKurtosis2);
|
||||
}
|
||||
}
|
||||
} else if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + scaledKurtosis2);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'J', complexType = "Range", description = "Impossible consistency.")
|
||||
public class AutoClickerJ extends AbstractCheck {
|
||||
|
||||
private final List<Long> clickIntervals = Lists.newArrayList();
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "range=";
|
||||
|
||||
public AutoClickerJ(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.lang.Object items2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int itemsSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (itemsSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
items2 = this.clickIntervals;
|
||||
itemsSize = this.clickIntervals.size();
|
||||
if (itemsSize != 10) {
|
||||
return;
|
||||
}
|
||||
Collections.sort(this.clickIntervals);
|
||||
items2 = this.clickIntervals.get(this.clickIntervals.size() - 1);
|
||||
} else {
|
||||
if (itemsSize != 10) {
|
||||
return;
|
||||
}
|
||||
Collections.sort(this.clickIntervals);
|
||||
items2 = this.clickIntervals.get(this.clickIntervals.size() - 1);
|
||||
}
|
||||
long items2Difference = (Long) items2 - (Long) this.clickIntervals.get(0);
|
||||
long items2DifferenceDifference;
|
||||
int index = (items2DifferenceDifference = items2Difference - 50L) == 0L ? 0 : (items2DifferenceDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index >= 0) {
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
double maximumBufferDifference;
|
||||
index = (maximumBufferDifference = this.increaseBuffer() - this.maximumBuffer) == 0.0 ? 0 : (maximumBufferDifference < 0.0 ? -1 : 1);
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + items2Difference);
|
||||
}
|
||||
}
|
||||
} else if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + items2Difference);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.collection.list.EvictingList;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'S', complexType = "Distinct", description = "Checks for amount of distinct delays.")
|
||||
public class AutoClickerS extends AbstractCheck {
|
||||
|
||||
private final EvictingList<Long> clickIntervals = new EvictingList<>(25);
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "distinct=";
|
||||
|
||||
public AutoClickerS(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int index = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
index = (this.clickIntervals.isFull() ? 1 : 0);
|
||||
}
|
||||
if (abstractChecks == null) {
|
||||
if (index == 0) {
|
||||
return;
|
||||
}
|
||||
index = MathUtils.distinctCount(this.clickIntervals);
|
||||
}
|
||||
int index2;
|
||||
index2 = index;
|
||||
int index3 = index2;
|
||||
if (abstractChecks == null) {
|
||||
if (!(index2 >= 6)) {
|
||||
double maximumBufferDifference;
|
||||
index3 = (maximumBufferDifference = this.increaseBuffer() - this.maximumBuffer) == 0.0 ? 0 : (maximumBufferDifference < 0.0 ? -1 : 1);
|
||||
if (index3 <= 0) {
|
||||
return;
|
||||
}
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + index2);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (index3 <= 0) {
|
||||
return;
|
||||
}
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + index2);
|
||||
}
|
||||
this.decayBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import java.util.Collection;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.collection.list.EvictingList;
|
||||
import me.frep.vulcan.spigot.config.VulcanSettings;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'T', complexType = "Kurtosis", description = "Too low kurtosis")
|
||||
public class AutoClickerT extends AbstractCheck {
|
||||
|
||||
private final EvictingList<Long> clickIntervals = new EvictingList<>(25);
|
||||
|
||||
private static AbstractCheck[] abstractChecks;
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX;
|
||||
|
||||
public AutoClickerT(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
me.frep.vulcan.spigot.collection.list.EvictingList<Long> evictingList2;
|
||||
AbstractCheck[] abstractChecks2;
|
||||
abstractChecks2 = getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks2 == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int index = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks2 == null) {
|
||||
if (index > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
evictingList2 = this.clickIntervals;
|
||||
index = (evictingList2.isFull() ? 1 : 0);
|
||||
if (index == 0) {
|
||||
return;
|
||||
}
|
||||
evictingList2 = this.clickIntervals;
|
||||
} else {
|
||||
if (index == 0) {
|
||||
return;
|
||||
}
|
||||
evictingList2 = this.clickIntervals;
|
||||
}
|
||||
double scaledKurtosis = MathUtils.kurtosis((Collection) evictingList2) / 1000.0;
|
||||
if (abstractChecks2 == null) {
|
||||
ClickTimingData clickTimingData2 = this.playerData.getClickTimingData();
|
||||
clickTimingData2.setKurtosis(scaledKurtosis);
|
||||
if (scaledKurtosis < VulcanSettings.checksCombatAutoclickerTMinKurtosis) {
|
||||
if (!(this.increaseBuffer() > this.maximumBuffer)) {
|
||||
return;
|
||||
}
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + scaledKurtosis);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.decayBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
|
||||
public static void setAbstractChecks(AbstractCheck[] abstractChecks2) {
|
||||
abstractChecks = abstractChecks2;
|
||||
}
|
||||
|
||||
public static AbstractCheck[] getAbstractChecks() {
|
||||
return abstractChecks;
|
||||
}
|
||||
|
||||
static {
|
||||
if (getAbstractChecks() != null) {
|
||||
setAbstractChecks(new AbstractCheck[2]);
|
||||
}
|
||||
VIOLATION_DETAIL_PREFIX = "kurtosis=";
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.rate;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.config.VulcanSettings;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'A', complexType = "Limit", description = "Left clicking too quickly.")
|
||||
public class AutoClickerA extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals;
|
||||
|
||||
private long lastClickAtMillis;
|
||||
|
||||
public AutoClickerA(PlayerData playerData) {
|
||||
super(playerData);
|
||||
this.clickIntervals = Lists.newLinkedList();
|
||||
this.lastClickAtMillis = 0L;
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
long lastClickAtMillis2;
|
||||
double amount;
|
||||
double clicksPerSecond2;
|
||||
boolean armAnimationPacket;
|
||||
AbstractCheck[] abstractCheckArray;
|
||||
abstractCheckArray = AutoClickerT.getAbstractChecks();
|
||||
armAnimationPacket = this.isArmAnimationPacket((packetEvent));
|
||||
if ((abstractCheckArray == null)) {
|
||||
if (!armAnimationPacket)
|
||||
return;
|
||||
armAnimationPacket = this.isExempt((new ExemptType[] { ExemptType.AUTOCLICKER_NON_DIG }));
|
||||
}
|
||||
if (armAnimationPacket)
|
||||
return;
|
||||
lastClickAtMillis2 = System.currentTimeMillis();
|
||||
long lastClickAtMillis2Difference = lastClickAtMillis2 - this.lastClickAtMillis;
|
||||
this.clickIntervals.add(lastClickAtMillis2Difference);
|
||||
if ((abstractCheckArray == null)) {
|
||||
if ((this.clickIntervals.size() == 20)) {
|
||||
Collection<Long> clickIntervals2 = this.clickIntervals;
|
||||
clicksPerSecond2 = MathUtils.clicksPerSecond(clickIntervals2);
|
||||
double clicksPerSecond2Difference = clicksPerSecond2 - (double) VulcanSettings.checksCombatAutoclickerAMaxCps;
|
||||
amount = clicksPerSecond2Difference == 0.0 ? 0 : (clicksPerSecond2Difference > 0.0 ? 1 : -1);
|
||||
if (!(amount <= 0)) {
|
||||
double clicksPerSecond2Difference2 = clicksPerSecond2 - 5.0;
|
||||
amount = clicksPerSecond2Difference2 == 0.0 ? 0 : (clicksPerSecond2Difference2 > 0.0 ? 1 : -1);
|
||||
if (amount > 0) {
|
||||
this.fail("cps=" + clicksPerSecond2);
|
||||
}
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
}
|
||||
this.lastClickAtMillis = lastClickAtMillis2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.rate;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'C', complexType = "Rounded", description = "Rounded CPS values.")
|
||||
public class AutoClickerC extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals = Lists.newLinkedList();
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX = "difference=";
|
||||
|
||||
public AutoClickerC(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 20) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 20) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double clicksPerSecond2 = MathUtils.clicksPerSecond((Collection) deque2);
|
||||
double clicksPerSecond2Difference = Math.abs(Math.round(clicksPerSecond2) - clicksPerSecond2);
|
||||
double clicksPerSecond2DifferenceDifference;
|
||||
int index = (clicksPerSecond2DifferenceDifference = clicksPerSecond2Difference - 0.08) == 0.0 ? 0 : (clicksPerSecond2DifferenceDifference < 0.0 ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (index >= 0) {
|
||||
this.decayBuffer();
|
||||
} else {
|
||||
double maximumBufferDifference;
|
||||
index = (maximumBufferDifference = this.increaseBuffer() - this.maximumBuffer) == 0.0 ? 0 : (maximumBufferDifference < 0.0 ? -1 : 1);
|
||||
if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + clicksPerSecond2Difference);
|
||||
}
|
||||
}
|
||||
} else if (!(index <= 0)) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + clicksPerSecond2Difference);
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.autoclicker.rate;
|
||||
|
||||
import me.frep.vulcan.spigot.check.impl.combat.autoclicker.distribution.AutoClickerT;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.click.ClickTimingData;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
|
||||
@CheckInfo(name = "Auto Clicker", type = 'O', complexType = "Spikes", description = "Impossible spike in CPS.")
|
||||
public class AutoClickerO extends AbstractCheck {
|
||||
|
||||
private final Deque<Long> clickIntervals;
|
||||
|
||||
private double previousCps;
|
||||
|
||||
public AutoClickerO(PlayerData playerData) {
|
||||
super(playerData);
|
||||
this.clickIntervals = Lists.newLinkedList();
|
||||
this.previousCps = -1.0;
|
||||
AutoClickerT.setAbstractChecks(new AbstractCheck[1]);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
int index;
|
||||
java.util.Deque<Long> deque2;
|
||||
AbstractCheck[] abstractChecks;
|
||||
abstractChecks = AutoClickerT.getAbstractChecks();
|
||||
boolean armAnimationPacket = this.isArmAnimationPacket(packetEvent);
|
||||
if (abstractChecks == null) {
|
||||
if (!armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
armAnimationPacket = this.isExempt(new ExemptType[] { ExemptType.AUTOCLICKER });
|
||||
if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
} else if (armAnimationPacket) {
|
||||
return;
|
||||
}
|
||||
PlayerData playerData = this.playerData;
|
||||
ClickTimingData clickTimingData = playerData.getClickTimingData();
|
||||
long clickInterval = clickTimingData.getClickInterval();
|
||||
long clickIntervalDifference;
|
||||
int dequeSize = (clickIntervalDifference = clickInterval - 5000L) == 0L ? 0 : (clickIntervalDifference < 0L ? -1 : 1);
|
||||
if (abstractChecks == null) {
|
||||
if (dequeSize > 0) {
|
||||
this.clickIntervals.clear();
|
||||
return;
|
||||
}
|
||||
this.clickIntervals.add(clickInterval);
|
||||
deque2 = this.clickIntervals;
|
||||
dequeSize = this.clickIntervals.size();
|
||||
if (dequeSize != 10) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
} else {
|
||||
if (dequeSize != 10) {
|
||||
return;
|
||||
}
|
||||
deque2 = this.clickIntervals;
|
||||
}
|
||||
double previousCps2 = MathUtils.clicksPerSecond((Collection) deque2);
|
||||
if (abstractChecks == null) {
|
||||
if (this.previousCps > 0.0) {
|
||||
double previousCps2Difference;
|
||||
double average;
|
||||
previousCps2Difference = Math.abs(previousCps2 - this.previousCps);
|
||||
average = (this.previousCps + previousCps2) / 2.0;
|
||||
double averageDifference;
|
||||
index = (averageDifference = average - 9.25) == 0.0 ? 0 : (averageDifference < 0.0 ? -1 : 1);
|
||||
if (index <= 0) {
|
||||
index = 0;
|
||||
} else {
|
||||
double previousCps2DifferenceDifference;
|
||||
index = (previousCps2DifferenceDifference = previousCps2Difference - 2.8) == 0.0 ? 0 : (previousCps2DifferenceDifference < 0.0 ? -1 : 1);
|
||||
if (index > 0) {
|
||||
index = 1;
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
int index2 = index;
|
||||
int index3 = index2;
|
||||
if (index2 == 0) {
|
||||
this.decayBuffer();
|
||||
this.previousCps = previousCps2;
|
||||
} else {
|
||||
double previousCpsDifference;
|
||||
index3 = (previousCpsDifference = this.increaseBuffer() - this.previousCps) == 0.0 ? 0 : (previousCpsDifference < 0.0 ? -1 : 1);
|
||||
if (!(index3 <= 0)) {
|
||||
this.fail("average=" + average + " difference=" + previousCps2Difference);
|
||||
}
|
||||
this.previousCps = previousCps2;
|
||||
}
|
||||
} else {
|
||||
this.previousCps = previousCps2;
|
||||
}
|
||||
}
|
||||
this.clickIntervals.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.criticals;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.collision.CollisionState;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
|
||||
@CheckInfo(name = "Criticals", type = 'A', complexType = "Ground", description = "Tried to hit Critical hit on ground.")
|
||||
public class CriticalsA extends AbstractCheck {
|
||||
|
||||
public CriticalsA(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isAttackPacket(packetEvent)) && (this.getAttackTicks() < 2)) {
|
||||
double deltaY;
|
||||
double yRemainder;
|
||||
boolean condition;
|
||||
CollisionState collisionState = this.playerData.getCollisionState();
|
||||
deltaY = Math.abs(collisionState.getDeltaY());
|
||||
CollisionState collisionState2 = this.playerData.getCollisionState();
|
||||
yRemainder = collisionState2.getY() % 0.015625;
|
||||
condition = (this.isExempt(new ExemptType[] { ExemptType.LIQUID, ExemptType.TRAPDOOR, ExemptType.COLLIDING_VERTICALLY, ExemptType.TELEPORT, ExemptType.BOAT, ExemptType.TELEPORT, ExemptType.WEB, ExemptType.ENDER_PEARL, ExemptType.CHORUS_FRUIT, ExemptType.ELYTRA, ExemptType.SERVER_POSITION, ExemptType.CARPET, ExemptType.VEHICLE, ExemptType.FARMLAND, ExemptType.GLIDING, ExemptType.SLAB })) || (((this.playerData.getCollisionState()).isLantern()) || (((this.playerData.getCollisionState()).isFlowerPot()) || ((this.playerData.getCollisionState().isNearDirtPath()) || (this.playerData.getCollisionState().isNearCactus()))));
|
||||
boolean condition2 = condition;
|
||||
if (Math.abs(deltaY - 7.504558659832128E-4) < 0.001) {
|
||||
return;
|
||||
}
|
||||
boolean condition3 = deltaY < 0.001 && deltaY > 0.0 && yRemainder < 1.0E-5 || deltaY == 0.0625;
|
||||
if (condition3 && !condition2) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("deltaY=" + deltaY + " modulo=" + yRemainder);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.criticals;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.player.collision.CollisionState;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
|
||||
@CheckInfo(name = "Criticals", type = 'B', complexType = "Modulo", description = "Tried to hit Critical hit on ground.")
|
||||
public class CriticalsB extends AbstractCheck {
|
||||
|
||||
private static final String VIOLATION_DETAIL_PREFIX;
|
||||
|
||||
public CriticalsB(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if ((this.isAttackPacket(packetEvent)) && (this.getAttackTicks() < 2)) {
|
||||
CollisionState collisionState = this.playerData.getCollisionState();
|
||||
double yRemainder = collisionState.getY() % 0.015625;
|
||||
boolean condition = yRemainder < 1.0E-5 && yRemainder > 0.0;
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.LIQUID, ExemptType.TRAPDOOR, ExemptType.COLLIDING_VERTICALLY, ExemptType.BOAT, ExemptType.TELEPORT, ExemptType.WEB, ExemptType.ENDER_PEARL, ExemptType.CHORUS_FRUIT, ExemptType.SERVER_POSITION, ExemptType.VEHICLE, ExemptType.FLIGHT, ExemptType.SLAB, ExemptType.STAIRS });
|
||||
if (condition && !exempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail(VIOLATION_DETAIL_PREFIX + yRemainder);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
|
||||
static {
|
||||
VIOLATION_DETAIL_PREFIX = "modulo=";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.fastbow;
|
||||
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptionManager;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
|
||||
@CheckInfo(name = "Fast Bow", type = 'A', complexType = "Limit", description = "Shooting a bow too quickly")
|
||||
public class FastBowA extends AbstractCheck {
|
||||
|
||||
private long lastShotAtMillis;
|
||||
|
||||
public FastBowA(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
if (!(event instanceof ProjectileLaunchEvent launch) || !(launch.getEntity() instanceof Arrow arrow))
|
||||
return;
|
||||
Player player = playerData.getPlayer();
|
||||
if (player == null)
|
||||
return;
|
||||
String mainHandType = player.getInventory().getItemInMainHand().getType().name();
|
||||
String offHandType = ExemptionManager.isAtLeast1_9() ? player.getInventory().getItemInOffHand().getType().name() : "";
|
||||
if (mainHandType.contains("CROSS") || offHandType.contains("CROSS"))
|
||||
return;
|
||||
if (!mainHandType.contains("BOW") && !offHandType.contains("BOW"))
|
||||
return;
|
||||
if (ExemptionManager.isAtLeast1_14() && (player.getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.MULTISHOT) > 0 || player.getInventory().getItemInOffHand().getEnchantmentLevel(Enchantment.MULTISHOT) > 0))
|
||||
return;
|
||||
double velocityLength = arrow.getVelocity().length();
|
||||
if (velocityLength <= 2.0)
|
||||
return;
|
||||
long now = System.currentTimeMillis();
|
||||
long shotDelay = now - lastShotAtMillis;
|
||||
if (shotDelay < 750L && !isExempt(new ExemptType[] { ExemptType.FAST, ExemptType.ELYTRA, ExemptType.GLIDING })) {
|
||||
if (increaseBuffer() > maximumBuffer)
|
||||
fail("length=" + velocityLength + " delay=" + shotDelay);
|
||||
} else
|
||||
decayBuffer();
|
||||
lastShotAtMillis = now;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.hitbox;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity.InteractAction;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptionManager;
|
||||
import me.frep.vulcan.spigot.config.VulcanSettings;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import me.frep.vulcan.spigot.tracker.rotation.RotationTracker;
|
||||
import me.frep.vulcan.spigot.collection.tuple.Pair;
|
||||
import me.frep.vulcan.spigot.util.numbers.MathUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@CheckInfo(name = "Hitbox", type = 'A', complexType = "History", description = "Attacked while not looking at target.")
|
||||
public class HitboxA extends AbstractCheck {
|
||||
|
||||
private boolean pendingAttack;
|
||||
|
||||
public HitboxA(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent event) {
|
||||
if (this.isAttackPacket(event)) {
|
||||
if (this.playerData.getLastInteractionPacket().getAction() != InteractAction.ATTACK || !(this.playerData.getRelativeMoveTracker().getLastAttackedEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
this.pendingAttack = true;
|
||||
} else if (this.isMovementPacket(event)) {
|
||||
if (!this.pendingAttack) {
|
||||
return;
|
||||
}
|
||||
int currentTick = PluginServices.INSTANCE.getTickProcessor().getTotalTicks();
|
||||
int latencyTicks = MathUtils.pingCompensationTicks(this.playerData);
|
||||
double x = this.playerData.getCollisionState().getX();
|
||||
double z = this.playerData.getCollisionState().getZ();
|
||||
Vector origin = new Vector(x, 0.0, z);
|
||||
double minAngle = this.playerData.getRelativeMoveTracker().getTargetPositions().stream().filter(entry -> HitboxA.isRecentTargetPosition(currentTick, latencyTicks, entry)).mapToDouble(entry -> this.calculateAimDistance(origin, entry)).min().orElse(-1.0);
|
||||
double distance = this.playerData.getRelativeMoveTracker().getTargetDistance();
|
||||
if (minAngle == -1.0) {
|
||||
this.decreaseBuffer(0.025);
|
||||
this.pendingAttack = false;
|
||||
return;
|
||||
}
|
||||
Player target = this.playerData.getRelativeMoveTracker().getPlayer();
|
||||
PlayerData targetData = PluginServices.INSTANCE.getPlayerDataStore().getPlayerData(target);
|
||||
if (targetData == null) {
|
||||
return;
|
||||
}
|
||||
boolean vehicleExempt = targetData.getPlayerToggles().isAnyExempt(new ExemptType[] { ExemptType.VEHICLE, ExemptType.BOAT });
|
||||
double maxAngle = VulcanSettings.checksCombatHitboxAMaxAngle;
|
||||
if (System.currentTimeMillis() - this.playerData.getConnectionTracker().getLastFastMovementAtMillis() < 1500L) {
|
||||
maxAngle += 0.25;
|
||||
}
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CREATIVE, ExemptType.GLIDING, ExemptType.VEHICLE });
|
||||
double deltaXZ = this.playerData.getCollisionState().getDeltaXZ();
|
||||
float deltaYaw = this.playerData.getRotationTracker().getDeltaYaw();
|
||||
boolean outsideNearDistance = distance > (ExemptionManager.isAtLeast1_9() ? 0.25 : 0.75);
|
||||
if (minAngle > maxAngle && outsideNearDistance && distance < 10.0 && !exempt && !vehicleExempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("angle=" + minAngle + " distance=" + distance + " dYaw=" + deltaYaw + " dXZ=" + deltaXZ);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
this.pendingAttack = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
|
||||
private Vector getPosition(float yaw, float pitch) {
|
||||
Vector direction = new Vector();
|
||||
double yawRadians = yaw;
|
||||
double pitchRadians = pitch;
|
||||
direction.setY(-Math.sin(Math.toRadians(pitchRadians)));
|
||||
double horizontal = Math.cos(Math.toRadians(pitchRadians));
|
||||
direction.setX(-horizontal * Math.sin(Math.toRadians(yawRadians)));
|
||||
direction.setZ(horizontal * Math.cos(Math.toRadians(yawRadians)));
|
||||
return direction;
|
||||
}
|
||||
|
||||
private double calculateAimDistance(Vector origin, Pair entry) {
|
||||
Vector offset = ((Location) entry.getFirst()).toVector().setY(0.0);
|
||||
Vector toTarget = offset.clone().subtract(origin);
|
||||
RotationTracker rotation = this.playerData.getRotationTracker();
|
||||
Vector look = this.getPosition(rotation.getYaw(), rotation.getPitch()).setY(0.0);
|
||||
return toTarget.angle(look);
|
||||
}
|
||||
|
||||
private static boolean isRecentTargetPosition(int currentTick, int latencyTicks, Pair entry) {
|
||||
return Math.abs(currentTick - (Integer) entry.getSecond() - latencyTicks) < 3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package me.frep.vulcan.spigot.check.impl.combat.hitbox;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import me.frep.vulcan.spigot.check.AbstractCheck;
|
||||
import me.frep.vulcan.spigot.check.api.CheckInfo;
|
||||
import me.frep.vulcan.spigot.player.session.PlayerData;
|
||||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity.InteractAction;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptType;
|
||||
import me.frep.vulcan.spigot.check.exemption.ExemptionManager;
|
||||
import me.frep.vulcan.spigot.config.VulcanSettings;
|
||||
import me.frep.vulcan.spigot.lifecycle.PluginServices;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@CheckInfo(name = "Hitbox", type = 'B', complexType = "Simple", description = "Attacked while not looking at target.")
|
||||
public class HitboxB extends AbstractCheck {
|
||||
|
||||
private boolean pendingAttack;
|
||||
|
||||
private Player targetPlayer;
|
||||
|
||||
public HitboxB(PlayerData playerData) {
|
||||
super(playerData);
|
||||
}
|
||||
|
||||
public void handlePacket(PacketEvent packetEvent) {
|
||||
if (this.isAttackPacket(packetEvent)) {
|
||||
if (this.playerData.getLastInteractionPacket().getAction() != InteractAction.ATTACK || !(this.playerData.getRelativeMoveTracker().getLastAttackedEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
this.pendingAttack = true;
|
||||
} else if (this.isMovementPacket(packetEvent)) {
|
||||
if (this.pendingAttack && this.targetPlayer != null) {
|
||||
PlayerData targetData = PluginServices.INSTANCE.getPlayerDataStore().getPlayerData(this.targetPlayer);
|
||||
if (targetData == null) {
|
||||
return;
|
||||
}
|
||||
double offsetX = targetData.getCollisionState().getX() - this.playerData.getCollisionState().getX();
|
||||
double offsetZ = targetData.getCollisionState().getZ() - this.playerData.getCollisionState().getZ();
|
||||
float yaw = this.playerData.getRotationTracker().getYaw();
|
||||
Vector look = new Vector(-Math.sin(yaw * (float) Math.PI / 180.0F) * 0.5, 0.0, Math.cos(yaw * (float) Math.PI / 180.0F) * 0.5);
|
||||
Vector toTarget = new Vector(offsetX, 0.0, offsetZ);
|
||||
double distance = this.playerData.getRelativeMoveTracker().getTargetDistance();
|
||||
double angle = Math.toDegrees(toTarget.angle(look));
|
||||
double maximumAngle = VulcanSettings.checksCombatHitboxBMaxAngle;
|
||||
boolean targetExempt = targetData.getPlayerToggles().isAnyExempt(new ExemptType[] { ExemptType.VEHICLE, ExemptType.BOAT });
|
||||
boolean exempt = this.isExempt(new ExemptType[] { ExemptType.CREATIVE, ExemptType.VEHICLE, ExemptType.DEATH });
|
||||
boolean outsideNearDistance = distance > (ExemptionManager.isAtLeast1_9() ? 0.3 : 0.8);
|
||||
if (distance < 1.0) {
|
||||
maximumAngle += 0.45;
|
||||
}
|
||||
if (angle > maximumAngle && outsideNearDistance && distance < 10.0 && !exempt && !targetExempt) {
|
||||
if (this.increaseBuffer() > this.maximumBuffer) {
|
||||
this.fail("angle=" + angle + " distance=" + distance);
|
||||
}
|
||||
} else {
|
||||
this.decayBuffer();
|
||||
}
|
||||
}
|
||||
this.pendingAttack = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
Loaded 100 of 356 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user