mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 06:28:52 +00:00
Update to 1.16, migrate config and more movement changes
This commit is contained in:
1 parent
20635a2acb
commit
add3fe5eae
27 files changed
+986
-692
No files matched your search
@@ -19,21 +19,35 @@
|
||||
|
||||
package com.rammelkast.anticheatreloaded.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.files.Config;
|
||||
import com.rammelkast.anticheatreloaded.config.files.Enterprise;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.mysql.*;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.yaml.*;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.*;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.mysql.MySQLGroupsHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.mysql.MySQLLangHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.mysql.MySQLLevelsHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.mysql.MySQLMagicHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.mysql.MySQLRulesHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlChecksHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlGroupsHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlLangHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlLevelsHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlMagicHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlRulesHolder;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Groups;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Levels;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Rules;
|
||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Configuration {
|
||||
|
||||
private AntiCheatManager manager;
|
||||
@@ -45,6 +59,7 @@ public class Configuration {
|
||||
private Groups groups;
|
||||
private Levels levels;
|
||||
private Rules rules;
|
||||
private Checks checks;
|
||||
|
||||
private ArrayList<ConfigurationFile> flatfiles;
|
||||
private ArrayList<ConfigurationTable> dbfiles;
|
||||
@@ -83,6 +98,9 @@ public class Configuration {
|
||||
rules = new YamlRulesHolder(plugin, this);
|
||||
flatfiles.add((YamlRulesHolder) rules);
|
||||
}
|
||||
|
||||
checks = new YamlChecksHolder(plugin, this);
|
||||
flatfiles.add((YamlChecksHolder) checks);
|
||||
|
||||
InvocationHandler handler;
|
||||
if (config.enterprise.getValue() && enterprise.configMagic.getValue()) {
|
||||
@@ -195,4 +213,8 @@ public class Configuration {
|
||||
public Magic getMagic() {
|
||||
return magic;
|
||||
}
|
||||
|
||||
public Checks getChecks() {
|
||||
return checks;
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||
|
||||
public class YamlChecksHolder extends ConfigurationFile implements Checks {
|
||||
|
||||
public static final String FILENAME = "checks.yml";
|
||||
|
||||
public YamlChecksHolder(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(CheckType checkType, String subcheck, String name) {
|
||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getConfigurationSection(subcheck)
|
||||
.getBoolean(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSubcheckEnabled(CheckType checkType, String subcheck) {
|
||||
return this.getBoolean(checkType, subcheck, "enabled");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDouble(CheckType checkType, String subcheck, String name) {
|
||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getConfigurationSection(subcheck)
|
||||
.getDouble(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInteger(CheckType checkType, String subcheck, String name) {
|
||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getConfigurationSection(subcheck)
|
||||
.getInt(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(CheckType checkType, String name) {
|
||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getBoolean(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDouble(CheckType checkType, String name) {
|
||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getDouble(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInteger(CheckType checkType, String name) {
|
||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getInt(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(CheckType checkType) {
|
||||
// If the root of a check has no enabled or disabled option, it has to be configured on a subcheck basis
|
||||
if (!this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).contains("enabled"))
|
||||
return true;
|
||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getBoolean("enabled");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.config.providers;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
|
||||
public interface Checks {
|
||||
|
||||
public boolean getBoolean(CheckType checkType, String name);
|
||||
|
||||
public boolean getBoolean(CheckType checkType, String subcheck, String name);
|
||||
|
||||
public double getDouble(CheckType checkType, String name);
|
||||
|
||||
public double getDouble(CheckType checkType, String subcheck, String name);
|
||||
|
||||
public int getInteger(CheckType checkType, String name);
|
||||
|
||||
public int getInteger(CheckType checkType, String subcheck, String name);
|
||||
|
||||
public boolean isEnabled(CheckType checkType);
|
||||
|
||||
public boolean isSubcheckEnabled(CheckType checkType, String subcheck);
|
||||
|
||||
}
|
||||
@@ -166,14 +166,6 @@ public interface Magic {
|
||||
* Maximum speed that a player can climb a waterfall; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double WATER_CLIMB_MAX();
|
||||
/**
|
||||
* Number of times a player can fly on the y-axis before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int Y_MAXVIOLATIONS();
|
||||
/**
|
||||
* Time a player is forced to wait after flying on the y-axis; Type=SYSTEM, Leniency=DECREASE.
|
||||
*/
|
||||
public int Y_MAXVIOTIME();
|
||||
/**
|
||||
* Number of times a player can fail a velocity check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
@@ -198,18 +190,6 @@ public interface Magic {
|
||||
* Number of times a player can fail the nofall check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int NOFALL_LIMIT();
|
||||
/**
|
||||
* Number of times a player can fail the ascension check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int ASCENSION_COUNT_MAX();
|
||||
/**
|
||||
* Number of times a player can fail the ascension check while in water before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int WATER_ASCENSION_VIOLATION_MAX();
|
||||
/**
|
||||
* Number of times a player can be caught speeding in water before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int WATER_SPEED_VIOLATION_MAX();
|
||||
/**
|
||||
* Number of times a player can sprint without proper food level before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
@@ -286,66 +266,10 @@ public interface Magic {
|
||||
* Maximum speed a player on a ladder can travel downwards
|
||||
*/
|
||||
public double LADDER_DOWN_MAX();
|
||||
/**
|
||||
* Maximum speed a player can travel up; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double Y_SPEED_MAX();
|
||||
/**
|
||||
* Maximum difference between the player's last 2 Y values when traveling up; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double Y_MAXDIFF();
|
||||
/**
|
||||
* Time in between Y difference measures; Type=SYSTEM, Leniency=DECREASE.
|
||||
*/
|
||||
public int Y_TIME();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while sprinting; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_SPRINT();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while flying; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_FLY();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while under the influence; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_POTION();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while sprinting while under the influence; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_POTION_SPRINT();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while sneaking; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_SNEAK();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards in water; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_WATER();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards in water while sprinting; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_WATER_SPRINT();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards on soul sand; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_SOULSAND();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards on soul sand while sprinting; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_SOULSAND_SPRINT();
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards on soul sand while under the influence; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_SOULSAND_POTION();
|
||||
/**
|
||||
* Maximum times a player can fail the speed check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int SPEED_MAX();
|
||||
/**
|
||||
* The number of clicks we should wait before checking if the player has used fast inventory; Type=INTEGER; Leniency=INCREASE.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user