diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index dfe0770..0000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto diff --git a/README.md b/README.md index f8c8e58..832f5c6 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,33 @@ # FlappyAC - -Flappy-Anticheat is an anticheat I'm making to learn how anticheats and packets work. If anyone wants to help out you can report false flags, suggestions or help out with pull requests. -I doubt this will become good enough to be used for any proper server, but I'm hoping to have fun developing this at least. -And yes I know this code probably burns your eyes, but I will make it better as I learn this (and more java) +[![Build Status](https://ci.imjustdoom.com/job/FlappyAC/badge/icon?style=flat-square)](https://ci.imjustdoom.com/view/MCArchive/job/FlappyAC) +[![Discord Server](https://img.shields.io/discord/979589333524820018?color=7289da&label=DISCORD&style=flat-square&logo=appveyor)](https://discord.gg/k8RcgxpnBS) -I am using PacketEvents by retrooper for packets. +[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/L3L64M1TB) + +FlappyAC is a free anticheat, I started it because I wanted to learn anticheat development as it seemed fun (And it was!). FlappyAC aims to support Minecraft versions 1.8+ and should work on Spigot and any forks that don't mess with packet stuff like TacoSpigot (I think). + +This may not receive any more updates anymore as I don't really have motivation for this any more. Anyone is welcome to fork this and continue it or use it as "inspiration" for there anticheat as long as I get some credit. + +## Why use FlappyAC? +- Compatible with 1.8 - 1.19 servers (Soon:tm:) +- It will be free forever! +- It has an API you can use to develop addons! + +## Helping out +Want to help us out? + +### Donating +Donating is a way to support the project, me and any hosting costs. You can make one time donations or subscribe monthly on our [kofi](https://ko-fi.com/justdoom) page. + +### Contributing +Another way you can help is contributing to the project. You can make a pull request with more features or find bugs and report them. + +## Support +I provide support for this project in my discord server [here](https://discord.gg/wVCSqV7ptB). Or you can open an issue in tbe [issues](https://github.com/JustDoom/FlappyAC/issues) tab. + +## Requiements +FlappyAC doesn't require any external plugins but needs Java 8 as a minimum to run. + +## Building +To build this for yourself you will have to clone this repository, import it into your favourite IDE then run the maven package command. The built file will be in a folder called `out`. Alternativly I have dev builds available [here](https://ci.imjustdoom.com/job/FlappyAC) on my jenkins. diff --git a/credits.txt b/credits.txt deleted file mode 100644 index aaec450..0000000 --- a/credits.txt +++ /dev/null @@ -1,6 +0,0 @@ -I have *borrowed* some code from some peoples anticheats so I will list them off here. I have made the base myself though -Anticheat | Developer | For -Juaga | Salers | Main Fly A check -Tutorial Series | funkemonkey | Bit of check code here and there -Tutorial Series | Jonhan | Little bit of check code here and there and some badpacket checks -Optimus | notOM3GA | Main GroundSpoof A Check \ No newline at end of file diff --git a/paper/src/main/resources/config.yml b/paper/src/main/resources/config.yml new file mode 100644 index 0000000..7510681 --- /dev/null +++ b/paper/src/main/resources/config.yml @@ -0,0 +1,369 @@ +# DO NOT CHANGE +config-version: 1 + +prefix: "&9FlappyAC " + +settings: + output-to-console: false + join-exemption: 5000 + send-brand-message: true + # Time in seconds + violation-reset-delay: 600 + +alerts: + toggle-alerts-on: "Alerts have been toggled on" + toggle-alerts-off: "Alerts have been toggled off" + failed-check: "&2%player% &7failed &2%check%&7(&2%checktype%&7) &2%vl%&7/&2%maxvl%" + player-join: "&2%player% &7joined using &2%brand%&7/&2%version%" + hover: | + &7Description: &2%description% + &7Debug: &2%debug% + &7TPS: &2%tps% + &7Ping: &2%ping% + click-commands: + - "tp %player%" + - "gamemode spectator" + +menu: + name: "FlappyAC Menu" + checks: + name: "&b%check%" + lore: + - "%description%" + - "Enabled: %enabled%" + +#Messages should not have colour codes +logs: + punishment-log: + enabled: true + message: "%player% has been punished for %check%(%checktype%)" + violation-log: + enabled: true + message: "%player% failed %check%(%checktype%) %vl%/%maxvl%" + +messages: + reload: "&7Reloaded the config" + reset-all-violations: "&7Reset violations" + profile: | + Version: %version% + Brand: %brand% + Total VL: %total% + Combat: %combat% + Movement: %movement% + Player: %player% + +checks: + #------------------------- + # Movement + #------------------------- + nofall: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 5 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + b: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 5 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + noslow: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 10 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + b: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 2 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + fly: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + b: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + c: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 5 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + boatfly: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 5 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + b: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + fastclimb: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 10 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + speed: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 25 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + b: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + c: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + step: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 10 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + + #------------------------- + # Combat + #------------------------- + criticals: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + aura: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + + #------------------------- + # Player + #------------------------- + inventory: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 2 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + b: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + #Currently falses + c: + enabled: false + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + scaffold: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + b: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + skinblinker: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + timer: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + badpackets: + a: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 1 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + b: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + c: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 20 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + d: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 5 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + e: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 5 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + f: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 5 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + g: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 5 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + h: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 5 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" + i: + enabled: true + min-tps: 17.0 + punishable: true + broadcast-punishment: true + vl: 1 + punish-vl: 5 + punish-commands: + - "kick %player% FlappyAC > Suspicious Activity" \ No newline at end of file diff --git a/paper/src/main/resources/plugin.yml b/paper/src/main/resources/plugin.yml new file mode 100644 index 0000000..f40dcc7 --- /dev/null +++ b/paper/src/main/resources/plugin.yml @@ -0,0 +1,22 @@ +name: FlappyAnticheat +version: ${project.version} +main: com.imjustdoom.flappyanticheat.FlappyAnticheatPlugin +api-version: 1.13 +load: POSTWORLD +permissions: + flappyac.bypass: + description: Allows bypassing + + flappyac.alerts: + description: Allows viewing of alerts + + flappyac.commands: + description: Commands permission + +commands: + flappyac: + aliases: flappyanticheat + permission: flappyac.commands + + flappyachoverclick: + permission: flappyac.commands \ No newline at end of file diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 854373b..0000000 --- a/pom.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - 4.0.0 - - com.justdoom - FlappyAnticheat - 1.7.0-BETA - jar - - FlappyAnticheat - - - 1.8 - UTF-8 - 8 - 8 - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - package - - shade - - - true - false - - - io.github.retrooper.packetevents - io.github.retrooper.customplugin.packetevents - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - - - src/main/resources - true - - - - - - - spigotmc-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - jitpack-repo - https://jitpack.io/ - - - - - - org.spigotmc - spigot-api - 1.16.5-R0.1-SNAPSHOT - provided - - - com.github.retrooper - packetevents - v1.8-pre-16 - compile - - - \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/ConfigCache.java b/src/main/java/com/justdoom/flappyanticheat/ConfigCache.java deleted file mode 100644 index 224561d..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/ConfigCache.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.justdoom.flappyanticheat; - -import org.bukkit.configuration.file.FileConfiguration; - -public class ConfigCache { - - public FileConfiguration configuration; - - public ConfigCache(){ - configuration = FlappyAnticheat.getInstance().getConfig(); - } - - public void reloadConfig(){ - FlappyAnticheat.getInstance().reloadConfig(); - configuration = FlappyAnticheat.getInstance().getConfig(); - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/FlappyAnticheat.java b/src/main/java/com/justdoom/flappyanticheat/FlappyAnticheat.java deleted file mode 100644 index 97cbda4..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/FlappyAnticheat.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.justdoom.flappyanticheat; - -import com.justdoom.flappyanticheat.checks.CheckManager; -import com.justdoom.flappyanticheat.commands.FlagClickCommand; -import com.justdoom.flappyanticheat.commands.FlappyACCommand; -import com.justdoom.flappyanticheat.commands.tabcomplete.FlappyAnticheatTabCompletion; -import com.justdoom.flappyanticheat.data.FileData; -import com.justdoom.flappyanticheat.data.PlayerDataManager; -import com.justdoom.flappyanticheat.listener.PlayerConnectionListener; -import com.justdoom.flappyanticheat.utils.BrandMessageUtil; -import com.justdoom.flappyanticheat.utils.UpdateChecker; -import com.justdoom.flappyanticheat.violations.ViolationHandler; -import io.github.retrooper.packetevents.PacketEvents; -import io.github.retrooper.packetevents.settings.PacketEventsSettings; -import io.github.retrooper.packetevents.utils.server.ServerVersion; -import org.bukkit.Bukkit; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.plugin.messaging.Messenger; - -import java.util.concurrent.Callable; - -public final class FlappyAnticheat extends JavaPlugin { - - private static FlappyAnticheat instance; - - public static FlappyAnticheat getInstance() { - return instance; - } - - public ViolationHandler violationHandler; - public PlayerDataManager dataManager; - public FileData fileData; - public ConfigCache config; - - public FlappyAnticheat(){ - instance = this; - } - - //Load PacketEvents - - @Override - public void onLoad(){ - PacketEvents.create(this); - PacketEventsSettings settings = PacketEvents.get().getSettings(); - settings - .fallbackServerVersion(ServerVersion.v_1_16_5) - .compatInjector(false) - .checkForUpdates(false); - PacketEvents.get().loadAsyncNewThread(); - } - - @Override - public void onEnable() { - loadModules(); - - //Check for updates - - (new UpdateChecker(this, 92180)).getVersion(version -> { - if (!config.configuration.getBoolean("disable-update-checker")) - if (getDescription().getVersion().equalsIgnoreCase(version)) { - getLogger().info("There is not a new update available."); - } else { - getLogger().info("There is a new update available."); - } - }); - - saveDefaultConfig(); - - //Load metrics - - int pluginId = 11300; - Metrics metrics = new Metrics(this, pluginId); - - metrics.addCustomChart(new Metrics.SimplePie("used_language", new Callable() { - @Override - public String call() throws Exception { - return getConfig().getString("language", "en"); - } - })); - - //Register incoming plugin channel for client brand - - Messenger messenger = Bukkit.getMessenger(); - messenger.registerIncomingPluginChannel(FlappyAnticheat.getInstance(), "minecraft:brand", new BrandMessageUtil()); - - //Register events - this.getServer().getPluginManager().registerEvents(new PlayerConnectionListener(this), this); - - //Register commands - this.getCommand("flappyanticheat").setExecutor(new FlappyACCommand()); - this.getCommand("flappyacflagclick").setExecutor(new FlagClickCommand()); - - //Register Tab completion - this.getCommand("flappyanticheat").setTabCompleter(new FlappyAnticheatTabCompletion()); - - PacketEvents.get().init(); - } - - @Override - public void onDisable() { - //Disable PacketEvents - - PacketEvents.get().terminate(); - } - - public void loadModules(){ - config = new ConfigCache(); - CheckManager checkManager = new CheckManager(this); - checkManager.loadChecks(); - dataManager = new PlayerDataManager(); - fileData = new FileData(); - violationHandler = new ViolationHandler(); - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/Metrics.java b/src/main/java/com/justdoom/flappyanticheat/Metrics.java deleted file mode 100644 index 5e844e1..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/Metrics.java +++ /dev/null @@ -1,729 +0,0 @@ -package com.justdoom.flappyanticheat; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.JsonPrimitive; -import org.bukkit.Bukkit; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.ServicePriority; - -import javax.net.ssl.HttpsURLConnection; -import java.io.*; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.concurrent.Callable; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.zip.GZIPOutputStream; - -/** - * bStats collects some data for plugin authors. - *

- * Check out https://bStats.org/ to learn more about bStats! - */ -@SuppressWarnings({"WeakerAccess", "unused"}) -public class Metrics { - - static { - // You can use the property to disable the check in your test environment - if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) { - // Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D - final String defaultPackage = new String( - new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't'}); - final String examplePackage = new String(new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'}); - // We want to make sure nobody just copy & pastes the example and use the wrong package names - if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class.getPackage().getName().equals(examplePackage)) { - throw new IllegalStateException("bStats Metrics class has not been relocated correctly!"); - } - } - } - - // Executor service for requests - // We use an executor service because the Bukkit scheduler is affected by server lags - private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); - - // The version of this bStats class - public static final int B_STATS_VERSION = 1; - - // The url to which the data is sent - private static final String URL = "https://bStats.org/submitData/bukkit"; - - // Is bStats enabled on this server? - private boolean enabled; - - // Should failed requests be logged? - private static boolean logFailedRequests; - - // Should the sent data be logged? - private static boolean logSentData; - - // Should the response text be logged? - private static boolean logResponseStatusText; - - // The uuid of the server - private static String serverUUID; - - // The plugin - private final Plugin plugin; - - // The plugin id - private final int pluginId; - - // A list with all custom charts - private final List charts = new ArrayList<>(); - - /** - * Class constructor. - * - * @param plugin The plugin which stats should be submitted. - * @param pluginId The id of the plugin. - * It can be found at What is my plugin id? - */ - public Metrics(Plugin plugin, int pluginId) { - if (plugin == null) { - throw new IllegalArgumentException("Plugin cannot be null!"); - } - this.plugin = plugin; - this.pluginId = pluginId; - - // Get the config file - File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats"); - File configFile = new File(bStatsFolder, "config.yml"); - YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); - - // Check if the config file exists - if (!config.isSet("serverUuid")) { - - // Add default values - config.addDefault("enabled", true); - // Every server gets it's unique random id. - config.addDefault("serverUuid", UUID.randomUUID().toString()); - // Should failed request be logged? - config.addDefault("logFailedRequests", false); - // Should the sent data be logged? - config.addDefault("logSentData", false); - // Should the response text be logged? - config.addDefault("logResponseStatusText", false); - - // Inform the server owners about bStats - config.options().header( - "bStats collects some data for plugin authors like how many servers are using their plugins.\n" + - "To honor their work, you should not disable it.\n" + - "This has nearly no effect on the server performance!\n" + - "Check out https://bStats.org/ to learn more :)" - ).copyDefaults(true); - try { - config.save(configFile); - } catch (IOException ignored) { } - } - - // Load the data - enabled = config.getBoolean("enabled", true); - serverUUID = config.getString("serverUuid"); - logFailedRequests = config.getBoolean("logFailedRequests", false); - logSentData = config.getBoolean("logSentData", false); - logResponseStatusText = config.getBoolean("logResponseStatusText", false); - - if (enabled) { - boolean found = false; - // Search for all other bStats Metrics classes to see if we are the first one - for (Class service : Bukkit.getServicesManager().getKnownServices()) { - try { - service.getField("B_STATS_VERSION"); // Our identifier :) - found = true; // We aren't the first - break; - } catch (NoSuchFieldException ignored) { } - } - // Register our service - Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal); - if (!found) { - // We are the first! - startSubmitting(); - } - } - } - - /** - * Checks if bStats is enabled. - * - * @return Whether bStats is enabled or not. - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Adds a custom chart. - * - * @param chart The chart to add. - */ - public void addCustomChart(CustomChart chart) { - if (chart == null) { - throw new IllegalArgumentException("Chart cannot be null!"); - } - charts.add(chart); - } - - /** - * Starts the Scheduler which submits our data every 30 minutes. - */ - private void startSubmitting() { - final Runnable submitTask = () -> { - if (!plugin.isEnabled()) { // Plugin was disabled - scheduler.shutdown(); - return; - } - // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler - // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;) - Bukkit.getScheduler().runTask(plugin, this::submitData); - }; - - // Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution of requests on the - // bStats backend. To circumvent this problem, we introduce some randomness into the initial and second delay. - // WARNING: You must not modify and part of this Metrics class, including the submit delay or frequency! - // WARNING: Modifying this code will get your plugin banned on bStats. Just don't do it! - long initialDelay = (long) (1000 * 60 * (3 + Math.random() * 3)); - long secondDelay = (long) (1000 * 60 * (Math.random() * 30)); - scheduler.schedule(submitTask, initialDelay, TimeUnit.MILLISECONDS); - scheduler.scheduleAtFixedRate(submitTask, initialDelay + secondDelay, 1000 * 60 * 30, TimeUnit.MILLISECONDS); - } - - /** - * Gets the plugin specific data. - * This method is called using Reflection. - * - * @return The plugin specific data. - */ - public JsonObject getPluginData() { - JsonObject data = new JsonObject(); - - String pluginName = plugin.getDescription().getName(); - String pluginVersion = plugin.getDescription().getVersion(); - - data.addProperty("pluginName", pluginName); // Append the name of the plugin - data.addProperty("id", pluginId); // Append the id of the plugin - data.addProperty("pluginVersion", pluginVersion); // Append the version of the plugin - JsonArray customCharts = new JsonArray(); - for (CustomChart customChart : charts) { - // Add the data of the custom charts - JsonObject chart = customChart.getRequestJsonObject(); - if (chart == null) { // If the chart is null, we skip it - continue; - } - customCharts.add(chart); - } - data.add("customCharts", customCharts); - - return data; - } - - /** - * Gets the server specific data. - * - * @return The server specific data. - */ - private JsonObject getServerData() { - // Minecraft specific data - int playerAmount; - try { - // Around MC 1.8 the return type was changed to a collection from an array, - // This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection; - Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers"); - playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class) - ? ((Collection) onlinePlayersMethod.invoke(Bukkit.getServer())).size() - : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length; - } catch (Exception e) { - playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed - } - int onlineMode = Bukkit.getOnlineMode() ? 1 : 0; - String bukkitVersion = Bukkit.getVersion(); - String bukkitName = Bukkit.getName(); - - // OS/Java specific data - String javaVersion = System.getProperty("java.version"); - String osName = System.getProperty("os.name"); - String osArch = System.getProperty("os.arch"); - String osVersion = System.getProperty("os.version"); - int coreCount = Runtime.getRuntime().availableProcessors(); - - JsonObject data = new JsonObject(); - - data.addProperty("serverUUID", serverUUID); - - data.addProperty("playerAmount", playerAmount); - data.addProperty("onlineMode", onlineMode); - data.addProperty("bukkitVersion", bukkitVersion); - data.addProperty("bukkitName", bukkitName); - - data.addProperty("javaVersion", javaVersion); - data.addProperty("osName", osName); - data.addProperty("osArch", osArch); - data.addProperty("osVersion", osVersion); - data.addProperty("coreCount", coreCount); - - return data; - } - - /** - * Collects the data and sends it afterwards. - */ - private void submitData() { - final JsonObject data = getServerData(); - - JsonArray pluginData = new JsonArray(); - // Search for all other bStats Metrics classes to get their plugin data - for (Class service : Bukkit.getServicesManager().getKnownServices()) { - try { - service.getField("B_STATS_VERSION"); // Our identifier :) - - for (RegisteredServiceProvider provider : Bukkit.getServicesManager().getRegistrations(service)) { - try { - Object plugin = provider.getService().getMethod("getPluginData").invoke(provider.getProvider()); - if (plugin instanceof JsonObject) { - pluginData.add((JsonObject) plugin); - } else { // old bstats version compatibility - try { - Class jsonObjectJsonSimple = Class.forName("org.json.simple.JSONObject"); - if (plugin.getClass().isAssignableFrom(jsonObjectJsonSimple)) { - Method jsonStringGetter = jsonObjectJsonSimple.getDeclaredMethod("toJSONString"); - jsonStringGetter.setAccessible(true); - String jsonString = (String) jsonStringGetter.invoke(plugin); - JsonObject object = new JsonParser().parse(jsonString).getAsJsonObject(); - pluginData.add(object); - } - } catch (ClassNotFoundException e) { - // minecraft version 1.14+ - if (logFailedRequests) { - this.plugin.getLogger().log(Level.SEVERE, "Encountered unexpected exception", e); - } - } - } - } catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } - } - } catch (NoSuchFieldException ignored) { } - } - - data.add("plugins", pluginData); - - // Create a new thread for the connection to the bStats server - new Thread(() -> { - try { - // Send the data - sendData(plugin, data); - } catch (Exception e) { - // Something went wrong! :( - if (logFailedRequests) { - plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e); - } - } - }).start(); - } - - /** - * Sends the data to the bStats server. - * - * @param plugin Any plugin. It's just used to get a logger instance. - * @param data The data to send. - * @throws Exception If the request failed. - */ - private static void sendData(Plugin plugin, JsonObject data) throws Exception { - if (data == null) { - throw new IllegalArgumentException("Data cannot be null!"); - } - if (Bukkit.isPrimaryThread()) { - throw new IllegalAccessException("This method must not be called from the main thread!"); - } - if (logSentData) { - plugin.getLogger().info("Sending data to bStats: " + data); - } - HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection(); - - // Compress the data to save bandwidth - byte[] compressedData = compress(data.toString()); - - // Add headers - connection.setRequestMethod("POST"); - connection.addRequestProperty("Accept", "application/json"); - connection.addRequestProperty("Connection", "close"); - connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request - connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length)); - connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format - connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION); - - // Send data - connection.setDoOutput(true); - try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) { - outputStream.write(compressedData); - } - - StringBuilder builder = new StringBuilder(); - try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { - String line; - while ((line = bufferedReader.readLine()) != null) { - builder.append(line); - } - } - - if (logResponseStatusText) { - plugin.getLogger().info("Sent data to bStats and received response: " + builder); - } - } - - /** - * Gzips the given String. - * - * @param str The string to gzip. - * @return The gzipped String. - * @throws IOException If the compression failed. - */ - private static byte[] compress(final String str) throws IOException { - if (str == null) { - return null; - } - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - try (GZIPOutputStream gzip = new GZIPOutputStream(outputStream)) { - gzip.write(str.getBytes(StandardCharsets.UTF_8)); - } - return outputStream.toByteArray(); - } - - /** - * Represents a custom chart. - */ - public static abstract class CustomChart { - - // The id of the chart - final String chartId; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - */ - CustomChart(String chartId) { - if (chartId == null || chartId.isEmpty()) { - throw new IllegalArgumentException("ChartId cannot be null or empty!"); - } - this.chartId = chartId; - } - - private JsonObject getRequestJsonObject() { - JsonObject chart = new JsonObject(); - chart.addProperty("chartId", chartId); - try { - JsonObject data = getChartData(); - if (data == null) { - // If the data is null we don't send the chart. - return null; - } - chart.add("data", data); - } catch (Throwable t) { - if (logFailedRequests) { - Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t); - } - return null; - } - return chart; - } - - protected abstract JsonObject getChartData() throws Exception; - - } - - /** - * Represents a custom simple pie. - */ - public static class SimplePie extends CustomChart { - - private final Callable callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public SimplePie(String chartId, Callable callable) { - super(chartId); - this.callable = callable; - } - - @Override - protected JsonObject getChartData() throws Exception { - JsonObject data = new JsonObject(); - String value = callable.call(); - if (value == null || value.isEmpty()) { - // Null = skip the chart - return null; - } - data.addProperty("value", value); - return data; - } - } - - /** - * Represents a custom advanced pie. - */ - public static class AdvancedPie extends CustomChart { - - private final Callable> callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public AdvancedPie(String chartId, Callable> callable) { - super(chartId); - this.callable = callable; - } - - @Override - protected JsonObject getChartData() throws Exception { - JsonObject data = new JsonObject(); - JsonObject values = new JsonObject(); - Map map = callable.call(); - if (map == null || map.isEmpty()) { - // Null = skip the chart - return null; - } - boolean allSkipped = true; - for (Map.Entry entry : map.entrySet()) { - if (entry.getValue() == 0) { - continue; // Skip this invalid - } - allSkipped = false; - values.addProperty(entry.getKey(), entry.getValue()); - } - if (allSkipped) { - // Null = skip the chart - return null; - } - data.add("values", values); - return data; - } - } - - /** - * Represents a custom drilldown pie. - */ - public static class DrilldownPie extends CustomChart { - - private final Callable>> callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public DrilldownPie(String chartId, Callable>> callable) { - super(chartId); - this.callable = callable; - } - - @Override - public JsonObject getChartData() throws Exception { - JsonObject data = new JsonObject(); - JsonObject values = new JsonObject(); - Map> map = callable.call(); - if (map == null || map.isEmpty()) { - // Null = skip the chart - return null; - } - boolean reallyAllSkipped = true; - for (Map.Entry> entryValues : map.entrySet()) { - JsonObject value = new JsonObject(); - boolean allSkipped = true; - for (Map.Entry valueEntry : map.get(entryValues.getKey()).entrySet()) { - value.addProperty(valueEntry.getKey(), valueEntry.getValue()); - allSkipped = false; - } - if (!allSkipped) { - reallyAllSkipped = false; - values.add(entryValues.getKey(), value); - } - } - if (reallyAllSkipped) { - // Null = skip the chart - return null; - } - data.add("values", values); - return data; - } - } - - /** - * Represents a custom single line chart. - */ - public static class SingleLineChart extends CustomChart { - - private final Callable callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public SingleLineChart(String chartId, Callable callable) { - super(chartId); - this.callable = callable; - } - - @Override - protected JsonObject getChartData() throws Exception { - JsonObject data = new JsonObject(); - int value = callable.call(); - if (value == 0) { - // Null = skip the chart - return null; - } - data.addProperty("value", value); - return data; - } - - } - - /** - * Represents a custom multi line chart. - */ - public static class MultiLineChart extends CustomChart { - - private final Callable> callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public MultiLineChart(String chartId, Callable> callable) { - super(chartId); - this.callable = callable; - } - - @Override - protected JsonObject getChartData() throws Exception { - JsonObject data = new JsonObject(); - JsonObject values = new JsonObject(); - Map map = callable.call(); - if (map == null || map.isEmpty()) { - // Null = skip the chart - return null; - } - boolean allSkipped = true; - for (Map.Entry entry : map.entrySet()) { - if (entry.getValue() == 0) { - continue; // Skip this invalid - } - allSkipped = false; - values.addProperty(entry.getKey(), entry.getValue()); - } - if (allSkipped) { - // Null = skip the chart - return null; - } - data.add("values", values); - return data; - } - - } - - /** - * Represents a custom simple bar chart. - */ - public static class SimpleBarChart extends CustomChart { - - private final Callable> callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public SimpleBarChart(String chartId, Callable> callable) { - super(chartId); - this.callable = callable; - } - - @Override - protected JsonObject getChartData() throws Exception { - JsonObject data = new JsonObject(); - JsonObject values = new JsonObject(); - Map map = callable.call(); - if (map == null || map.isEmpty()) { - // Null = skip the chart - return null; - } - for (Map.Entry entry : map.entrySet()) { - JsonArray categoryValues = new JsonArray(); - categoryValues.add(new JsonPrimitive(entry.getValue())); - values.add(entry.getKey(), categoryValues); - } - data.add("values", values); - return data; - } - - } - - /** - * Represents a custom advanced bar chart. - */ - public static class AdvancedBarChart extends CustomChart { - - private final Callable> callable; - - /** - * Class constructor. - * - * @param chartId The id of the chart. - * @param callable The callable which is used to request the chart data. - */ - public AdvancedBarChart(String chartId, Callable> callable) { - super(chartId); - this.callable = callable; - } - - @Override - protected JsonObject getChartData() throws Exception { - JsonObject data = new JsonObject(); - JsonObject values = new JsonObject(); - Map map = callable.call(); - if (map == null || map.isEmpty()) { - // Null = skip the chart - return null; - } - boolean allSkipped = true; - for (Map.Entry entry : map.entrySet()) { - if (entry.getValue().length == 0) { - continue; // Skip this invalid - } - allSkipped = false; - JsonArray categoryValues = new JsonArray(); - for (int categoryValue : entry.getValue()) { - categoryValues.add(new JsonPrimitive(categoryValue)); - } - values.add(entry.getKey(), categoryValues); - } - if (allSkipped) { - // Null = skip the chart - return null; - } - data.add("values", values); - return data; - } - } - -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/Check.java b/src/main/java/com/justdoom/flappyanticheat/checks/Check.java deleted file mode 100644 index d126d95..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/Check.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.justdoom.flappyanticheat.checks; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.customevents.FlagEvent; -import com.justdoom.flappyanticheat.customevents.PunishEvent; -import com.justdoom.flappyanticheat.utils.Color; -import com.justdoom.flappyanticheat.utils.PlayerUtil; -import io.github.retrooper.packetevents.PacketEvents; -import io.github.retrooper.packetevents.event.PacketListenerAbstract; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ComponentBuilder; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.entity.Player; - -import java.util.concurrent.atomic.AtomicBoolean; - -public class Check extends PacketListenerAbstract { - - public String check, checkType; - public boolean experimental; - - public Check(String check, String checkType, boolean experimental) { - - this.check = check; - this.checkType = checkType; - this.experimental = experimental; - } - - public void fail(String debug, Player player) { - FlagEvent flagEvent = new FlagEvent(player, this); - Bukkit.getPluginManager().callEvent(flagEvent); - if(flagEvent.isCancelled()) { - return; - } - - if (player.hasPermission("flappyanticheat.bypass") || player.getGameMode() == GameMode.SPECTATOR || player.getGameMode() == GameMode.CREATIVE) - return; - - FlappyAnticheat.getInstance().violationHandler.addViolation(this, player); - - String flagmsg = FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.failed-check"); - flagmsg = flagmsg.replace("{player}", player.getName()).replace("{check}", this.check + " " + checkType).replace("{vl}", String.valueOf(FlappyAnticheat.getInstance().violationHandler.getViolations(this, player))); - String hover = FlappyAnticheat.getInstance().config.configuration.getString("messages.hover").replace("{ping}", String.valueOf(PlayerUtil.getPing(player))).replace("{debug}", debug).replace("{tps}", String.valueOf(PacketEvents.get().getServerUtils().getTPS())); - - if(experimental){ - flagmsg = flagmsg+"&r*"; - } - - TextComponent component = new TextComponent(Color.translate(flagmsg)); - component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Color.translate(hover)).create())); - component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/flappyacflagclick " + player.getName())); - - FlappyAnticheat.getInstance().dataManager.dataMap.values() - .stream().filter(playerData -> player.hasPermission("flappyanticheat.alerts") && !FlappyAnticheat.getInstance().dataManager.alertsDisabled.contains(player)) - .forEach(playerData -> playerData.player.spigot().sendMessage(component)); - - if (FlappyAnticheat.getInstance().config.configuration.getBoolean("messages.flag-to-console")) { - Bukkit.getConsoleSender().sendMessage(Color.translate(flagmsg)); - } - - FlappyAnticheat.getInstance().fileData.addToFile("violations.txt", "\n" + Color.translate(flagmsg + " " + debug)); - } - - public void punish(Player player, String path){ - PunishEvent punishEvent = new PunishEvent(player, this); - Bukkit.getPluginManager().callEvent(punishEvent); - if(punishEvent.isCancelled()) { - return; - } - - for(String command: FlappyAnticheat.getInstance().config.configuration.getStringList(path + ".punish-commands")) { - command = command.replace("{player}", player.getName()); - String finalCommand = command; - Bukkit.getScheduler().runTask(FlappyAnticheat.getInstance(), () -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), finalCommand)); - } - - if(FlappyAnticheat.getInstance().config.configuration.getBoolean(path + ".broadcast-punishment")) { - for (Player p : Bukkit.getOnlinePlayers()) { - p.sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("messages.punish")).replace("{player}", player.getName())); - } - } - } - - public void sync(Runnable runnable) { - AtomicBoolean waiting = new AtomicBoolean(true); - if (FlappyAnticheat.getInstance().isEnabled()) { - Bukkit.getScheduler().runTask(FlappyAnticheat.getInstance(), () -> { - runnable.run(); - waiting.set(false); - }); - } - while (waiting.get()) { - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/CheckData.java b/src/main/java/com/justdoom/flappyanticheat/checks/CheckData.java deleted file mode 100644 index f30557b..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/CheckData.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.justdoom.flappyanticheat.checks; - -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 CheckData { - - String name() default "Dg"; - String type () default "NONE"; - boolean experimental() default true; - -} diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/CheckManager.java b/src/main/java/com/justdoom/flappyanticheat/checks/CheckManager.java deleted file mode 100644 index 235d11c..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/CheckManager.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.justdoom.flappyanticheat.checks; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.checks.combat.forcefield.ForcefieldA; -import com.justdoom.flappyanticheat.checks.combat.reach.ReachA; -import com.justdoom.flappyanticheat.checks.movement.fly.FlyA; -import com.justdoom.flappyanticheat.checks.movement.groundspoof.GroundSpoofA; -import com.justdoom.flappyanticheat.checks.movement.jump.JumpA; -import com.justdoom.flappyanticheat.checks.movement.speed.SpeedA; -import com.justdoom.flappyanticheat.checks.player.anticactus.AntiCactusA; -import com.justdoom.flappyanticheat.checks.player.badpackets.BadPacketsA; -import com.justdoom.flappyanticheat.checks.player.badpackets.BadPacketsB; -import com.justdoom.flappyanticheat.checks.player.badpackets.BadPacketsC; -import com.justdoom.flappyanticheat.checks.player.badpackets.BadPacketsD; -import com.justdoom.flappyanticheat.checks.player.blockplace.BlockPlaceA; -import com.justdoom.flappyanticheat.checks.player.blockplace.BlockPlaceB; -import com.justdoom.flappyanticheat.checks.player.skinblinker.SkinBlinkerA; -import com.justdoom.flappyanticheat.checks.player.timer.TimerA; -import io.github.retrooper.packetevents.PacketEvents; -import org.bukkit.Bukkit; - -public class CheckManager { - - private final FlappyAnticheat plugin; - - public CheckManager(FlappyAnticheat plugin) { - this.plugin = plugin; - } - - public void loadChecks(){ - PacketEvents.get().registerListener(new GroundSpoofA()); - PacketEvents.get().registerListener(new FlyA()); - PacketEvents.get().registerListener(new JumpA()); - PacketEvents.get().registerListener(new BadPacketsA()); - PacketEvents.get().registerListener(new BadPacketsB()); - PacketEvents.get().registerListener(new BadPacketsC()); - PacketEvents.get().registerListener(new BadPacketsD()); - //PacketEvents.get().registerListener(new NoSlowA()); - PacketEvents.get().registerListener(new SkinBlinkerA()); - PacketEvents.get().registerListener(new AntiCactusA()); - PacketEvents.get().registerListener(new TimerA()); - PacketEvents.get().registerListener(new ForcefieldA()); - PacketEvents.get().registerListener(new ReachA()); - - Bukkit.getPluginManager().registerEvents(new BlockPlaceA(), plugin); - Bukkit.getPluginManager().registerEvents(new BlockPlaceB(), plugin); - Bukkit.getPluginManager().registerEvents(new SpeedA(), plugin); - //Bukkit.getPluginManager().registerEvents(new InventoryA(), plugin); - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/combat/forcefield/ForcefieldA.java b/src/main/java/com/justdoom/flappyanticheat/checks/combat/forcefield/ForcefieldA.java deleted file mode 100644 index 208d082..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/combat/forcefield/ForcefieldA.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.justdoom.flappyanticheat.checks.combat.forcefield; - -import com.justdoom.flappyanticheat.checks.Check; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; - -public class ForcefieldA extends Check { - - private long lastFlying; //when the last flying packet was sent - private int buffer; //for prevent falses - - public ForcefieldA() { - super("Forcefield", "A", false); - } - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - - if(event.getPacketId() == PacketType.Play.Client.FLYING || - event.getPacketId() == PacketType.Play.Client.POSITION_LOOK || - event.getPacketId() == PacketType.Play.Client.POSITION) { //packets sended every ticks - - this.lastFlying = System.currentTimeMillis(); //setting the value when a flying packet is sent - - }else if(event.getPacketId() == PacketType.Play.Client.USE_ENTITY) { - WrappedPacketInUseEntity wrapper = new WrappedPacketInUseEntity(event.getNMSPacket()); - if(wrapper.getAction() == WrappedPacketInUseEntity.EntityUseAction.ATTACK) { - if((System.currentTimeMillis() - this.lastFlying) < 10L) /** this value should be around 40**/ { - if(++this.buffer > 5) { - fail("dF=" +(System.currentTimeMillis() - this.lastFlying),event.getPlayer()); - } - - - }else buffer -= buffer > 0 ? 0.25 : 0; - } - } - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/combat/reach/ReachA.java b/src/main/java/com/justdoom/flappyanticheat/checks/combat/reach/ReachA.java deleted file mode 100644 index 66270f2..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/combat/reach/ReachA.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.justdoom.flappyanticheat.checks.combat.reach; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.data.PlayerData; -import com.justdoom.flappyanticheat.utils.PlayerUtil; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.event.impl.PacketPlaySendEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.util.BoundingBox; -import org.bukkit.util.Vector; - -import java.util.ArrayList; -import java.util.List; - -public class ReachA extends Check { - - private long lastKP; - private int preVL; - - - private List rayBB(PlayerData data, int ticks) { - List toReturn = new ArrayList<>(); - if (data.pastVictimBoxes.size() > 4) { - for (int range = 0; range < 2; range++) { - toReturn.add(data.pastVictimBoxes.get(ticks + range)); - } - } - return toReturn; - - - - } - - public ReachA() { - super("Reach", "A", false); - } - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - PlayerData data = FlappyAnticheat.getInstance().dataManager.getData(event.getPlayer().getUniqueId()); - - if (event.getPacketId() == PacketType.Play.Client.USE_ENTITY) { - WrappedPacketInUseEntity packet = new WrappedPacketInUseEntity(event.getNMSPacket()); - if (packet.getAction() == WrappedPacketInUseEntity.EntityUseAction.ATTACK) { - data.vicitm = (LivingEntity) packet.getEntity(); - if (data.pastVictimBoxes.size() != 0) { - int ticks = data.ping / 50; - List fromRay = this.rayBB(data,ticks); - Vector attacker = data.player.getEyeLocation().toVector(); - double distance = fromRay.stream().mapToDouble(bb -> PlayerUtil.getDistanceBB(bb,attacker)).min().orElse(0); - if(distance > 3.2D) { - if(this.preVL++ > 4) { - fail("d=" + (float) distance, data.player); - } - } else this.preVL *= 0.975; - //Bukkit.broadcastMessage("distance=" + distance); - - - } - - } - - } else if (event.getPacketId() == PacketType.Play.Client.KEEP_ALIVE) { - data.ping = (int) (System.currentTimeMillis() - this.lastKP); - } - - - } - - @Override - public void onPacketPlaySend(PacketPlaySendEvent event) { - if (event.getPacketId() == PacketType.Play.Server.KEEP_ALIVE) { - this.lastKP = System.currentTimeMillis(); - - } - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/movement/fly/FlyA.java b/src/main/java/com/justdoom/flappyanticheat/checks/movement/fly/FlyA.java deleted file mode 100644 index 2022eaa..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/movement/fly/FlyA.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.justdoom.flappyanticheat.checks.movement.fly; - -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.utils.PlayerUtil; -import com.justdoom.flappyanticheat.utils.ServerUtil; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class FlyA extends Check { - - private Map airTicks = new HashMap<>(); - private Map buffer = new HashMap<>(); - private Map lastDeltaY = new HashMap<>(); - - private Map inAir = new HashMap<>(); - - public FlyA(){ - super("Fly", "A", false); - } - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - - Player player = event.getPlayer(); - UUID uuid = player.getUniqueId(); - - double airTicks = this.airTicks.getOrDefault(uuid, 0.0); - boolean inAir = this.inAir.getOrDefault(uuid, false); - - //measuring how many ticks the player has an air block below them for - airTicks = inAir ? airTicks + 1 : 0; - - this.airTicks.put(uuid, airTicks); - - if (event.getPacketId() == PacketType.Play.Client.POSITION || event.getPacketId() == PacketType.Play.Client.POSITION_LOOK) { - - WrappedPacketInFlying packet = new WrappedPacketInFlying(event.getNMSPacket()); - - //dont run the check if they have /fly on or are creative flying - if (player.isFlying()) return; - - if(ServerUtil.lowTPS(("checks." + check + "." + checkType).toLowerCase())) - return; - - //check if the blocks below the player are air blocks. not entirely accurate. - for (Block block : PlayerUtil.getNearbyBlocksHorizontally(new Location(player.getWorld(), - player.getLocation().getX(), player.getLocation().getY() - 1, player.getLocation().getZ()), 1)) { - if (block.getType() != Material.AIR) { - this.inAir.put(uuid, false); - break; - } else { - this.inAir.put(uuid, true); - } - } - - final double deltaY = packet.getPosition().getY() - player.getLocation().getY(); - - final double lastDeltaY = this.lastDeltaY.getOrDefault(uuid, 0.0); - this.lastDeltaY.put(uuid, deltaY); - - //i dont believe you need all of the extra? also, math.abs is causing falses :/// - final double prediction = ((lastDeltaY - 0.08) * 0.98F); - final double difference = Math.abs(deltaY - prediction); - - final boolean invalid = difference > 0.00001D - && airTicks > 8 - //was able to replace this all due to my new air block check LMFAO. - //note: this is not accurate if youre inside an enclosed space/near blocks. simply a quick fix i made - ; - - double buffer = this.buffer.getOrDefault(uuid, 0.0); - - if (invalid) { - buffer += buffer < 50 ? 10 : 0; - if (buffer > 20) { - fail("diff=%.4f, buffer=%.2f, at=%o", player); - } - } else { - buffer = Math.max(buffer - 0.75, 0); - } - - this.buffer.put(uuid, buffer); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/movement/groundspoof/GroundSpoofA.java b/src/main/java/com/justdoom/flappyanticheat/checks/movement/groundspoof/GroundSpoofA.java deleted file mode 100644 index 1ca9729..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/movement/groundspoof/GroundSpoofA.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.justdoom.flappyanticheat.checks.movement.groundspoof; - -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.utils.PlayerUtil; -import com.justdoom.flappyanticheat.utils.ServerUtil; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Tag; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicReference; - -public class GroundSpoofA extends Check { - - private int buffer = 0; - - public GroundSpoofA(){ - super("GroundSpoof", "A", false); - } - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent e) { - Player player = e.getPlayer(); - - if (e.getPacketId() == PacketType.Play.Client.POSITION || e.getPacketId() == PacketType.Play.Client.POSITION_LOOK) { - - WrappedPacketInFlying packet = new WrappedPacketInFlying(e.getNMSPacket()); - - if(ServerUtil.lowTPS(("checks." + check + "." + checkType).toLowerCase()) || player.getLocation().getY() < 1 || player.isDead()) - return; - - if (player.isInsideVehicle()) return; - - - double groundY = 0.015625; - boolean client = packet.isOnGround(), server = packet.getY() % groundY < 0.0001; - - if (client != server && !PlayerUtil.isOnClimbable(player)) { - if (++buffer > 1) { - - boolean boat = false; - boolean shulker = false; - boolean pistonHead = false; - - AtomicReference> nearby = new AtomicReference<>(); - sync(() -> nearby.set(player.getNearbyEntities(1.5, 10, 1.5))); - - for (Entity entity : nearby.get()) { - if (entity.getType() == EntityType.BOAT && player.getLocation().getY() > entity.getLocation().getY()) { - boat = true; - break; - } - - if (entity.getType() == EntityType.SHULKER && player.getLocation().getY() > entity.getBoundingBox().getMinY()) { - shulker = true; - break; - } - } - - for (Block block : PlayerUtil.getNearbyBlocks(new Location(player.getWorld(), packet.getX(), packet.getY(), packet.getZ()), 2)) { - - if (Tag.SHULKER_BOXES.isTagged(block.getType())) { - shulker = true; - break; - } - - if (block.getType() == Material.PISTON_HEAD) { - pistonHead = true; - break; - } - } - - if (!boat && !shulker && !pistonHead) { - String suspectedHack; - if(packet.getY() % groundY == 0.0){ - suspectedHack = "Criticals/Anti Hunger"; - } else { - suspectedHack = "NoFall"; - } - fail("mod=" + packet.getY() % groundY + " &7Client: &2" + client + " &7Server: &2" + server + " &7Suspected Hack: &2" + suspectedHack, player); - } - } - } else if (buffer > 0) buffer--; - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/movement/jump/JumpA.java b/src/main/java/com/justdoom/flappyanticheat/checks/movement/jump/JumpA.java deleted file mode 100644 index 3efa4aa..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/movement/jump/JumpA.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.justdoom.flappyanticheat.checks.movement.jump; - -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.utils.PlayerUtil; -import com.justdoom.flappyanticheat.utils.ServerUtil; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffectType; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class JumpA extends Check { - - private Map sinceSlimeTicks = new HashMap<>(); - - private Map blockAbove = new HashMap<>(); - private Map colliding = new HashMap<>(); - private Map onSlime = new HashMap<>(); - private Map onInvalid = new HashMap<>(); - private Map stairsDeserveTheDeathSentence = new HashMap<>(); - - public JumpA(){ - super("Jump", "A", false); - } - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - - Player player = event.getPlayer(); - UUID uuid = player.getUniqueId(); - - double sinceSlimeTicks = this.sinceSlimeTicks.getOrDefault(uuid, 0.0); - - if (event.getPacketId() == PacketType.Play.Client.POSITION || event.getPacketId() == PacketType.Play.Client.POSITION_LOOK) { - - if(ServerUtil.lowTPS(("checks." + check + "." + checkType).toLowerCase())) - return; - - WrappedPacketInFlying packet = new WrappedPacketInFlying(event.getNMSPacket()); - - if (player.isFlying() || player.isDead() || player.isInsideVehicle()) return; - - //0.42 is not the real jump height of the player. if youre gonna make it false atleast use the right number. - //vehicle desync may false this, thats why it was originally 0.43. it seems like izibane likes false flags - //though, so ill go along with it - //0.41999998688697815 is our exact value. - double jumpSize = 0.41999998688697815f + (double) + ((float) PlayerUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.1f); - - double lastY = player.getLocation().getY(); - final double deltaY = packet.getPosition().getY() - lastY; - final boolean onGround = packet.isOnGround(); - - //we use this to check if they actually jumped. if their y changed and if their previous y divided by 1/64th - //had a remainder of 0 - boolean jumped = deltaY > 0 && lastY % (1D/64) == 0; - - //this is probably really intensive, but theres no current better method - - //check if the blocks above the player are air - for (Block block : PlayerUtil.getNearbyBlocksHorizontally(new Location(player.getWorld(), player.getLocation().getX(), - player.getLocation().getY() + 2, player.getLocation().getZ()), 1)) { - if (block.getType() != Material.AIR) { - this.blockAbove.put(uuid, true); - break; - } else { - this.blockAbove.put(uuid, false); - } - } - - //check if anythings colliding inside the player - for (Block block : PlayerUtil.getNearbyBlocks(new Location(player.getWorld(), player.getLocation().getX(), - player.getLocation().getY() + 1, player.getLocation().getZ()), 1)) { - if (!block.isPassable()) { - this.colliding.put(uuid, true); - break; - } else { - this.colliding.put(uuid, false); - } - } - - //check if the player is on a slime block or an unsupported block - for (Block block : PlayerUtil.getNearbyBlocksHorizontally(new Location(player.getWorld(), player.getLocation().getX(), - player.getLocation().getY() - 1, player.getLocation().getZ()), 2)) { - if ((block.getType().toString().contains("SLIME"))) { - this.onSlime.put(uuid, true); - break; - } else { - this.onSlime.put(uuid, false); - } - - if ((block.getType().toString().contains("STAIR")) || (block.getType().toString().contains("SLAB")) || - (block.getType().toString().contains("PISTON")) || (block.getType().toString().contains("FENCE")) || - (block.getType().toString().contains("WALL"))) { - this.onInvalid.put(uuid, true); - break; - } else { - this.onInvalid.put(uuid, false); - } - } - - //stairs should be removed from the game. all they cause is pain and suffering and pain and hurt and help - for (Block block : PlayerUtil.getNearbyBlocksHorizontally(new Location(player.getWorld(), player.getLocation().getX(), - player.getLocation().getY(), player.getLocation().getZ()), 2)) { - if ((block.getType().toString().contains("STAIR")) || (block.getType().toString().contains("SLAB"))) { - this.stairsDeserveTheDeathSentence.put(uuid, true); - break; - } else { - this.stairsDeserveTheDeathSentence.put(uuid, false); - } - } - - //grab our booleans from the hashmaps - boolean blockAbove = this.blockAbove.getOrDefault(uuid, false); - boolean colliding = this.colliding.getOrDefault(uuid, false); - boolean onSlime = this.onSlime.getOrDefault(uuid, false); - boolean onInvalid = this.onInvalid.getOrDefault(uuid, false); - boolean deathSentence = this.stairsDeserveTheDeathSentence.getOrDefault(uuid, false); - - //if the player isnt colliding with anything, isnt on slime, or doesnt have a block above then they can flag. - boolean canFlag = !colliding && !onSlime && !blockAbove && !onInvalid; - - //flag the player if theyre under the normal jump size, jumped, and are eligible for flag. - if (deltaY < (jumpSize - 0.02) && jumped && canFlag) { - fail("low jump" + deltaY,player); - } - - //so we check if theyre packet onground first. if they are, then we use 0.6 as their jump height. its not - //worth going for the exact number. if theyre off the ground, their max jump size is outlines by our jumpsize - //double. we also want to make sure theyve been off of slime for atleast 15 ticks - if (deltaY > (onGround ? 0.6 : jumpSize) && sinceSlimeTicks >= 15 && !onInvalid && !deathSentence) { - fail("high jump" + deltaY , player); - } - } - - boolean onSlime = this.onSlime.getOrDefault(uuid, false); - - sinceSlimeTicks = onSlime ? 0 : sinceSlimeTicks + 1; - - this.sinceSlimeTicks.put(uuid, sinceSlimeTicks); - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/movement/noslow/NoSlowA.java b/src/main/java/com/justdoom/flappyanticheat/checks/movement/noslow/NoSlowA.java deleted file mode 100644 index 381385e..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/movement/noslow/NoSlowA.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.justdoom.flappyanticheat.checks.movement.noslow; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.checks.CheckData; -import io.github.retrooper.packetevents.PacketEvents; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying; -import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; -import org.bukkit.Location; - -@CheckData(name = "Fly", type = "A", experimental = false) -public class NoSlowA extends Check { - - private int hitTicks; - private double lastDist; - private Location lastLocation; - - public NoSlowA(){ - super("NoSlow", "A", true); - } - - //doesnt work - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - if(event.getPacketId() == PacketType.Play.Client.POSITION){ - WrappedPacketInFlying packet = new WrappedPacketInFlying(event.getNMSPacket()); - - String path = ("checks." + check + "." + checkType).toLowerCase(); - if(PacketEvents.get().getServerUtils().getTPS() <= FlappyAnticheat.getInstance().config.configuration.getDouble(path + ".min-tps")){ - return; - } - - Location currentLoc = new Location(event.getPlayer().getWorld(), packet.getX(), packet.getY(), packet.getZ()); - Location lastLocation = this.lastLocation; - this.lastLocation = currentLoc; - - double dist = test(lastLocation, currentLoc); - double lastDist = this.lastDist; - this.lastDist = dist; - - if(event.getPlayer().isSprinting() && ++hitTicks <= 2){ - double accel = Math.abs(dist - lastDist); - //event.getPlayer().sendMessage(String.valueOf(accel)); - if(accel < 0.027){ - //event.getPlayer().sendMessage("YEEEEEEEEEEEES"); - //fail("test", event.getPlayer()); - } - } - - } else if (event.getPacketId() == PacketType.Play.Client.USE_ENTITY) { - WrappedPacketInUseEntity packet = new WrappedPacketInUseEntity(event.getNMSPacket()); - hitTicks = 0; - } - } - - public double test(Location from, Location to){ - double dx = to.getX() - from.getX(); - double dz = to.getZ() - from.getZ(); - return Math.sqrt(dx * dx + dz * dz); - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/movement/speed/SpeedA.java b/src/main/java/com/justdoom/flappyanticheat/checks/movement/speed/SpeedA.java deleted file mode 100644 index 5a95eda..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/movement/speed/SpeedA.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.justdoom.flappyanticheat.checks.movement.speed; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.utils.PlayerUtil; -import com.justdoom.flappyanticheat.utils.ServerUtil; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerMoveEvent; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class SpeedA extends Check implements Listener { - - private Map buffer = new HashMap<>(); - private Map lastOnGround = new HashMap<>(); - - private Map lastDist = new HashMap<>(); - - public SpeedA() { - super("Speed", "A", true); - } - - @EventHandler - public void onPacketPlayReceive(PlayerMoveEvent event) { - Player player = event.getPlayer(); - UUID uuid = player.getUniqueId(); - - if (ServerUtil.lowTPS(("checks." + check + "." + checkType).toLowerCase())) - return; - - Location to = new Location(player.getWorld(), event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); - float friction = 0.91f; - - double distX = to.getX() - player.getLocation().getX(); - double distZ = to.getZ() - player.getLocation().getZ(); - double dist = Math.sqrt((distX * distX) + (distZ * distZ)); - double lastDist = this.lastDist.getOrDefault(uuid, 0.0); - - this.lastDist.put(uuid, dist); - boolean onGround = player.isOnGround(); - boolean lastOnGround = this.lastOnGround.getOrDefault(uuid, true); - this.lastOnGround.put(uuid, onGround); - double shiftedLastDist = lastDist * friction; - double equalness = dist - shiftedLastDist; - - double buffer = this.buffer.getOrDefault(uuid, 0.0); - - if (!PlayerUtil.isOnClimbable(player) && !onGround && !lastOnGround && !(player.getNearbyEntities(1.5, 10, 1.5).size() > 0) && ++buffer > 2) { - - boolean pistonHead = false; - - for (Block block : PlayerUtil.getNearbyBlocks(new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ()), 2)) { - if (block.getType() == Material.PISTON_HEAD) { - pistonHead = true; - break; - } - } - - if (equalness > 0.027 && !pistonHead) { - Bukkit.getScheduler().runTaskAsynchronously(FlappyAnticheat.getInstance(), () -> fail("e=" + equalness, player)); - } - } else buffer = Math.max(buffer - 0.5, 0); - - this.buffer.put(uuid, buffer); - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/player/anticactus/AntiCactusA.java b/src/main/java/com/justdoom/flappyanticheat/checks/player/anticactus/AntiCactusA.java deleted file mode 100644 index bdda152..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/player/anticactus/AntiCactusA.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.justdoom.flappyanticheat.checks.player.anticactus; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.checks.Check; -import io.github.retrooper.packetevents.PacketEvents; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying; -import org.bukkit.entity.Player; - -import java.util.List; - -public class AntiCactusA extends Check { - - public AntiCactusA(){ - super("AntiCactus", "A", false); - } - - private List damage; - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - - if (event.getPacketId() == PacketType.Play.Client.POSITION){ - WrappedPacketInFlying packet = new WrappedPacketInFlying(event.getNMSPacket()); - Player player = event.getPlayer(); - - String path = ("checks." + check + "." + checkType).toLowerCase(); - if(PacketEvents.get().getServerUtils().getTPS() <= FlappyAnticheat.getInstance().config.configuration.getDouble(path + ".min-tps")){ - return; - } - - - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsA.java b/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsA.java deleted file mode 100644 index b93a82c..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsA.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.justdoom.flappyanticheat.checks.player.badpackets; - -import com.justdoom.flappyanticheat.checks.Check; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; - -public class BadPacketsA extends Check { - - public BadPacketsA(){ - super("BadPackets", "A", false); - } - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - - if (event.getPacketId() == PacketType.Play.Client.POSITION || event.getPacketId() == PacketType.Play.Client.POSITION_LOOK) { - - float pitch = event.getPlayer().getLocation().getPitch(); - if(Math.abs(pitch) > 90F || Math.abs(pitch) < -90F){ - String suspectedHack = "Old/Bad KillAura (This cannot false)"; - fail("&7pitch=&2" + pitch + " &7Suspected Hack: &2" + suspectedHack, event.getPlayer()); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsB.java b/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsB.java deleted file mode 100644 index 48c0f3c..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsB.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.justdoom.flappyanticheat.checks.player.badpackets; - -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.utils.ServerUtil; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.useentity.WrappedPacketInUseEntity; - -public class BadPacketsB extends Check { - - private boolean wasLastArmAnimation; - - public BadPacketsB(){ - super("BadPackets", "B", false); - } - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - - if (event.getPacketId() == PacketType.Play.Client.USE_ENTITY){ - - WrappedPacketInUseEntity packetInUseEntity = new WrappedPacketInUseEntity(event.getNMSPacket()); - - if(ServerUtil.lowTPS(("checks." + check + "." + checkType).toLowerCase())) - return; - - if(!wasLastArmAnimation && packetInUseEntity.getAction() == WrappedPacketInUseEntity.EntityUseAction.ATTACK){ - fail("&7ArmAnimation=&2false", event.getPlayer()); - } - } else if (event.getPacketId() == PacketType.Play.Client.ARM_ANIMATION){ - wasLastArmAnimation = true; - } else if (event.getPacketId() == PacketType.Play.Client.FLYING){ - wasLastArmAnimation = false; - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsC.java b/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsC.java deleted file mode 100644 index 0bdcacb..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsC.java +++ /dev/null @@ -1,32 +0,0 @@ -//Full credit to GladUrBad for the original check. This comes from Medusa. -//https://github.com/GladUrBad/Medusa/blob/f00848c2576e4812283e6dc2dc05e29e2ced866a/Impl/src/main/java/com/gladurbad/medusa/check/impl/player/protocol/ProtocolD.java - -package com.justdoom.flappyanticheat.checks.player.badpackets; - -import com.justdoom.flappyanticheat.checks.Check; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.steervehicle.WrappedPacketInSteerVehicle; - -public class BadPacketsC extends Check { - - public BadPacketsC(){ - super("BadPackets", "C", false); - } - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - - if (event.getPacketId() == PacketType.Play.Client.STEER_VEHICLE){ - - WrappedPacketInSteerVehicle wrapper = new WrappedPacketInSteerVehicle(event.getNMSPacket()); - - float forwardValue = Math.abs(wrapper.getForwardValue()), sideValue = Math.abs(wrapper.getSideValue()); - boolean invalid = forwardValue > .98F || sideValue > .98F; - - if (invalid) { - fail("", event.getPlayer()); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsD.java b/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsD.java deleted file mode 100644 index ad046e4..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/player/badpackets/BadPacketsD.java +++ /dev/null @@ -1,46 +0,0 @@ -//Full credit to GladUrBad for the original check. This comes from Medusa. -//https://github.com/GladUrBad/Medusa/blob/f00848c2576e4812283e6dc2dc05e29e2ced866a/Impl/src/main/java/com/gladurbad/medusa/check/impl/player/protocol/ProtocolF.java - -package com.justdoom.flappyanticheat.checks.player.badpackets; - -import com.justdoom.flappyanticheat.checks.Check; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.steervehicle.WrappedPacketInSteerVehicle; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class BadPacketsD extends Check { - - private Map buffer = new HashMap<>(); - - public BadPacketsD(){ - super("BadPackets", "D", false); - } - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - - if (event.getPacketId() == PacketType.Play.Client.STEER_VEHICLE){ - - WrappedPacketInSteerVehicle wrapper = new WrappedPacketInSteerVehicle(event.getNMSPacket()); - - boolean unmount = wrapper.isDismount(); - boolean invalid = event.getPlayer().getVehicle() == null && !unmount; - double buffer = this.buffer.getOrDefault(event.getPlayer().getUniqueId(), 0.0); - - if (invalid) { - if (++buffer > 8) { - fail("buffer=" + buffer, event.getPlayer()); - buffer /= 2; - } - } else { - buffer = 0; - } - - this.buffer.put(event.getPlayer().getUniqueId(), buffer); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/player/blockplace/BlockPlaceA.java b/src/main/java/com/justdoom/flappyanticheat/checks/player/blockplace/BlockPlaceA.java deleted file mode 100644 index a465abc..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/player/blockplace/BlockPlaceA.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.justdoom.flappyanticheat.checks.player.blockplace; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.utils.ServerUtil; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockPlaceEvent; - -import java.util.ArrayList; -import java.util.List; - -public class BlockPlaceA extends Check implements Listener { - - public BlockPlaceA() { - super("BlockPlace", "A", true); - } - - @EventHandler - public void onBlockPlace(BlockPlaceEvent event) { - - if(ServerUtil.lowTPS(("checks." + check + "." + checkType).toLowerCase())) - return; - - Player player = event.getPlayer(); - - Block block = event.getBlock(); - boolean placedOnAir = true; - - List blockFace = new ArrayList() {{ - add(block.getRelative(BlockFace.UP).getType()); - add(block.getRelative(BlockFace.NORTH).getType()); - add(block.getRelative(BlockFace.EAST).getType()); - add(block.getRelative(BlockFace.SOUTH).getType()); - add(block.getRelative(BlockFace.WEST).getType()); - add(block.getRelative(BlockFace.DOWN).getType()); - }}; - - for (Material material : blockFace) { - if (material != Material.AIR && material != Material.LAVA && material != Material.WATER && material != Material.CAVE_AIR && material != Material.VOID_AIR) { - placedOnAir = false; - break; - } - } - if (placedOnAir) { - Bukkit.getScheduler().runTaskAsynchronously(FlappyAnticheat.getInstance(), () -> fail("faces=" + blockFace, player)); - } - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/player/blockplace/BlockPlaceB.java b/src/main/java/com/justdoom/flappyanticheat/checks/player/blockplace/BlockPlaceB.java deleted file mode 100644 index 6942b0b..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/player/blockplace/BlockPlaceB.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.justdoom.flappyanticheat.checks.player.blockplace; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.utils.ServerUtil; -import org.bukkit.Bukkit; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.inventory.ItemStack; - -public class BlockPlaceB extends Check implements Listener { - - public BlockPlaceB() { - super("BlockPlace", "B", true); - } - - @EventHandler - public void onBlockPlace(BlockPlaceEvent event) { - - Player player = event.getPlayer(); - - Block block = event.getBlock(); - - ItemStack hand = player.getItemInHand(); - - if(ServerUtil.lowTPS(("checks." + check + "." + checkType).toLowerCase())) - return; - - if (block.getType() != hand.getType() && block.getType() != player.getInventory().getItemInOffHand().getType()) { - - Bukkit.getScheduler().runTaskAsynchronously(FlappyAnticheat.getInstance(), () -> fail("hand=" + hand.getType() + " placed=" + block.getType(), player)); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/player/inventory/InventoryA.java b/src/main/java/com/justdoom/flappyanticheat/checks/player/inventory/InventoryA.java deleted file mode 100644 index f6a1f2a..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/player/inventory/InventoryA.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.justdoom.flappyanticheat.checks.player.inventory; - -import com.justdoom.flappyanticheat.checks.Check; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryMoveItemEvent; - -public class InventoryA extends Check implements Listener { - - public InventoryA(){ - super("Inventory", "A", true); - } - - @EventHandler - public void onBlockPlace(InventoryMoveItemEvent event) { - //Player player = (Player) event.getDestination().get; - //player.sendMessage("e"); - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/player/skinblinker/SkinBlinkerA.java b/src/main/java/com/justdoom/flappyanticheat/checks/player/skinblinker/SkinBlinkerA.java deleted file mode 100644 index 3eaa94c..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/player/skinblinker/SkinBlinkerA.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.justdoom.flappyanticheat.checks.player.skinblinker; - -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.utils.ServerUtil; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import io.github.retrooper.packetevents.packetwrappers.play.in.settings.WrappedPacketInSettings; -import org.bukkit.entity.Player; - -public class SkinBlinkerA extends Check { - - public SkinBlinkerA(){ - super("SkinBlinker", "A", false); - } - - private int lastSkin = -1; - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent event) { - - if (event.getPacketId() == PacketType.Play.Client.SETTINGS){ - WrappedPacketInSettings packet = new WrappedPacketInSettings(event.getNMSPacket()); - Player player = event.getPlayer(); - - if(ServerUtil.lowTPS(("checks." + check + "." + checkType).toLowerCase())) - return; - - if (lastSkin == -1) { - lastSkin = packet.getDisplaySkinPartsMask(); - return; - } - - if ((player.isSprinting() - || player.isSneaking() - || player.isBlocking()) - && lastSkin != packet.getDisplaySkinPartsMask()) { - fail("&7last=&2" + lastSkin + " &7current=&2" + packet.getDisplaySkinPartsMask(), player); - } - - lastSkin = packet.getDisplaySkinPartsMask(); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/checks/player/timer/TimerA.java b/src/main/java/com/justdoom/flappyanticheat/checks/player/timer/TimerA.java deleted file mode 100644 index d1f4e34..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/checks/player/timer/TimerA.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.justdoom.flappyanticheat.checks.player.timer; - -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.utils.ServerUtil; -import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; -import io.github.retrooper.packetevents.packettype.PacketType; -import org.bukkit.entity.Player; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class TimerA extends Check { - - private Map lastTime = new HashMap<>(); - private Map balance = new HashMap<>(); - - public TimerA() { - super("Timer", "A", true); - } - - @Override - public void onPacketPlayReceive(PacketPlayReceiveEvent e) { - Player player = e.getPlayer(); - UUID uuid = player.getUniqueId(); - - if (e.getPacketId() == PacketType.Play.Client.POSITION || e.getPacketId() == PacketType.Play.Client.POSITION_LOOK) { - - if(ServerUtil.lowTPS(("checks." + check + "." + checkType).toLowerCase())) - return; - - long time = System.currentTimeMillis(); - long lastTime = this.lastTime.getOrDefault(uuid, 0L) != 0 ? this.lastTime.getOrDefault(uuid, 0L) : time - 50; - this.lastTime.put(uuid, time); - - long rate = time - lastTime; - - double balanceOrDefault = this.balance.getOrDefault(uuid, 0.0); - this.balance.put(uuid, balanceOrDefault += 50.0); - balanceOrDefault = this.balance.getOrDefault(uuid, 0.0); - this.balance.put(uuid, balanceOrDefault -= rate); - - if(this.balance.getOrDefault(uuid, 0.0) >= 10.0){ - fail("balance=" + balance, player); - this.balance.put(uuid, 0.0); - } - } else if (e.getPacketId() == PacketType.Play.Server.POSITION){ - double balanceOrDefault = this.balance.getOrDefault(uuid, 0.0); - this.balance.put(uuid, balanceOrDefault -= 50.0); - } - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/commands/FlagClickCommand.java b/src/main/java/com/justdoom/flappyanticheat/commands/FlagClickCommand.java deleted file mode 100644 index cebbc28..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/commands/FlagClickCommand.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.justdoom.flappyanticheat.commands; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; - -public class FlagClickCommand implements CommandExecutor { - @Override - public boolean onCommand(CommandSender sender, Command command, String s, String[] args) { - if(command.getName().equalsIgnoreCase("flappyacflagclick")){ - if(args.length == 0){ - return true; - } else { - for(String commands:FlappyAnticheat.getInstance().config.configuration.getStringList("messages.commands")){ - Bukkit.dispatchCommand(sender, commands.replace("{player}", args[0])); - - } - } - } - return true; - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/commands/FlappyACCommand.java b/src/main/java/com/justdoom/flappyanticheat/commands/FlappyACCommand.java deleted file mode 100644 index 564c711..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/commands/FlappyACCommand.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.justdoom.flappyanticheat.commands; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.utils.Color; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class FlappyACCommand implements CommandExecutor { - @Override - public boolean onCommand(CommandSender sender, Command command, String s, String[] args) { - if(command.getName().equalsIgnoreCase("flappyanticheat")){ - if(args.length == 0){ - sender.sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + "&7Please do \"/flappyac help\" for the help command")); - - //Reload - } else if (args[0].equalsIgnoreCase("reload")) { - FlappyAnticheat.getInstance().config.reloadConfig(); - sender.sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.reload"))); - - //Reset Violations - } else if (args[0].equalsIgnoreCase("resetviolations")) { - if(args.length >= 2){ - if(Bukkit.getPlayerExact(args[1]) != null) { - FlappyAnticheat.getInstance().violationHandler.clearViolations(Bukkit.getPlayerExact(args[1])); - for(Player p: Bukkit.getOnlinePlayers()){ - if(p.hasPermission("flappyanticheat.alerts")){ - p.sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.violation-reset.player").replace("{player}", args[1]))); - } - } - if(FlappyAnticheat.getInstance().config.configuration.getBoolean("messages.flag-to-console")) { - Bukkit.getConsoleSender().sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.violation-reset.player").replace("{player}", args[1]))); - } - } else { - sender.sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.violation-remove-invalid-player"))); - } - } else { - FlappyAnticheat.getInstance().violationHandler.clearAllViolations(); - for (Player p : Bukkit.getOnlinePlayers()) { - if (p.hasPermission("flappyanticheat.alerts")) { - p.sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.violation-reset.all"))); - } - } - if(FlappyAnticheat.getInstance().config.configuration.getBoolean("messages.flag-to-console")) { - Bukkit.getConsoleSender().sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.violation-reset.all"))); - } - } - - //Alerts toggle - } else if (args[0].equalsIgnoreCase("alerts")) { - if(!FlappyAnticheat.getInstance().dataManager.alertsDisabled.contains(((Player) sender).getPlayer())){ - FlappyAnticheat.getInstance().dataManager.disabledAlertsAdd(((Player) sender).getPlayer()); - sender.sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.alert-toggle.disable"))); - } else { - FlappyAnticheat.getInstance().dataManager.disabledAlertsRemove(((Player) sender).getPlayer()); - sender.sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.alert-toggle.enable"))); - } - - //Player profile - } else if (args[0].equalsIgnoreCase("profile")){ - if(args.length > 1){ - Player targetPlayer = Bukkit.getPlayer(args[1]); - //String clientBrand = - } - } - } - return false; - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/commands/tabcomplete/FlappyAnticheatTabCompletion.java b/src/main/java/com/justdoom/flappyanticheat/commands/tabcomplete/FlappyAnticheatTabCompletion.java deleted file mode 100644 index e7c1057..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/commands/tabcomplete/FlappyAnticheatTabCompletion.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.justdoom.flappyanticheat.commands.tabcomplete; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; - -import java.util.ArrayList; -import java.util.List; - -public class FlappyAnticheatTabCompletion implements TabCompleter { - - List arguments = new ArrayList(); - - @Override - public List onTabComplete(CommandSender sender, Command command, String label, String[] args) { - if(arguments.isEmpty()){ - arguments.add("reload"); - arguments.add("resetviolations"); - arguments.add("alerts"); - } - - List result = new ArrayList(); - - if(args.length == 1){ - for(String a:arguments){ - if(a.toLowerCase().startsWith(args[0].toLowerCase())){ - result.add(a); - } - } - return result; - } - - return null; - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/customevents/FlagEvent.java b/src/main/java/com/justdoom/flappyanticheat/customevents/FlagEvent.java deleted file mode 100644 index 5aa76da..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/customevents/FlagEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.justdoom.flappyanticheat.customevents; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.checks.Check; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -public class FlagEvent extends Event implements Cancellable { - - private static final HandlerList HANDLERS = new HandlerList(); - - private final Player player; - private boolean isCancelled, isPunishable; - private Check check; - private int vl; - - public FlagEvent(Player player, Check check) { - super(true); - this.player = player; - this.isCancelled = false; - this.check = check; - this.isPunishable = FlappyAnticheat.getInstance().config.configuration.getBoolean("checks." + check.check + "." + check.checkType + ".punishable"); - this.vl = FlappyAnticheat.getInstance().violationHandler.getViolations(check, player); - } - - @Override - public boolean isCancelled() { - return this.isCancelled; - } - - @Override - public void setCancelled(boolean isCancelled) { - this.isCancelled = isCancelled; - } - - @Override - public HandlerList getHandlers() { - return HANDLERS; - } - - public static HandlerList getHandlerList() { - return HANDLERS; - } - - public Player getFlaggedPlayer() { - return this.player; - } - - public Check getCheck(){ - return this.check; - } - - public boolean isPunishable(){ - return this.isPunishable; - } - - - public int getViolations(){ - return this.vl; - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/customevents/PunishEvent.java b/src/main/java/com/justdoom/flappyanticheat/customevents/PunishEvent.java deleted file mode 100644 index b6c6a18..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/customevents/PunishEvent.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.justdoom.flappyanticheat.customevents; - -import com.justdoom.flappyanticheat.checks.Check; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -public class PunishEvent extends Event implements Cancellable { - - private final Player player; - private boolean isCancelled; - private Check check; - - public PunishEvent(Player player, Check check) { - super(true); - this.player = player; - this.isCancelled = false; - this.check = check; - } - - @Override - public boolean isCancelled() { - return this.isCancelled; - } - - @Override - public void setCancelled(boolean isCancelled) { - this.isCancelled = isCancelled; - } - - private static final HandlerList HANDLERS = new HandlerList(); - - @Override - public HandlerList getHandlers() { - return HANDLERS; - } - - public static HandlerList getHandlerList() { - return HANDLERS; - } - - public Player getPunishedPlayer() { - return this.player; - } - - public Check getCheck(){ - return this.check; - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/customevents/ViolationResetEvent.java b/src/main/java/com/justdoom/flappyanticheat/customevents/ViolationResetEvent.java deleted file mode 100644 index 944a32c..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/customevents/ViolationResetEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.justdoom.flappyanticheat.customevents; - -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -public class ViolationResetEvent extends Event implements Cancellable { - - private static final HandlerList HANDLERS = new HandlerList(); - - private boolean isCancelled; - - public ViolationResetEvent() { - super(true); - this.isCancelled = false; - } - - @Override - public boolean isCancelled() { - return this.isCancelled; - } - - @Override - public void setCancelled(boolean isCancelled) { - this.isCancelled = isCancelled; - } - - @Override - public HandlerList getHandlers() { - return HANDLERS; - } - - public static HandlerList getHandlerList() { - return HANDLERS; - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/data/FileData.java b/src/main/java/com/justdoom/flappyanticheat/data/FileData.java deleted file mode 100644 index dd0758a..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/data/FileData.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.justdoom.flappyanticheat.data; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import org.bukkit.ChatColor; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -public class FileData { - - public FileData(){ - - } - - public void addToFile(String fileName, String message) { - File log = new File(FlappyAnticheat.getInstance().getDataFolder(), fileName); - try{ - if(!log.exists()){ - createFiles(fileName); - } - PrintWriter out = new PrintWriter(new FileWriter(log, true)); - out.append(ChatColor.stripColor(message)); - out.close(); - }catch(IOException e){ - e.printStackTrace(); - } - } - - public void createFiles(String name) { - if (!new File(FlappyAnticheat.getInstance().getDataFolder(), name).exists()) { - File todayFile = new File(FlappyAnticheat.getInstance().getDataFolder(), name); - try { - todayFile.createNewFile(); // Error - } catch (IOException e) { - e.printStackTrace(); - } - } - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/data/FlappyPlayer.java b/src/main/java/com/justdoom/flappyanticheat/data/FlappyPlayer.java deleted file mode 100644 index 975ea0a..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/data/FlappyPlayer.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.justdoom.flappyanticheat.data; - -import org.bukkit.entity.Player; - -import java.util.HashMap; -import java.util.Map; - -public class FlappyPlayer { - - private static Map flappyPlayers = new HashMap(); - - private final Player player; - - public Player getPlayer() { - return player; - } - - private FlappyPlayer(Player player) { - this.player = player; - flappyPlayers.put(player.getName(), this); - } - - // Return a running instance (or create a new one) - public static FlappyPlayer getInstance(Player player) { - if (flappyPlayers == null) { - return new FlappyPlayer(player); - } - if (!flappyPlayers.containsKey(player.getName())) { - return new FlappyPlayer(player); - } else if (flappyPlayers.containsKey(player.getName())) { - return flappyPlayers.get(player.getName()); - } else { - return null; - } - } - - // Remove an Instance - public static boolean removeInstance(Player player) { - if (flappyPlayers.containsKey(player.getName())) { - flappyPlayers.remove(player.getName()); - return true; - } else { - return false; - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/data/PlayerData.java b/src/main/java/com/justdoom/flappyanticheat/data/PlayerData.java deleted file mode 100644 index b961e7e..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/data/PlayerData.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.justdoom.flappyanticheat.data; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.checks.CheckManager; -import org.bukkit.Bukkit; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.util.BoundingBox; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -public class PlayerData { - - public final UUID uuid; - public Player player; - public final List pastVictimBoxes; - public LivingEntity vicitm; - public int ping; - - public CheckManager checkManager; - - public PlayerData(UUID uuid) { - this.uuid = uuid; - this.player = Bukkit.getPlayer(uuid); - this.pastVictimBoxes = new ArrayList<>(); - - this.checkManager = new CheckManager(FlappyAnticheat.getInstance()); - new BukkitRunnable() { - - @Override - public void run() { - if(vicitm != null) { - if(pastVictimBoxes.size() > 20) pastVictimBoxes.clear(); - pastVictimBoxes.add(vicitm.getBoundingBox()); - } - } - }.runTaskTimerAsynchronously(FlappyAnticheat.getInstance(),0L,1L); - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/data/PlayerDataManager.java b/src/main/java/com/justdoom/flappyanticheat/data/PlayerDataManager.java deleted file mode 100644 index 99ccb12..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/data/PlayerDataManager.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.justdoom.flappyanticheat.data; - -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -public class PlayerDataManager { - - public Map dataMap = new ConcurrentHashMap<>(); - - public ArrayList alertsDisabled = new ArrayList(); - - public void addPlayer(UUID uuid) { - dataMap.put(uuid, new PlayerData(uuid)); - } - - public boolean containsPlayer(PlayerData data){ - if(dataMap.containsValue(data)){ - return true; - } else { - return false; - } - } - - public void removePlayer(UUID uuid) { - dataMap.remove(uuid); - } - - public PlayerData getData(UUID uuid) { - return dataMap.get(uuid); - } - - public void disabledAlertsAdd(Player player){ - alertsDisabled.add(player); - } - - public void disabledAlertsRemove(Player player){ - alertsDisabled.remove(player); - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/listener/PlayerConnectionListener.java b/src/main/java/com/justdoom/flappyanticheat/listener/PlayerConnectionListener.java deleted file mode 100644 index c2aa113..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/listener/PlayerConnectionListener.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.justdoom.flappyanticheat.listener; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.utils.BrandMessageUtil; -import io.github.retrooper.packetevents.PacketEvents; -import io.github.retrooper.packetevents.utils.gameprofile.WrappedGameProfile; -import io.github.retrooper.packetevents.utils.player.ClientVersion; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -public class PlayerConnectionListener implements Listener { - - public final FlappyAnticheat flappyAnticheat; - - public PlayerConnectionListener(FlappyAnticheat flappyAnticheat) { - this.flappyAnticheat = flappyAnticheat; - } - - @EventHandler - public void onJoin(PlayerJoinEvent event) { - Player player = event.getPlayer(); - - flappyAnticheat.dataManager.addPlayer(player.getUniqueId()); - - ClientVersion clientVersion = PacketEvents.get().getPlayerUtils().getClientVersion(player); - WrappedGameProfile e = PacketEvents.get().getPlayerUtils().getGameProfile(player); - //event.getPlayer().sendMessage(String.valueOf(e.getName())); - - BrandMessageUtil.addChannel(player, "minecraft:brand"); - - /**for(Player p: Bukkit.getOnlinePlayers()){ - if(p.hasPermission("flappyanticheat.alerts")){ - if(!FlappyAnticheat.getInstance().dataManager.alertsDisabled.contains(p)) - p.sendMessage(String.valueOf(clientVersion)); - } - } - - if(FlappyAnticheat.getInstance().config.configuration.getBoolean("messages.flag-to-console")) { - Bukkit.getConsoleSender().sendMessage(String.valueOf(clientVersion)); - }**/ - } - - @EventHandler - public void onQuit(PlayerQuitEvent event) { - Player player = event.getPlayer(); - - flappyAnticheat.violationHandler.clearViolations(player); - flappyAnticheat.dataManager.removePlayer(player.getUniqueId()); - flappyAnticheat.dataManager.disabledAlertsRemove(player); - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/utils/BrandMessageUtil.java b/src/main/java/com/justdoom/flappyanticheat/utils/BrandMessageUtil.java deleted file mode 100644 index 378e4e5..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/utils/BrandMessageUtil.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.justdoom.flappyanticheat.utils; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.messaging.PluginMessageListener; - -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; - -public class BrandMessageUtil implements PluginMessageListener { - - @Override - public void onPluginMessageReceived(String channel, Player p, byte[] msg) { - try { - String message = FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.client-brand"); - message = Color.translate(message); - message = message.replace("{player}", p.getName()).replace("{brand}", new String(msg, "UTF-8").substring(1)); - String finalMessage = message; - FlappyAnticheat.getInstance().dataManager.dataMap.values() - .stream().filter(playerData -> p.hasPermission("flappyanticheat.alerts") && !FlappyAnticheat.getInstance().dataManager.alertsDisabled.contains(p)) - .forEach(playerData -> playerData.player.sendMessage(finalMessage)); - - if (FlappyAnticheat.getInstance().config.configuration.getBoolean("messages.flag-to-console")) { - Bukkit.getConsoleSender().sendMessage(Color.translate(message)); - } - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - } - - public static void addChannel(Player p, String channel) { - try { - p.getClass().getMethod("addChannel", String.class).invoke(p, channel); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException - | SecurityException e) { - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/utils/Color.java b/src/main/java/com/justdoom/flappyanticheat/utils/Color.java deleted file mode 100644 index 84b5d21..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/utils/Color.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.justdoom.flappyanticheat.utils; - -import org.bukkit.ChatColor; - -public class Color { - - public static String translate(String message) { - return ChatColor.translateAlternateColorCodes('&', message); - } - -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/utils/PlayerUtil.java b/src/main/java/com/justdoom/flappyanticheat/utils/PlayerUtil.java deleted file mode 100644 index 3a7211d..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/utils/PlayerUtil.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.justdoom.flappyanticheat.utils; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.util.BoundingBox; -import org.bukkit.util.Vector; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashSet; -import java.util.Set; -import java.util.logging.Level; - -public class PlayerUtil { - - public static int getPing(Player player) { - try { - Method handle = player.getClass().getMethod("getHandle"); - Object nmsHandle = handle.invoke(player); - Field pingField = nmsHandle.getClass().getField("ping"); - return pingField.getInt(nmsHandle); - } - catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException - | NoSuchFieldException e) { - Bukkit.getLogger().log(Level.SEVERE, "Exception while trying to get player ping.", e); - } - - return -1; - } - - public static boolean isInLiquid(Player player) { - if(player.isInWater() || player.getLocation().getBlock().getType() == Material.LAVA){ - return true; - } - return false; - } - - public static boolean isOnClimbable(Player player) { - if(player.getLocation().getBlock().getType() == Material.LADDER || player.getLocation().getBlock().getType() == Material.VINE ){ - return true; - } - return false; - } - - //im sorry for this, but this is the best botch i have LMFAO - //since i cant use the regular method and not expand vertical radius, just remove the radius in a new util ;) - // - Spiriten - - public static Set getNearbyBlocksHorizontally(Location location, int radius) { - Set blocks = new HashSet<>(); - - for(int x = location.getBlockX() - radius; x <= location.getBlockX() + radius; x++) { - for(int y = location.getBlockY(); y <= location.getBlockY(); y++) { - for(int z = location.getBlockZ() - radius; z <= location.getBlockZ() + radius; z++) { - blocks.add(location.getWorld().getBlockAt(x, y, z)); - } - } - } - - return blocks; - } - - public static Set getNearbyBlocks(Location location, int radius) { - Set blocks = new HashSet<>(); - - for(int x = location.getBlockX() - radius; x <= location.getBlockX() + radius; x++) { - for(int y = location.getBlockY() - radius; y <= location.getBlockY() + radius; y++) { - for(int z = location.getBlockZ() - radius; z <= location.getBlockZ() + radius; z++) { - blocks.add(location.getWorld().getBlockAt(x, y, z)); - } - } - } - - return blocks; - } - - public static boolean isFlying(Player player){ - return player.isFlying(); - } - - public static double getDistanceBB(BoundingBox origin, Vector attacker) { - double x = Math.min(Math.pow(attacker.getX() - origin.getMinX(),2.0), Math.pow(attacker.getX() - origin.getMaxX(),2.0)); - double z = Math.min(Math.pow(attacker.getZ() - origin.getMinZ(),2.0), Math.pow(attacker.getZ() - origin.getMaxZ(),2.0)); - return Math.sqrt(x + z); - } - - public static int getPotionLevel(Player player, PotionEffectType effect) { - final int effectId = effect.getId(); - - if (!player.hasPotionEffect(effect)) return 0; - - return player.getActivePotionEffects().stream().filter(potionEffect -> potionEffect.getType().getId() == effectId).map(PotionEffect::getAmplifier).findAny().orElse(0) + 1; - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/utils/ServerUtil.java b/src/main/java/com/justdoom/flappyanticheat/utils/ServerUtil.java deleted file mode 100644 index 60c69e8..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/utils/ServerUtil.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.justdoom.flappyanticheat.utils; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import io.github.retrooper.packetevents.PacketEvents; - -public class ServerUtil { - - public static boolean lowTPS(String path){ - if(PacketEvents.get().getServerUtils().getTPS() <= FlappyAnticheat.getInstance().config.configuration.getDouble(path + ".min-tps")){ - return true; - } - return false; - } -} diff --git a/src/main/java/com/justdoom/flappyanticheat/utils/UpdateChecker.java b/src/main/java/com/justdoom/flappyanticheat/utils/UpdateChecker.java deleted file mode 100644 index 5a5be36..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/utils/UpdateChecker.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.justdoom.flappyanticheat.utils; - -import org.bukkit.Bukkit; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.util.Consumer; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Scanner; - -public class UpdateChecker { - - private JavaPlugin plugin; - - private int resourceId; - - public UpdateChecker(JavaPlugin plugin, int resourceId) { - this.plugin = plugin; - this.resourceId = resourceId; - } - - public void getVersion(Consumer consumer) { - Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try(InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream(); Scanner scanner = new Scanner(inputStream)) { - if (scanner.hasNext()) - consumer.accept(scanner.next()); - } catch (IOException exception) { - plugin.getLogger().info("Cannot look for updates: " + exception.getMessage()); - } - }); - } -} \ No newline at end of file diff --git a/src/main/java/com/justdoom/flappyanticheat/violations/ViolationHandler.java b/src/main/java/com/justdoom/flappyanticheat/violations/ViolationHandler.java deleted file mode 100644 index 9e63048..0000000 --- a/src/main/java/com/justdoom/flappyanticheat/violations/ViolationHandler.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.justdoom.flappyanticheat.violations; - -import com.justdoom.flappyanticheat.FlappyAnticheat; -import com.justdoom.flappyanticheat.checks.Check; -import com.justdoom.flappyanticheat.customevents.ViolationResetEvent; -import com.justdoom.flappyanticheat.utils.Color; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class ViolationHandler { - - private Map> violations = new HashMap<>(); - - public ViolationHandler(){ - int delay = FlappyAnticheat.getInstance().config.configuration.getInt("violation-reset-delay") * 20; - - Bukkit.getScheduler().runTaskTimerAsynchronously(FlappyAnticheat.getInstance(), () -> { - ViolationResetEvent violationResetEvent = new ViolationResetEvent(); - Bukkit.getPluginManager().callEvent(violationResetEvent); - if(!violationResetEvent.isCancelled() && Bukkit.getOnlinePlayers().size() > 0) { - clearAllViolations(); - for(Player p: Bukkit.getOnlinePlayers()){ - if(p.hasPermission("flappyanticheat.alerts")){ - p.sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.violation-reset.all"))); - } - } - if(FlappyAnticheat.getInstance().config.configuration.getBoolean("messages.flag-to-console")) { - Bukkit.getConsoleSender().sendMessage(Color.translate(FlappyAnticheat.getInstance().config.configuration.getString("prefix") + FlappyAnticheat.getInstance().config.configuration.getString("messages.violation-reset.all"))); - } - } - }, delay, delay); - } - - public void addViolation(Check check, Player p){ - String path = "checks." + check.check.toLowerCase() + "." + check.checkType.toLowerCase(); - - if(!FlappyAnticheat.getInstance().config.configuration.getBoolean(path + ".enabled")){ - return; - } - - int violation = FlappyAnticheat.getInstance().config.configuration.getInt( path + ".vl"); - Map vl = new HashMap<>(); - if (this.violations.containsKey(p.getUniqueId())) { - vl = this.violations.get(p.getUniqueId()); - } - if (!vl.containsKey(check)) { - vl.put(check, violation); - } else { - vl.put(check, vl.get(check) + violation); - } - this.violations.put(p.getUniqueId(), vl); - if(getViolations(check, p) >= FlappyAnticheat.getInstance().config.configuration.getInt(path + ".punish-vl")){ - if(FlappyAnticheat.getInstance().config.configuration.getBoolean(path + ".punishable")){ - check.punish(p, path); - FlappyAnticheat.getInstance().fileData.addToFile("punishments.txt", "\n" + p.getName() + " has been punished for " + check.check.toLowerCase() + " " + check.checkType.toLowerCase()); - } - } - } - - public Integer getViolations(Check check, Player p) { - if (this.violations.containsKey(p.getUniqueId())) { - if (this.violations.get(p.getUniqueId()).containsKey(check)) { - return this.violations.get(p.getUniqueId()).get(check); - } - } - return 0; - } - - public void clearViolations(Player p) { - this.violations.remove(p.getUniqueId()); - } - - public void clearAllViolations() { - this.violations.clear(); - } -} \ No newline at end of file diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml deleted file mode 100644 index 8f831c9..0000000 --- a/src/main/resources/config.yml +++ /dev/null @@ -1,152 +0,0 @@ -disable-update-checker: false - -prefix: '&7[FlappyAC] ' -violation-reset-delay: 300 - -messages: - flag-to-console: false - client-brand: "&2{player}'s &7client is &2{brand}" - reload: "&7FlappyAC has been reloaded" - violation-remove-invalid-player: "&7Invalid player name" - alert-toggle: - disable: "&7You will no longer receive alerts" - enable: "&7You will receive alerts" - violation-reset: - all: '&7Violations reset' - player: '&7Violations reset for &2{player}' - failed-check: '&2{player} &7failed &2{check} &7VL: &2{vl}' - punish: | - &7-------------------- - &2{player} &7has been caught cheating - &7-------------------- - hover: | - &7TPS: &2{tps} - &7Ping: &2{ping} - - &7Debug: &2{debug} - - commands: - - 'tp {player}' - - 'gamemode spectator' - -checks: - groundspoof: - a: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 200 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 20 - fly: - a: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 200 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 20 - badpackets: - a: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 10 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 10 - b: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 200 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 10 - skinblinker: - a: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 100 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 10 - blockplace: - a: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 100 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 10 - b: - #this check currently falses a fair bit so disabled by default - enabled: false - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 100 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 10 - timer: - a: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 200 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 10 - speed: - a: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 200 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 10 - forcefield: - a: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 200 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 10 - reach: - a: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 200 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 10 - jump: - #should be stable, but untested - a: - enabled: true - min-tps: 17.0 - punishable: true - broadcast-punishment: true - punish-vl: 200 - punish-commands: - - "kick {player} FlappyAC > Suspicious Activity" - vl: 20 \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml deleted file mode 100644 index 4f4306d..0000000 --- a/src/main/resources/plugin.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: FlappyAnticheat -version: ${project.version} -main: com.justdoom.flappyanticheat.FlappyAnticheat -api-version: 1.16 -load: POSTWORLD -commands: - flappyanticheat: - permission: flappyanticheat.commands - aliases: flappyac - flappyacflagclick: - permission: flappyanticheat.commands -permissions: - flappyanticheat.alerts: - default: op - flappyanticheat.commands: - default: op - flappyanticheat.bypass: - default: op \ No newline at end of file diff --git a/update-log.txt b/update-log.txt deleted file mode 100644 index e0ec7b2..0000000 --- a/update-log.txt +++ /dev/null @@ -1,145 +0,0 @@ -1.0.0 SNAPSHOT -first release - -1.1.0 SNAPSHOT -First semi stable version of Flappy -It has flags, punishments and a configurable config - -1.2.0 BETA -rename SNAPSHOT to BETA -Violations reset every 5 minutes! -Can change it in the config - -1.3.0 BETA -fix flag alert not working unless your the only/first player in the server -the punishable and enabled config options for checks now work -ground spoof a false positives dont happen as much -changed flag hover message colours -added violation reset command - -1.4.0 BETA -added bstats metrics -added flag-to-console option -added bypass permission -added alerts command to toggle if you get alerts or not -added runnable commands on flag click -stopped flagging while in spectator and creative -added punish message - -1.4.1 BETA -added messages to alerts message - -1.4.2 BETA -added more messages (alerts command, reload command and reset violations command) to the config + they use the prefix now -violation resets now output to the console -violation reset command can reset certain players, make print to console -violation reset message for resetting player -removed console output from working on a fly check - -1.5.0 BETA -Added a basic Fly A check -GroundSpoof A Now detects anti hunger -GroundSpoof A doesnt flag near pistons unless its a giant piston elevator -Added a violation and punishment log -Added an update checker -Changed to packets -fixed tps placeholder -Added BadPackets A-B check - -1.5.1 BETA -plugin crash fix - -1.5.2 BETA -fix violation double up - -1.6.0 BETA -flag hover message now shows what hack the player is most likely using, useful for groundspoof check -added custom punish, violation reset and flag events -change flappyacpunish to flappyacflagclick (back end stuff) -badpackets a now detects pitch lower than -90 -fixed groundspoof a false when falling into the void -fixed plugin breaking after trying to punish a player (was calling it async but it didnt like that) -added a skinblinker check -experimanetal checks have a * after the flag -added broadcast punishment option -added blockplace a-b checks -fixed fly and groundspoof A false with vines/ladders - -1.6.1 BETA -added timer check -added a client brand message on join -disabled fly A check temporarily -changed the /flappyac command message - -1.6.2 BETA -Cleaned up some code -Added a ForceField check. Thanks to https://www.spigotmc.org/members/1155839 for the check -Added a speed check -Stopped violation resets from running with no players online and spamming the console - -1.6.3 BETA -Fixed Speed A false on climbables -Fixed false with Speed A and Timer A when multiple people are moving/running (oops) -Fixed piston false with GroundSpoof and Speed A (I think) -Fixed groundspoof A false when dead body falls into void -Fixed blockplace B false with placing blocks with offhand -Fixed BlockPlace B false when right clicking entities -Fixed false with GroundSpoof A on join - -1.6.4 BETA -Disabled BadPackets B by default because too many falses when attacking entities legit -Added a Reach check - -1.7.0 BETA -Added back Fly A -Added Jump A -Made Speed A experimental as there are too many small falses -Added BadPackets C - D -Added a better way to get values from config which should reduce resource usage - -Thanks to Sprit for the Jump and Fly check - - - -Todo -- More checks -- Checks run on new thread (does packetevents do this?) -- Lag back feature/cancel??? Could be an extension -- Alert interval -- Max ping (add with pingspoof check) -- Possibly customizable buffer -- Include ban config for easy switch, could be on discord or with download -- Maybe create a website that lets you edit the config easily (change from kick punishments to ban punishments quickly) -- fix alerts toggle not working (works again????) - -Full release goals -- More checks -- Rewrite the base and some checks (make new branch) -- change flag to output config option to output to console or something -- ViaVersion compat -- Proper 1.8 - 1.17 support -- 1.17 support -- Discord integration -- View player profile command (player client brand, violations etc) -- Ban wave -- GUI for enabling checks etc -- Stop certain client brands joining -- make flag output to console in compacted messages (Player flagged Speed A 1000 times) -- worldguard support because has to many issues (groundspoof breaking below block and badpackets (a or b?) when attacking) -- Proper FlappyPlayer class and Position, Velocity, Rotation etc processors - - -api todo -- way to reset all/players violations -- way to add checks? -- api documentation -- add more options to violations reset event - - -false todo -groundspoof A on join false -fix badpackets B false with worldguard? -speed a false with slime launching -speed a false (with eating?) and jumping up blocks -speed a false when jumping side to side? -speed A false when taking damage in the air? \ No newline at end of file