mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Code cleanup
This commit is contained in:
1 parent
6afe0049c5
commit
f88c31051b
13 files changed
+28
-36
No files matched your search
@@ -47,7 +47,6 @@ import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.YAxisCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
|
||||
@@ -27,13 +27,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.checkassist.KillauraAssist;
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.checkassist.KillauraAssist;
|
||||
|
||||
@@ -41,6 +41,7 @@ public class CommandReset extends CommandBase {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
User user;
|
||||
|
||||
@@ -57,10 +57,13 @@ public class Configuration {
|
||||
// Now load others
|
||||
enterprise = new Enterprise(plugin, this);
|
||||
|
||||
flatfiles = new ArrayList<ConfigurationFile>() {{
|
||||
add(config);
|
||||
add(enterprise);
|
||||
}};
|
||||
flatfiles = new ArrayList<ConfigurationFile>() {
|
||||
private static final long serialVersionUID = 4497798966909062852L;
|
||||
{
|
||||
add(config);
|
||||
add(enterprise);
|
||||
}
|
||||
};
|
||||
|
||||
dbfiles = new ArrayList<ConfigurationTable>();
|
||||
|
||||
|
||||
@@ -170,7 +170,8 @@ public class ConfigurationFile {
|
||||
return path;
|
||||
}
|
||||
|
||||
public T getValue() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public T getValue() {
|
||||
return (T) value;
|
||||
}
|
||||
|
||||
@@ -180,7 +181,8 @@ public class ConfigurationFile {
|
||||
return value;
|
||||
}
|
||||
|
||||
public T getDefaultValue() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public T getDefaultValue() {
|
||||
return (T) getDefaultConfigFile().get(path);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@ public class ConfigurationTable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void convertToUUID(String colName) {
|
||||
String sqlSelect = "SELECT " + colName + " FROM " + getFullTable();
|
||||
String sqlUpdate = "UPDATE " + getFullTable() + " SET " + colName + " = ? WHERE " + colName + " = ?";
|
||||
|
||||
+1
-1
@@ -74,6 +74,6 @@ public class YamlLevelsHolder extends ConfigurationFile implements Levels {
|
||||
}
|
||||
|
||||
private void saveLevel(UUID uuid, int level) {
|
||||
new ConfigValue<Integer>(uuid.toString(), false).setValue(new Integer(level));
|
||||
new ConfigValue<Integer>(uuid.toString(), false).setValue(level);
|
||||
}
|
||||
}
|
||||
@@ -36,12 +36,8 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
public class UserManager {
|
||||
private List<User> users = new ArrayList<User>();
|
||||
private static AntiCheatManager manager;
|
||||
private static Configuration config;
|
||||
private static final ChatColor GRAY = ChatColor.GRAY;
|
||||
private static final ChatColor GOLD = ChatColor.GOLD;
|
||||
private static final ChatColor RED = ChatColor.RED;
|
||||
|
||||
private AntiCheatManager manager;
|
||||
private Configuration config;
|
||||
/**
|
||||
* Initialize the user manager
|
||||
*
|
||||
|
||||
@@ -59,7 +59,7 @@ import com.google.gson.JsonPrimitive;
|
||||
* <p>
|
||||
* Check out https://bStats.org/ to learn more about bStats!
|
||||
*/
|
||||
@SuppressWarnings({ "WeakerAccess", "unused" })
|
||||
@SuppressWarnings({ "unused" })
|
||||
public class Metrics {
|
||||
|
||||
static {
|
||||
|
||||
@@ -19,7 +19,13 @@
|
||||
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -29,15 +35,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public final class Utilities {
|
||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||
@@ -52,7 +49,6 @@ public final class Utilities {
|
||||
* @return true if they cannot stand there
|
||||
*/
|
||||
public static boolean cantStandAtSingle(Block block) {
|
||||
// TODO: Implement Better to reduce false positives (done? lets test...)
|
||||
Block otherBlock = block.getLocation().add(0, -0.5, 0).getBlock();
|
||||
boolean center = otherBlock.getType() == Material.AIR || otherBlock.getType() == Material.CAVE_AIR;
|
||||
return center;
|
||||
@@ -461,6 +457,7 @@ public final class Utilities {
|
||||
*/
|
||||
public static ArrayList<String> stringToList(final String string) {
|
||||
return new ArrayList<String>() {
|
||||
private static final long serialVersionUID = 364115444874638230L;
|
||||
{
|
||||
add(string);
|
||||
}
|
||||
|
||||
@@ -82,9 +82,9 @@ import java.util.TreeMap;
|
||||
*/
|
||||
public class Rule {
|
||||
|
||||
private static String string;
|
||||
private static final String VARIABLE_SET_REGEX = ".*(_).*=.*";
|
||||
private static final String FUNCTION_REGEX = ".*\\..*";
|
||||
private String string;
|
||||
private Type type;
|
||||
|
||||
public enum Type {
|
||||
@@ -129,7 +129,8 @@ public class Rule {
|
||||
* @param string the string value to load
|
||||
* @return an instance of Rule if an implementation exists to handle this rule, null if none are found
|
||||
*/
|
||||
public static Rule load(String string) {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static Rule load(String string) {
|
||||
for (Type type : Type.values()) {
|
||||
if (type.matches(string)) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user