mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Follow java rules more closely
This commit is contained in:
1 parent
fd93bc8ef2
commit
12ac4a8ebc
9 files changed
+147
-151
No files matched your search
@@ -56,6 +56,7 @@ public class Anticheat extends JavaPlugin
|
||||
private static boolean verbose;
|
||||
private static String updateFolder;
|
||||
private static Metrics metrics;
|
||||
private static final long XRAY_TIME = 1200;
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
@@ -113,7 +114,7 @@ public class Anticheat extends JavaPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 1200L, 1200L);
|
||||
}, XRAY_TIME, XRAY_TIME);
|
||||
if (verbose)
|
||||
{
|
||||
logger.log(Level.INFO, "[AC] Scheduled the XRay checker.");
|
||||
|
||||
@@ -52,10 +52,13 @@ public class CommandHandler implements CommandExecutor
|
||||
private static final Server SERVER = Bukkit.getServer();
|
||||
private static final int MED_THRESHOLD = 20;
|
||||
private static final int HIGH_THRESHOLD = 50;
|
||||
private static final String ADMIN_PERM = "anticheat.admin";
|
||||
private static final String MOD_PERM = "anticheat.mod";
|
||||
private static final String PERMISSIONS_ERROR = RED+"Insufficient Permissions.";
|
||||
|
||||
public void handleLog(CommandSender cs, String [] args)
|
||||
{
|
||||
if(hasPermission(cs,"system.log") || hasPermission(cs,"admin"))
|
||||
if(hasPermission(cs,"system.log") || hasPermission(cs,ADMIN_PERM))
|
||||
{
|
||||
if(args[1].equalsIgnoreCase("enable"))
|
||||
{
|
||||
@@ -88,13 +91,13 @@ public class CommandHandler implements CommandExecutor
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Insufficient permissions.");
|
||||
cs.sendMessage(PERMISSIONS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleXRay(CommandSender cs, String [] args)
|
||||
{
|
||||
if(hasPermission(cs,"system.xray") || hasPermission(cs,"admin") || hasPermission(cs,"mod"))
|
||||
if(hasPermission(cs,"system.xray") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
|
||||
{
|
||||
if(config.logXRay())
|
||||
{
|
||||
@@ -133,13 +136,13 @@ public class CommandHandler implements CommandExecutor
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Insufficient permissions.");
|
||||
cs.sendMessage(PERMISSIONS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleReset(CommandSender cs, String [] args)
|
||||
{
|
||||
if(hasPermission(cs,"system.reset") || hasPermission(cs,"admin"))
|
||||
if(hasPermission(cs,"system.reset") || hasPermission(cs,ADMIN_PERM))
|
||||
{
|
||||
List<Player> list = SERVER.matchPlayer(args[1]);
|
||||
if(list.size() == 1)
|
||||
@@ -168,7 +171,7 @@ public class CommandHandler implements CommandExecutor
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Insufficient permissions.");
|
||||
cs.sendMessage(PERMISSIONS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +180,7 @@ public class CommandHandler implements CommandExecutor
|
||||
if(cs instanceof Player)
|
||||
{
|
||||
Player sender = (Player)cs;
|
||||
if(hasPermission(cs,"system.spy") || hasPermission(cs,"mod"))
|
||||
if(hasPermission(cs,"system.spy") || hasPermission(cs,MOD_PERM))
|
||||
{
|
||||
if(!args[1].equalsIgnoreCase("off"))
|
||||
{
|
||||
@@ -222,7 +225,7 @@ public class CommandHandler implements CommandExecutor
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Insufficient permissions.");
|
||||
cs.sendMessage(PERMISSIONS_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -233,7 +236,7 @@ public class CommandHandler implements CommandExecutor
|
||||
|
||||
public void handleHelp(CommandSender cs)
|
||||
{
|
||||
if(hasPermission(cs,"system.help") || hasPermission(cs,"admin") || hasPermission(cs,"mod"))
|
||||
if(hasPermission(cs,"system.help") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
|
||||
{
|
||||
String base = "/AntiCheat ";
|
||||
cs.sendMessage("----------------------["+GREEN+"AntiCheat"+WHITE+"]----------------------");
|
||||
@@ -250,13 +253,13 @@ public class CommandHandler implements CommandExecutor
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Insufficient permissions.");
|
||||
cs.sendMessage(PERMISSIONS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleUpdate(CommandSender cs)
|
||||
{
|
||||
if(hasPermission(cs,"system.update") || hasPermission(cs,"admin"))
|
||||
if(hasPermission(cs,"system.update") || hasPermission(cs,ADMIN_PERM))
|
||||
{
|
||||
cs.sendMessage("Running "+GREEN+"AntiCheat "+WHITE+"v"+GREEN+Anticheat.getVersion());
|
||||
cs.sendMessage("-----------------------------------------------------");
|
||||
@@ -280,13 +283,13 @@ public class CommandHandler implements CommandExecutor
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Insufficient permissions.");
|
||||
cs.sendMessage(PERMISSIONS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleReport(CommandSender cs)
|
||||
{
|
||||
if(hasPermission(cs,"system.report") || hasPermission(cs,"admin") || hasPermission(cs,"mod"))
|
||||
if(hasPermission(cs,"system.report") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
|
||||
{
|
||||
getPlayers();
|
||||
if(!low.isEmpty())
|
||||
@@ -316,13 +319,13 @@ public class CommandHandler implements CommandExecutor
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Insufficient permissions.");
|
||||
cs.sendMessage(PERMISSIONS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public void handlePlayerReport(CommandSender cs,String [] args)
|
||||
{
|
||||
if(hasPermission(cs,"system.report") || hasPermission(cs,"admin") || hasPermission(cs,"mod"))
|
||||
if(hasPermission(cs,"system.report") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
|
||||
{
|
||||
List<Player> list = SERVER.matchPlayer(args[1]);
|
||||
if(list.size() == 1)
|
||||
@@ -360,7 +363,7 @@ public class CommandHandler implements CommandExecutor
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Insufficient permissions.");
|
||||
cs.sendMessage(PERMISSIONS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,14 +439,14 @@ public class CommandHandler implements CommandExecutor
|
||||
|
||||
public void handleReload(CommandSender cs)
|
||||
{
|
||||
if(hasPermission(cs,"system.reload") || hasPermission(cs,"admin"))
|
||||
if(hasPermission(cs,"system.reload") || hasPermission(cs,ADMIN_PERM))
|
||||
{
|
||||
config.load();
|
||||
cs.sendMessage(GREEN+"AntiCheat configuration reloaded.");
|
||||
}
|
||||
else
|
||||
{
|
||||
cs.sendMessage(RED+"Insufficient permissions.");
|
||||
cs.sendMessage(PERMISSIONS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,14 +521,7 @@ public class CommandHandler implements CommandExecutor
|
||||
{
|
||||
if(cs instanceof Player)
|
||||
{
|
||||
if(((Player)cs).hasPermission("anticheat."+permission))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ((Player)cs).hasPermission("anticheat."+permission);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -40,7 +40,6 @@ public class Configuration
|
||||
private File bukkitFile = null;
|
||||
private FileConfiguration config;
|
||||
private FileConfiguration level;
|
||||
private FileConfiguration bukkit;
|
||||
private boolean logConsole;
|
||||
private boolean logXRay;
|
||||
private boolean alertXRay;
|
||||
@@ -108,6 +107,7 @@ public class Configuration
|
||||
|
||||
public final void load()
|
||||
{
|
||||
FileConfiguration bukkit;
|
||||
micromanage.getPlugin().checkConfig();
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
level = YamlConfiguration.loadConfiguration(levelFile);
|
||||
|
||||
@@ -51,21 +51,18 @@ public class BlockListener extends EventListener
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
Block block = event.getBlock();
|
||||
if(player != null)
|
||||
if(player != null && checkManager.willCheck(player, CheckType.FAST_PLACE))
|
||||
{
|
||||
if(checkManager.willCheck(player, CheckType.FAST_PLACE))
|
||||
if(backend.checkFastPlace(player))
|
||||
{
|
||||
if(backend.checkFastPlace(player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
log("tried to place a block of "+block.getType().name()+" too fast.",player,CheckType.FAST_PLACE);
|
||||
}
|
||||
else
|
||||
{
|
||||
decrease(player);
|
||||
backend.logBlockPlace(player);
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
log("tried to place a block of "+block.getType().name()+" too fast.",player,CheckType.FAST_PLACE);
|
||||
}
|
||||
else
|
||||
{
|
||||
decrease(player);
|
||||
backend.logBlockPlace(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ import org.bukkit.event.Listener;
|
||||
|
||||
public class EventListener implements Listener
|
||||
{
|
||||
private static final Map<CheckType,Integer> usageList = new EnumMap<CheckType,Integer>(CheckType.class);
|
||||
private static final Map<String,Integer> decreaseList = new HashMap<String,Integer>();
|
||||
private static final Map<CheckType,Integer> USAGE_LIST = new EnumMap<CheckType,Integer>(CheckType.class);
|
||||
private static final Map<String,Integer> DECREASE_LIST = new HashMap<String,Integer>();
|
||||
private static final CheckManager CHECK_MANAGER = Anticheat.getManager().getCheckManager();
|
||||
private static final Backend BACKEND = Anticheat.getManager().getBackend();
|
||||
private static final Anticheat PLUGIN = Anticheat.getManager().getPlugin();
|
||||
@@ -45,7 +45,7 @@ public class EventListener implements Listener
|
||||
|
||||
private void logCheat(CheckType type,Player player)
|
||||
{
|
||||
usageList.put(type, getCheats(type)+1);
|
||||
USAGE_LIST.put(type, getCheats(type)+1);
|
||||
type.logUse(player);
|
||||
if(PLUGIN.getManager().getConfiguration().getFileLogLevel() == 2 && type.getUses(player) % 10 == 0)
|
||||
{
|
||||
@@ -55,15 +55,15 @@ public class EventListener implements Listener
|
||||
|
||||
public void resetCheck(CheckType type)
|
||||
{
|
||||
usageList.put(type, 0);
|
||||
USAGE_LIST.put(type, 0);
|
||||
}
|
||||
|
||||
public int getCheats(CheckType type)
|
||||
{
|
||||
int x = 0;
|
||||
if(usageList.get(type) != null)
|
||||
if(USAGE_LIST.get(type) != null)
|
||||
{
|
||||
x = usageList.get(type);
|
||||
x = USAGE_LIST.get(type);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
@@ -71,31 +71,31 @@ public class EventListener implements Listener
|
||||
private static void removeDecrease(Player player)
|
||||
{
|
||||
int x = 0;
|
||||
if(decreaseList.get(player.getName()) != null)
|
||||
if(DECREASE_LIST.get(player.getName()) != null)
|
||||
{
|
||||
x = decreaseList.get(player.getName());
|
||||
x = DECREASE_LIST.get(player.getName());
|
||||
x-=2;
|
||||
if(x < 0)
|
||||
{
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
decreaseList.put(player.getName(), x);
|
||||
DECREASE_LIST.put(player.getName(), x);
|
||||
}
|
||||
|
||||
public static void decrease(Player player)
|
||||
{
|
||||
int x = 0;
|
||||
if(decreaseList.get(player.getName()) != null)
|
||||
if(DECREASE_LIST.get(player.getName()) != null)
|
||||
{
|
||||
x = decreaseList.get(player.getName());
|
||||
x = DECREASE_LIST.get(player.getName());
|
||||
}
|
||||
x+=1;
|
||||
decreaseList.put(player.getName(), x);
|
||||
DECREASE_LIST.put(player.getName(), x);
|
||||
if(x >= 10)
|
||||
{
|
||||
PLAYER_MANAGER.decreaseLevel(player);
|
||||
decreaseList.put(player.getName(),0);
|
||||
DECREASE_LIST.put(player.getName(),0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,26 +38,25 @@ import net.h31ix.anticheat.xray.XRayTracker;
|
||||
public class AnticheatManager
|
||||
{
|
||||
private Anticheat plugin = null;
|
||||
private Configuration CONFIGURATION = null;
|
||||
private XRayTracker XRAY_TRACKER = null;
|
||||
private PlayerManager PLAYER_MANAGER = null;
|
||||
private CheckManager CHECK_MANAGER = null;
|
||||
private Backend BACKEND = null;
|
||||
private static Logger LOGGER = null;
|
||||
private static Logger FILE_LOGGER = null;
|
||||
private static Handler HANDLER;
|
||||
private Configuration configuration;
|
||||
private XRayTracker xrayTracker = null;
|
||||
private PlayerManager playerManager = null;
|
||||
private CheckManager checkManager = null;
|
||||
private Backend backend = null;
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private static final Logger FILE_LOGGER = Logger.getLogger(AnticheatManager.class.getName());
|
||||
private static Handler handler;
|
||||
private static final int LOG_LEVEL_HIGH = 3;
|
||||
|
||||
public AnticheatManager(Anticheat instance)
|
||||
{
|
||||
plugin = instance;
|
||||
// now load all the others!!!!!
|
||||
CONFIGURATION = new Configuration(this);
|
||||
XRAY_TRACKER = new XRayTracker();
|
||||
PLAYER_MANAGER = new PlayerManager(this);
|
||||
CHECK_MANAGER = new CheckManager(this);
|
||||
BACKEND = new Backend(this);
|
||||
LOGGER = Logger.getLogger("Minecraft");
|
||||
FILE_LOGGER = Logger.getLogger(AnticheatManager.class.getName());
|
||||
configuration = new Configuration(this);
|
||||
xrayTracker = new XRayTracker();
|
||||
playerManager = new PlayerManager(this);
|
||||
checkManager = new CheckManager(this);
|
||||
backend = new Backend(this);
|
||||
try
|
||||
{
|
||||
File file = new File(plugin.getDataFolder()+"/log");
|
||||
@@ -65,15 +64,15 @@ public class AnticheatManager
|
||||
{
|
||||
file.mkdir();
|
||||
}
|
||||
HANDLER = new FileHandler(plugin.getDataFolder()+"/log/anticheat.log.%u.txt",true);
|
||||
handler = new FileHandler(plugin.getDataFolder()+"/log/anticheat.log.%u.txt",true);
|
||||
} catch (IOException ex) {
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
} catch (SecurityException ex) {
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
HANDLER.setFormatter(new SimpleFormatter());
|
||||
handler.setFormatter(new SimpleFormatter());
|
||||
FILE_LOGGER.setUseParentHandlers(false);
|
||||
FILE_LOGGER.addHandler(HANDLER);
|
||||
FILE_LOGGER.addHandler(handler);
|
||||
}
|
||||
|
||||
public void log(String message)
|
||||
@@ -82,7 +81,7 @@ public class AnticheatManager
|
||||
{
|
||||
LOGGER.log(Level.WARNING,"[AC] ".concat(message));
|
||||
}
|
||||
if(getConfiguration().getFileLogLevel() == 3)
|
||||
if(getConfiguration().getFileLogLevel() == LOG_LEVEL_HIGH)
|
||||
{
|
||||
fileLog(message);
|
||||
}
|
||||
@@ -100,26 +99,26 @@ public class AnticheatManager
|
||||
|
||||
public Configuration getConfiguration()
|
||||
{
|
||||
return CONFIGURATION;
|
||||
return configuration;
|
||||
}
|
||||
|
||||
public XRayTracker getXRayTracker()
|
||||
{
|
||||
return XRAY_TRACKER;
|
||||
return xrayTracker;
|
||||
}
|
||||
|
||||
public PlayerManager getPlayerManager()
|
||||
{
|
||||
return PLAYER_MANAGER;
|
||||
return playerManager;
|
||||
}
|
||||
|
||||
public CheckManager getCheckManager()
|
||||
{
|
||||
return CHECK_MANAGER;
|
||||
return checkManager;
|
||||
}
|
||||
|
||||
public Backend getBackend()
|
||||
{
|
||||
return BACKEND;
|
||||
return backend;
|
||||
}
|
||||
}
|
||||
@@ -34,64 +34,65 @@ import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
|
||||
public class Backend
|
||||
{
|
||||
public static final int ENTERED_EXTITED_TIME = 20;
|
||||
public static final int SNEAK_TIME = 5;
|
||||
public static final int TELEPORT_TIME = 50;
|
||||
public static final int EXIT_FLY_TIME = 40;
|
||||
public static final int INSTANT_BREAK_TIME = 100;
|
||||
public static final int JOIN_TIME = 40;
|
||||
public static final int DROPPED_ITEM_TIME = 2;
|
||||
public static final int DAMAGE_TIME = 50;
|
||||
public static final int KNOCKBACK_DAMAGE_TIME = 50;
|
||||
private static final int ENTERED_EXTITED_TIME = 20;
|
||||
private static final int SNEAK_TIME = 5;
|
||||
private static final int TELEPORT_TIME = 50;
|
||||
private static final int EXIT_FLY_TIME = 40;
|
||||
private static final int INSTANT_BREAK_TIME = 100;
|
||||
private static final int JOIN_TIME = 40;
|
||||
private static final int DROPPED_ITEM_TIME = 2;
|
||||
private static final int DAMAGE_TIME = 50;
|
||||
private static final int KNOCKBACK_DAMAGE_TIME = 50;
|
||||
|
||||
public static final int FASTBREAK_LIMIT = 3;
|
||||
public static final int FASTBREAK_TIMEMAX = 500;
|
||||
public static final int FASTBREAK_MAXVIOLATIONS = 2;
|
||||
public static final int FASTBREAK_MAXVIOLATIONS_CREATIVE = 3;
|
||||
public static final int FASTBREAK_MAXVIOLATIONTIME = 10000;
|
||||
public static final int FASTPLACE_LIMIT = 2;
|
||||
public static final int FASTPLACE_ZEROLIMIT = 3;
|
||||
public static final int FASTPLACE_TIMEMAX = 100;
|
||||
public static final int FASTPLACE_MAXVIOLATIONS = 2;
|
||||
public static final int FASTPLACE_MAXVIOLATIONS_CREATIVE = 3;
|
||||
public static final int FASTPLACE_MAXVIOLATIONTIME = 10000;
|
||||
private static final int FASTBREAK_LIMIT = 3;
|
||||
private static final int FASTBREAK_TIMEMAX = 500;
|
||||
private static final int FASTBREAK_MAXVIOLATIONS = 2;
|
||||
private static final int FASTBREAK_MAXVIOLATIONS_CREATIVE = 3;
|
||||
private static final int FASTBREAK_MAXVIOLATIONTIME = 10000;
|
||||
private static final int FASTPLACE_ZEROLIMIT = 3;
|
||||
private static final int FASTPLACE_TIMEMAX = 100;
|
||||
private static final int FASTPLACE_MAXVIOLATIONS = 2;
|
||||
private static final int FASTPLACE_MAXVIOLATIONS_CREATIVE = 3;
|
||||
private static final int FASTPLACE_MAXVIOLATIONTIME = 10000;
|
||||
|
||||
private static final int BLOCK_PUNCH_MIN = 5;
|
||||
|
||||
private static final int CHAT_WARN_LEVEL = 7;
|
||||
private static final int CHAT_KICK_LEVEL = 10;
|
||||
private static final int CHAT_BAN_LEVEL = 3;
|
||||
|
||||
public static final int FLIGHT_LIMIT = 4;
|
||||
public static final int FLIGHT_MINIMUM = 1;
|
||||
public static final int FLIGHT_TIMELIMIT = 5000;
|
||||
public static final int Y_MAXVIOLATIONS = 1;
|
||||
public static final int Y_MAXVIOTIME = 5000;
|
||||
public static final int NOFALL_LIMIT = 5;
|
||||
private static final int FLIGHT_LIMIT = 4;
|
||||
private static final int Y_MAXVIOLATIONS = 1;
|
||||
private static final int Y_MAXVIOTIME = 5000;
|
||||
private static final int NOFALL_LIMIT = 5;
|
||||
|
||||
public static final int SPRINT_FOOD_MIN = 6;
|
||||
public static final int EAT_MIN = 20;
|
||||
public static final int HEAL_MIN = 35;
|
||||
public static final int ANIMATION_MIN = 60;
|
||||
public static final int CHAT_MIN = 100;
|
||||
public static final int BOW_MIN = 2;
|
||||
public static final int SPRINT_MIN = 2;
|
||||
public static final int BLOCK_BREAK_MIN = 1;
|
||||
public static final long BLOCK_PLACE_MIN = 1/3;
|
||||
private static final int SPRINT_FOOD_MIN = 6;
|
||||
private static final int EAT_MIN = 20;
|
||||
private static final int HEAL_MIN = 35;
|
||||
private static final int ANIMATION_MIN = 60;
|
||||
private static final int CHAT_MIN = 100;
|
||||
private static final int BOW_MIN = 2;
|
||||
private static final int SPRINT_MIN = 2;
|
||||
private static final int BLOCK_BREAK_MIN = 1;
|
||||
private static final long BLOCK_PLACE_MIN = 1/3;
|
||||
|
||||
public static final double BLOCK_MAX_DISTANCE = 6.0;
|
||||
public static final double ENTITY_MAX_DISTANCE = 5.5;
|
||||
private static final double BLOCK_MAX_DISTANCE = 6.0;
|
||||
private static final double ENTITY_MAX_DISTANCE = 5.5;
|
||||
|
||||
public static final double LADDER_Y_MAX = 0.11761;
|
||||
public static final double LADDER_Y_MIN = 0.11759;
|
||||
private static final double LADDER_Y_MAX = 0.11761;
|
||||
private static final double LADDER_Y_MIN = 0.11759;
|
||||
|
||||
public static final double Y_SPEED_MAX = 0.5;
|
||||
public static final double Y_MAXDIFF = 5;
|
||||
public static final double Y_TIME = 1000;
|
||||
public static final double XZ_SPEED_MAX = 0.4;
|
||||
public static final double XZ_SPEED_MAX_SPRINT = 0.65;
|
||||
public static final double XZ_SPEED_MAX_FLY = 0.56;
|
||||
public static final double XZ_SPEED_MAX_SNEAK = 0.2;
|
||||
public static final double XZ_SPEED_MAX_WATER = 0.19;
|
||||
public static final double XZ_SPEED_MAX_WATER_SPRINT = 0.3;
|
||||
private static final double Y_SPEED_MAX = 0.5;
|
||||
private static final double Y_MAXDIFF = 5;
|
||||
private static final double Y_TIME = 1000;
|
||||
private static final double XZ_SPEED_MAX = 0.4;
|
||||
private static final double XZ_SPEED_MAX_SPRINT = 0.65;
|
||||
private static final double XZ_SPEED_MAX_FLY = 0.56;
|
||||
private static final double XZ_SPEED_MAX_SNEAK = 0.2;
|
||||
private static final double XZ_SPEED_MAX_WATER = 0.19;
|
||||
private static final double XZ_SPEED_MAX_WATER_SPRINT = 0.3;
|
||||
|
||||
private static final int FLY_LOOP = 5;
|
||||
|
||||
private AnticheatManager micromanage = null;
|
||||
private List<String> droppedItem = new ArrayList<String>();
|
||||
@@ -113,8 +114,8 @@ public class Backend
|
||||
private Map<String,Integer> chatKicks = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> nofallViolation = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> fastBreakViolation = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> YaxisViolations = new HashMap<String,Integer>();
|
||||
private Map<String,Long> YaxisLastVio = new HashMap<String,Long>();
|
||||
private Map<String,Integer> yAxisViolations = new HashMap<String,Integer>();
|
||||
private Map<String,Long> yAxisLastViolation = new HashMap<String,Long>();
|
||||
private Map<String,Double> lastYcoord = new HashMap<String,Double>();
|
||||
private Map<String,Long> lastYtime = new HashMap<String,Long>();
|
||||
private Map<String,Integer> blocksBroken = new HashMap<String,Integer>();
|
||||
@@ -284,22 +285,22 @@ public class Backend
|
||||
double y1 = player.getLocation().getY();
|
||||
String name = player.getName();
|
||||
//Fix Y axis spam.
|
||||
if(!lastYcoord.containsKey(name) || !lastYtime.containsKey(name) || !YaxisViolations.containsKey(name) || !YaxisLastVio.containsKey(name))
|
||||
if(!lastYcoord.containsKey(name) || !lastYtime.containsKey(name) || !yAxisLastViolation.containsKey(name) || !yAxisLastViolation.containsKey(name))
|
||||
{
|
||||
lastYcoord.put(name, y1);
|
||||
YaxisViolations.put(name, 0);
|
||||
YaxisLastVio.put(name, 0L);
|
||||
yAxisViolations.put(name, 0);
|
||||
yAxisLastViolation.put(name, 0L);
|
||||
lastYtime.put(name, System.currentTimeMillis());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(y1 > lastYcoord.get(name) && YaxisViolations.get(name) > Y_MAXVIOLATIONS && (System.currentTimeMillis() - YaxisLastVio.get(name)) < Y_MAXVIOTIME)
|
||||
if(y1 > lastYcoord.get(name) && yAxisViolations.get(name) > Y_MAXVIOLATIONS && (System.currentTimeMillis() - yAxisLastViolation.get(name)) < Y_MAXVIOTIME)
|
||||
{
|
||||
Location g = player.getLocation();
|
||||
g.setY(lastYcoord.get(name));
|
||||
player.sendMessage(ChatColor.RED + "[AntiCheat] Fly hacking on the y-axis detected. Please wait 5 seconds to prevent getting damage.");
|
||||
YaxisViolations.put(name, YaxisViolations.get(name)+1);
|
||||
YaxisLastVio.put(name, System.currentTimeMillis());
|
||||
yAxisViolations.put(name, yAxisViolations.get(name)+1);
|
||||
yAxisLastViolation.put(name, System.currentTimeMillis());
|
||||
if(g.getBlock().getTypeId() == 0)
|
||||
{
|
||||
player.teleport(g);
|
||||
@@ -308,18 +309,18 @@ public class Backend
|
||||
}
|
||||
else
|
||||
{
|
||||
if(YaxisViolations.get(name) > Y_MAXVIOLATIONS && (System.currentTimeMillis() - YaxisLastVio.get(name)) > Y_MAXVIOTIME)
|
||||
if(yAxisViolations.get(name) > Y_MAXVIOLATIONS && (System.currentTimeMillis() - yAxisLastViolation.get(name)) > Y_MAXVIOTIME)
|
||||
{
|
||||
YaxisViolations.put(name, 0);
|
||||
YaxisLastVio.put(name, 0L);
|
||||
yAxisViolations.put(name, 0);
|
||||
yAxisLastViolation.put(name, 0L);
|
||||
}
|
||||
}
|
||||
if((y1 - lastYcoord.get(name)) > Y_MAXDIFF && (System.currentTimeMillis() - lastYtime.get(name)) < Y_TIME)
|
||||
{
|
||||
Location g = player.getLocation();
|
||||
g.setY(lastYcoord.get(name));
|
||||
YaxisViolations.put(name, YaxisViolations.get(name)+1);
|
||||
YaxisLastVio.put(name, System.currentTimeMillis());
|
||||
yAxisViolations.put(name, yAxisViolations.get(name)+1);
|
||||
yAxisLastViolation.put(name, System.currentTimeMillis());
|
||||
if(g.getBlock().getTypeId() == 0)
|
||||
{
|
||||
player.teleport(g);
|
||||
@@ -366,7 +367,7 @@ public class Backend
|
||||
//Start Fly bypass patch.
|
||||
if(flightViolation.containsKey(name) && flightViolation.get(name) > 0)
|
||||
{
|
||||
for(int i= 5;i>0;i--)
|
||||
for(int i=FLY_LOOP;i>0;i--)
|
||||
{
|
||||
Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-i, player.getLocation().getZ());
|
||||
Block lower = newLocation.getBlock();
|
||||
@@ -401,7 +402,7 @@ public class Backend
|
||||
if(blockPunches.get(name) != null)
|
||||
{
|
||||
int i = blockPunches.get(name);
|
||||
if(i < 5)
|
||||
if(i < BLOCK_PUNCH_MIN)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -455,10 +456,10 @@ public class Backend
|
||||
|
||||
public boolean checkFastPlace(Player player)
|
||||
{
|
||||
int violations = FASTBREAK_MAXVIOLATIONS;
|
||||
int violations = FASTPLACE_MAXVIOLATIONS;
|
||||
if(player.getGameMode() == GameMode.CREATIVE)
|
||||
{
|
||||
violations = FASTBREAK_MAXVIOLATIONS_CREATIVE;
|
||||
violations = FASTPLACE_MAXVIOLATIONS_CREATIVE;
|
||||
}
|
||||
long time = System.currentTimeMillis();
|
||||
String name = player.getName();
|
||||
@@ -775,14 +776,14 @@ public class Backend
|
||||
else
|
||||
{
|
||||
int amount = map.get(name)+1;
|
||||
if(amount < 6)
|
||||
if(amount < BLOCK_PUNCH_MIN+1)
|
||||
{
|
||||
map.put(name, amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
map.put(name, 5);
|
||||
map.put(name, BLOCK_PUNCH_MIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class CheckManager
|
||||
{
|
||||
public AnticheatManager manager = null;
|
||||
private AnticheatManager manager = null;
|
||||
private static List<CheckType> checkIgnoreList = new ArrayList<CheckType>();
|
||||
private static Multimap<String,CheckType> exemptList = ArrayListMultimap.create();
|
||||
private static int disabled = 0;
|
||||
|
||||
@@ -38,6 +38,8 @@ public class PlayerManager
|
||||
private static Configuration config = null;
|
||||
private static final int MED_THRESHOLD = 20;
|
||||
private static final int HIGH_THRESHOLD = 50;
|
||||
private static final int LEVEL_MAX = 60;
|
||||
private static final int LEVEL_BOOST = 5;
|
||||
|
||||
public PlayerManager(AnticheatManager instance) {
|
||||
config = instance.getConfiguration();
|
||||
@@ -78,11 +80,11 @@ public class PlayerManager
|
||||
else if(playerLevel <= HIGH_THRESHOLD && playerLevel+1 > HIGH_THRESHOLD)
|
||||
{
|
||||
reactHigh(player);
|
||||
level.put(player.getName(), MED_THRESHOLD+5);
|
||||
level.put(player.getName(), MED_THRESHOLD+LEVEL_BOOST);
|
||||
}
|
||||
else if (playerLevel > 60)
|
||||
else if (playerLevel > LEVEL_MAX)
|
||||
{
|
||||
level.put(player.getName(), MED_THRESHOLD+5);
|
||||
level.put(player.getName(), MED_THRESHOLD+LEVEL_BOOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,7 +114,7 @@ public class PlayerManager
|
||||
|
||||
public void setLevel(Player player, int x)
|
||||
{
|
||||
if(!(x > 60 && x < 0))
|
||||
if(!(x > LEVEL_MAX && x < 0))
|
||||
{
|
||||
level.put(player.getName(), x);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user