mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Add much more configuration ability to spam module. Fixes #247
This commit is contained in:
1 parent
e474be703e
commit
bd2fd0952f
14 files changed
+214
-90
No files matched your search
@@ -8,6 +8,7 @@
|
||||
<url>http://gravitydevelopment.net</url>
|
||||
<properties>
|
||||
<project.build.version>${project.version}</project.build.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -46,7 +46,6 @@ public class AntiCheat extends JavaPlugin {
|
||||
private static Configuration config;
|
||||
private static boolean verbose;
|
||||
private static boolean developer;
|
||||
private static final long XRAY_TIME = 1200;
|
||||
private static final int PROJECT_ID = 38723;
|
||||
private static PacketManager packetManager;
|
||||
private static boolean protocolLib = false;
|
||||
@@ -105,9 +104,10 @@ public class AntiCheat extends JavaPlugin {
|
||||
|
||||
private void setupXray() {
|
||||
final XRayTracker xtracker = manager.getXRayTracker();
|
||||
if (config.getConfig().logXRayStats.getValue()) {
|
||||
final int time = config.getConfig().alertXRayInterval.getValue() * 20;
|
||||
if (config.getConfig().checkXRay.getValue()) {
|
||||
eventList.add(new XRayListener());
|
||||
if (config.getConfig().alertWhenXRayIsFound.getValue()) {
|
||||
if (config.getConfig().alertXRay.getValue()) {
|
||||
getServer().getScheduler().runTaskTimerAsynchronously(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -122,7 +122,7 @@ public class AntiCheat extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, XRAY_TIME, XRAY_TIME);
|
||||
}, time, time);
|
||||
|
||||
verboseLog("Scheduled the XRay checker.");
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class CommandHandler implements CommandExecutor {
|
||||
|
||||
public void handleXRay(CommandSender cs, String[] args) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_XRAY)) {
|
||||
if (CONFIG.getConfig().logXRayStats.getValue()) {
|
||||
if (CONFIG.getConfig().checkXRay.getValue()) {
|
||||
List<Player> list = SERVER.matchPlayer(args[1]);
|
||||
if (list.size() == 1) {
|
||||
Player player = list.get(0);
|
||||
|
||||
@@ -29,24 +29,31 @@ public class Config extends ConfigurationFile {
|
||||
public static final String FILENAME = "config.yml";
|
||||
|
||||
public ConfigValue<Boolean> logToConsole;
|
||||
public ConfigValue<Boolean> logXRayStats;
|
||||
public ConfigValue<Boolean> autoUpdate;
|
||||
public ConfigValue<Boolean> verboseStartup;
|
||||
public ConfigValue<Boolean> alertWhenXRayIsFound;
|
||||
public ConfigValue<Boolean> silentMode;
|
||||
public ConfigValue<Boolean> exemptOp;
|
||||
public ConfigValue<Boolean> trackCreativeXRay;
|
||||
|
||||
public ConfigValue<Boolean> checkXRay;
|
||||
public ConfigValue<Boolean> checkCreativeXRay;
|
||||
public ConfigValue<Boolean> alertXRay;
|
||||
public ConfigValue<Integer> alertXRayInterval;
|
||||
|
||||
public ConfigValue<Boolean> eventChains;
|
||||
public ConfigValue<Boolean> enterprise;
|
||||
public ConfigValue<Boolean> blockChatSpam;
|
||||
public ConfigValue<Boolean> blockCommandSpam;
|
||||
|
||||
public ConfigValue<Boolean> blockChatSpamSpeed;
|
||||
public ConfigValue<Boolean> blockCommandSpamSpeed;
|
||||
public ConfigValue<Boolean> blockChatSpamRepetition;
|
||||
public ConfigValue<Boolean> blockCommandSpamRepetition;
|
||||
public ConfigValue<String> chatSpamActionOne;
|
||||
public ConfigValue<String> chatSpamActionTwo;
|
||||
public ConfigValue<String> commandSpamActionOne;
|
||||
public ConfigValue<String> commandSpamActionTwo;
|
||||
|
||||
public ConfigValue<Integer> fileLogLevel;
|
||||
|
||||
public ConfigValue<String> spamKickAction;
|
||||
public ConfigValue<String> spamBanAction;
|
||||
|
||||
public ConfigValue<List<String>> exemptedWorlds;
|
||||
public ConfigValue<List<String>> disabledWorlds;
|
||||
|
||||
public Config(AntiCheat plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
@@ -55,23 +62,31 @@ public class Config extends ConfigurationFile {
|
||||
@Override
|
||||
public void open() {
|
||||
logToConsole = new ConfigValue<Boolean>("system.log-to-console");
|
||||
logXRayStats = new ConfigValue<Boolean>("xray.check-xray");
|
||||
alertWhenXRayIsFound = new ConfigValue<Boolean>("xray.alert");
|
||||
|
||||
checkXRay = new ConfigValue<Boolean>("xray.check-xray");
|
||||
alertXRay = new ConfigValue<Boolean>("xray.alert");
|
||||
alertXRayInterval = new ConfigValue<Integer>("xray.alert-interval");
|
||||
checkCreativeXRay = new ConfigValue<Boolean>("xray.check-creative");
|
||||
|
||||
autoUpdate = new ConfigValue<Boolean>("system.auto-update");
|
||||
verboseStartup = new ConfigValue<Boolean>("system.verbose-startup");
|
||||
silentMode = new ConfigValue<Boolean>("system.silent-mode");
|
||||
exemptOp = new ConfigValue<Boolean>("system.exempt-op");
|
||||
trackCreativeXRay = new ConfigValue<Boolean>("xray.check-creative");
|
||||
eventChains = new ConfigValue<Boolean>("system.event-chains");
|
||||
enterprise = new ConfigValue<Boolean>("system.enterprise");
|
||||
blockChatSpam = new ConfigValue<Boolean>("spam.chat");
|
||||
blockCommandSpam = new ConfigValue<Boolean>("spam.command");
|
||||
|
||||
blockChatSpamSpeed = new ConfigValue<Boolean>("spam.chat.block-speed");
|
||||
blockChatSpamRepetition = new ConfigValue<Boolean>("spam.chat.block-repetition");
|
||||
chatSpamActionOne = new ConfigValue<String>("spam.chat.action-one");
|
||||
chatSpamActionTwo = new ConfigValue<String>("spam.chat.action-two");
|
||||
|
||||
blockCommandSpamSpeed = new ConfigValue<Boolean>("spam.command.block-speed");
|
||||
blockCommandSpamRepetition = new ConfigValue<Boolean>("spam.command.block-repetition");
|
||||
commandSpamActionOne = new ConfigValue<String>("spam.command.action-one");
|
||||
commandSpamActionTwo = new ConfigValue<String>("spam.command.action-two");
|
||||
|
||||
fileLogLevel = new ConfigValue<Integer>("system.file-log-level");
|
||||
|
||||
spamKickAction = new ConfigValue<String>("spam.action-one");
|
||||
spamBanAction = new ConfigValue<String>("spam.action-two");
|
||||
|
||||
exemptedWorlds = new ConfigValue<List<String>>("disable-in");
|
||||
disabledWorlds = new ConfigValue<List<String>>("disable-in");
|
||||
}
|
||||
}
|
||||
@@ -148,17 +148,21 @@ public class Magic extends ConfigurationFile {
|
||||
*/
|
||||
public int BLOCK_PUNCH_MIN;
|
||||
/**
|
||||
* Number of chat spam violations before a player is warned; Type=integer, +Leniency=Increase.
|
||||
* Number of command spam violations before action one is executed; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public int CHAT_WARN_LEVEL;
|
||||
public int COMMAND_ACTION_ONE_LEVEL;
|
||||
/**
|
||||
* Number of chat spam violations before a player is kicked; Type=integer, +Leniency=Increase.
|
||||
* Number of command spam violations before action two is executed; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public int CHAT_KICK_LEVEL;
|
||||
public int COMMAND_ACTION_TWO_LEVEL;
|
||||
/**
|
||||
* Number of kicks for chat violation before a player is banned; Type=integer, +Leniency=Increase.
|
||||
* Number of chat spam violations before action one is executed; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public int CHAT_BAN_LEVEL;
|
||||
public int CHAT_ACTION_ONE_LEVEL;
|
||||
/**
|
||||
* Number of chat spam violations before action two is executed; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public int CHAT_ACTION_TWO_LEVEL;
|
||||
/**
|
||||
* Number of times a player can be caught in-flight before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
@@ -223,12 +227,20 @@ public class Magic extends ConfigurationFile {
|
||||
* Minimum time between animations; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public int ANIMATION_MIN;
|
||||
/**
|
||||
* Minimum time between commands; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public int COMMAND_MIN;
|
||||
/**
|
||||
* MTime before repeating a command is ignored; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public int COMMAND_REPEAT_MIN;
|
||||
/**
|
||||
* Minimum time between chats; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public int CHAT_MIN;
|
||||
/**
|
||||
* Minimum time between repeating yourself in the chat; Type=system, +Leniency=Increase.
|
||||
* Time before repeating yourself in chat is ignored; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public int CHAT_REPEAT_MIN;
|
||||
/**
|
||||
@@ -400,9 +412,10 @@ public class Magic extends ConfigurationFile {
|
||||
FASTPLACE_MAXVIOLATIONS_CREATIVE = new ConfigValue<Integer>("FASTPLACE_MAXVIOLATIONS_CREATIVE").getValue();
|
||||
FASTPLACE_MAXVIOLATIONTIME = new ConfigValue<Integer>("FASTPLACE_MAXVIOLATIONTIME").getValue();
|
||||
BLOCK_PUNCH_MIN = new ConfigValue<Integer>("BLOCK_PUNCH_MIN").getValue();
|
||||
CHAT_WARN_LEVEL = new ConfigValue<Integer>("CHAT_WARN_LEVEL").getValue();
|
||||
CHAT_KICK_LEVEL = new ConfigValue<Integer>("CHAT_KICK_LEVEL").getValue();
|
||||
CHAT_BAN_LEVEL = new ConfigValue<Integer>("CHAT_BAN_LEVEL").getValue();
|
||||
CHAT_ACTION_ONE_LEVEL = new ConfigValue<Integer>("CHAT_ACTION_ONE_LEVEL").getValue();
|
||||
CHAT_ACTION_TWO_LEVEL = new ConfigValue<Integer>("CHAT_ACTION_TWO_LEVEL").getValue();
|
||||
COMMAND_ACTION_ONE_LEVEL = new ConfigValue<Integer>("COMMAND_ACTION_ONE_LEVEL").getValue();
|
||||
COMMAND_ACTION_TWO_LEVEL = new ConfigValue<Integer>("COMMAND_ACTION_TWO_LEVEL").getValue();
|
||||
FLIGHT_LIMIT = new ConfigValue<Integer>("FLIGHT_LIMIT").getValue();
|
||||
FLIGHT_BLOCK_LIMIT = new ConfigValue<Double>("FLIGHT_BLOCK_LIMIT").getValue();
|
||||
WATER_CLIMB_MAX = new ConfigValue<Double>("WATER_CLIMB_MAX").getValue();
|
||||
@@ -419,6 +432,8 @@ public class Magic extends ConfigurationFile {
|
||||
WATER_SPEED_VIOLATION_MAX = new ConfigValue<Integer>("WATER_SPEED_VIOLATION_MAX").getValue();
|
||||
SPRINT_FOOD_MIN = new ConfigValue<Integer>("SPRINT_FOOD_MIN").getValue();
|
||||
ANIMATION_MIN = new ConfigValue<Integer>("ANIMATION_MIN").getValue();
|
||||
COMMAND_MIN = new ConfigValue<Integer>("COMMAND_MIN").getValue();
|
||||
COMMAND_REPEAT_MIN = new ConfigValue<Integer>("COMMAND_REPEAT_MIN").getValue();
|
||||
CHAT_MIN = new ConfigValue<Integer>("CHAT_MIN").getValue();
|
||||
CHAT_REPEAT_MIN = new ConfigValue<Integer>("CHAT_REPEAT_MIN").getValue();
|
||||
SPRINT_MIN = new ConfigValue<Double>("SPRINT_MIN").getValue();
|
||||
|
||||
@@ -45,13 +45,13 @@ public class PlayerListener extends EventListener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (getCheckManager().willCheck(player, CheckType.SPAM) && getConfig().getConfig().blockCommandSpam.getValue()) {
|
||||
CheckResult result = getBackend().checkSpam(player, event.getMessage());
|
||||
if (getCheckManager().willCheck(player, CheckType.COMMAND_SPAM)) {
|
||||
CheckResult result = getBackend().checkCommandSpam(player, event.getMessage());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
player.sendMessage(ChatColor.RED + result.getMessage());
|
||||
getBackend().processChatSpammer(player);
|
||||
log(null, player, CheckType.SPAM);
|
||||
if (!silentMode()) player.sendMessage(ChatColor.RED + result.getMessage());
|
||||
getBackend().processCommandSpammer(player);
|
||||
log(null, player, CheckType.COMMAND_SPAM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,15 +140,15 @@ public class PlayerListener extends EventListener {
|
||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (getCheckManager().willCheck(player, CheckType.SPAM) && getConfig().getConfig().blockChatSpam.getValue()) {
|
||||
CheckResult result = getBackend().checkSpam(player, event.getMessage());
|
||||
if (getCheckManager().willCheck(player, CheckType.CHAT_SPAM)) {
|
||||
CheckResult result = getBackend().checkChatSpam(player, event.getMessage());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
if (!result.getMessage().equals("")) {
|
||||
if (!result.getMessage().equals("") && !silentMode()) {
|
||||
player.sendMessage(ChatColor.RED + result.getMessage());
|
||||
}
|
||||
getBackend().processChatSpammer(player);
|
||||
log(null, player, CheckType.SPAM);
|
||||
log(null, player, CheckType.CHAT_SPAM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,6 @@ public class PlayerListener extends EventListener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerKick(PlayerKickEvent event) {
|
||||
getBackend().clearChatLevel(event.getPlayer());
|
||||
getBackend().garbageClean(event.getPlayer());
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Backend {
|
||||
private Map<String, Integer> ascensionCount = new HashMap<String, Integer>();
|
||||
private Map<String, Double> blocksOverFlight = new HashMap<String, Double>();
|
||||
private Map<String, Integer> chatLevel = new HashMap<String, Integer>();
|
||||
private Map<String, Integer> chatKicks = new HashMap<String, Integer>();
|
||||
private Map<String, Integer> commandLevel = new HashMap<String, Integer>();
|
||||
private Map<String, Integer> nofallViolation = new HashMap<String, Integer>();
|
||||
private Map<String, Integer> speedViolation = new HashMap<String, Integer>();
|
||||
private Map<String, Integer> fastBreakViolation = new HashMap<String, Integer>();
|
||||
@@ -127,7 +127,6 @@ public class Backend {
|
||||
isAscending.remove(pN);
|
||||
ascensionCount.remove(pN);
|
||||
blocksOverFlight.remove(pN);
|
||||
chatLevel.remove(pN);
|
||||
nofallViolation.remove(pN);
|
||||
fastBreakViolation.remove(pN);
|
||||
yAxisViolations.remove(pN);
|
||||
@@ -748,7 +747,7 @@ public class Backend {
|
||||
lastHeal.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public CheckResult checkSpam(Player player, String msg) {
|
||||
public CheckResult checkChatSpam(Player player, String msg) {
|
||||
String name = player.getName();
|
||||
User user = manager.getUserManager().getUser(name);
|
||||
if (user.getLastMessageTime() != -1) {
|
||||
@@ -762,8 +761,12 @@ public class Backend {
|
||||
if (System.currentTimeMillis() - l > magic.CHAT_REPEAT_MIN * 100) {
|
||||
user.clearMessages();
|
||||
break;
|
||||
} else if ((m.equalsIgnoreCase(msg) && i == 1) || System.currentTimeMillis() - user.getLastMessageTime() < magic.CHAT_MIN * 2) {
|
||||
return new CheckResult(Result.FAILED, lang.spamWarning.getValue());
|
||||
} else {
|
||||
if (manager.getConfiguration().getConfig().blockChatSpamRepetition.getValue() && m.equalsIgnoreCase(msg) && i == 1) {
|
||||
return new CheckResult(Result.FAILED, lang.spamWarning.getValue());
|
||||
} else if (manager.getConfiguration().getConfig().blockChatSpamSpeed.getValue() && System.currentTimeMillis() - user.getLastCommandTime() < magic.COMMAND_MIN * 2) {
|
||||
return new CheckResult(Result.FAILED, lang.spamWarning.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -771,6 +774,33 @@ public class Backend {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
public CheckResult checkCommandSpam(Player player, String cmd) {
|
||||
String name = player.getName();
|
||||
User user = manager.getUserManager().getUser(name);
|
||||
if (user.getLastCommandTime() != -1) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
String m = user.getCommand(i);
|
||||
if (m == null) {
|
||||
break;
|
||||
}
|
||||
Long l = user.getCommandTime(i);
|
||||
|
||||
if (System.currentTimeMillis() - l > magic.COMMAND_REPEAT_MIN * 100) {
|
||||
user.clearCommands();
|
||||
break;
|
||||
} else {
|
||||
if (manager.getConfiguration().getConfig().blockCommandSpamRepetition.getValue() && m.equalsIgnoreCase(cmd) && i == 1) {
|
||||
return new CheckResult(Result.FAILED, lang.spamWarning.getValue());
|
||||
} else if (manager.getConfiguration().getConfig().blockCommandSpamSpeed.getValue() && System.currentTimeMillis() - user.getLastCommandTime() < magic.COMMAND_MIN * 2) {
|
||||
return new CheckResult(Result.FAILED, lang.spamWarning.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
user.addCommand(cmd);
|
||||
return PASS;
|
||||
}
|
||||
|
||||
public CheckResult checkInventoryClicks(Player player) {
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
return PASS;
|
||||
@@ -865,10 +895,6 @@ public class Backend {
|
||||
itemInHand.put(player.getName(), player.getItemInHand().getType());
|
||||
}
|
||||
|
||||
public void clearChatLevel(Player player) {
|
||||
chatLevel.remove(player.getName());
|
||||
}
|
||||
|
||||
public void logInstantBreak(final Player player) {
|
||||
instantBreakExempt.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
@@ -1036,24 +1062,24 @@ public class Backend {
|
||||
}
|
||||
|
||||
public void processChatSpammer(Player player) {
|
||||
if (chatLevel.get(player.getName()) != null && chatLevel.get(player.getName()) >= magic.CHAT_KICK_LEVEL) {
|
||||
if (player != null && player.isOnline()) {
|
||||
String name = player.getName();
|
||||
int kick;
|
||||
if (chatKicks.get(name) == null || chatKicks.get(name) == 0) {
|
||||
kick = 1;
|
||||
chatKicks.put(name, kick);
|
||||
} else {
|
||||
kick = chatKicks.get(name) + 1;
|
||||
chatKicks.put(name, kick);
|
||||
}
|
||||
|
||||
String event = kick <= magic.CHAT_BAN_LEVEL ? manager.getConfiguration().getConfig().spamKickAction.getValue() : manager.getConfiguration().getConfig().spamBanAction.getValue();
|
||||
manager.getUserManager().execute(manager.getUserManager().getUser(player.getName()), Utilities.stringToList(event), CheckType.SPAM, lang.spamKickReason.getValue() + "(" + kick + "/3)", Utilities.stringToList(lang.spamWarning.getValue()), lang.spamBanReason.getValue());
|
||||
}
|
||||
} else {
|
||||
increment(player, chatLevel, magic.CHAT_KICK_LEVEL);
|
||||
User user = manager.getUserManager().getUser(player.getName());
|
||||
int level = chatLevel.containsKey(user.getName()) ? chatLevel.get(user.getName()) : 0;
|
||||
if (player != null && player.isOnline() && level >= magic.CHAT_ACTION_ONE_LEVEL) {
|
||||
String event = level >= magic.CHAT_ACTION_TWO_LEVEL ? manager.getConfiguration().getConfig().chatSpamActionTwo.getValue() : manager.getConfiguration().getConfig().chatSpamActionOne.getValue();
|
||||
manager.getUserManager().execute(manager.getUserManager().getUser(player.getName()), Utilities.stringToList(event), CheckType.CHAT_SPAM, lang.spamKickReason.getValue(), Utilities.stringToList(lang.spamWarning.getValue()), lang.spamBanReason.getValue());
|
||||
}
|
||||
System.out.println("Chat level: "+level);
|
||||
chatLevel.put(user.getName(), level + 1);
|
||||
}
|
||||
|
||||
public void processCommandSpammer(Player player) {
|
||||
User user = manager.getUserManager().getUser(player.getName());
|
||||
int level = commandLevel.containsKey(user.getName()) ? commandLevel.get(user.getName()) : 0;
|
||||
if (player != null && player.isOnline() && level >= magic.COMMAND_ACTION_ONE_LEVEL) {
|
||||
String event = level >= magic.COMMAND_ACTION_TWO_LEVEL ? manager.getConfiguration().getConfig().commandSpamActionTwo.getValue() : manager.getConfiguration().getConfig().commandSpamActionOne.getValue();
|
||||
manager.getUserManager().execute(manager.getUserManager().getUser(player.getName()), Utilities.stringToList(event), CheckType.COMMAND_SPAM, lang.spamKickReason.getValue(), Utilities.stringToList(lang.spamWarning.getValue()), lang.spamBanReason.getValue());
|
||||
}
|
||||
commandLevel.put(user.getName(), level + 1);
|
||||
}
|
||||
|
||||
public int increment(Player player, Map<String, Integer> map, int num) {
|
||||
|
||||
@@ -137,7 +137,7 @@ public class CheckManager {
|
||||
* @return true if the player's world is enabled
|
||||
*/
|
||||
public boolean checkInWorld(Player player) {
|
||||
return !config.getConfig().exemptedWorlds.getValue().contains(player.getWorld().getName());
|
||||
return !config.getConfig().disabledWorlds.getValue().contains(player.getWorld().getName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,8 @@ public enum CheckType {
|
||||
NO_SWING(Permission.CHECK_NOSWING),
|
||||
FAST_BREAK(Permission.CHECK_FASTBREAK),
|
||||
FAST_PLACE(Permission.CHECK_FASTPLACE),
|
||||
SPAM(Permission.CHECK_SPAM),
|
||||
CHAT_SPAM(Permission.CHECK_CHATSPAM),
|
||||
COMMAND_SPAM(Permission.CHECK_COMMANDSPAM),
|
||||
SPRINT(Permission.CHECK_SPRINT),
|
||||
SNEAK(Permission.CHECK_SNEAK),
|
||||
SPEED(Permission.CHECK_SPEED),
|
||||
|
||||
@@ -43,6 +43,8 @@ public class User {
|
||||
private int toX, toY, toZ;
|
||||
private String[] messages = new String[2];
|
||||
private Long[] messageTimes = new Long[2];
|
||||
private String[] commands = new String[2];
|
||||
private Long[] commandTimes = new Long[2];
|
||||
|
||||
private boolean isWaitingOnLevelSync;
|
||||
private Timestamp levelSyncTimestamp;
|
||||
@@ -281,11 +283,24 @@ public class User {
|
||||
* @param message Message to log
|
||||
*/
|
||||
public void addMessage(String message) {
|
||||
messages[1] = messages[0];
|
||||
messages[0] = message;
|
||||
addToSpamLog(message, messages, messageTimes);
|
||||
}
|
||||
|
||||
messageTimes[1] = messageTimes[0];
|
||||
messageTimes[0] = System.currentTimeMillis();
|
||||
/**
|
||||
* Log a player's command
|
||||
*
|
||||
* @param command Command to log
|
||||
*/
|
||||
public void addCommand(String command) {
|
||||
addToSpamLog(command, commands, commandTimes);
|
||||
}
|
||||
|
||||
private void addToSpamLog(String string, String[] messages, Long[] times) {
|
||||
messages[1] = messages[0];
|
||||
messages[0] = string;
|
||||
|
||||
times[1] = times[0];
|
||||
times[0] = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,6 +313,16 @@ public class User {
|
||||
return messages[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a stored command
|
||||
*
|
||||
* @param index Index of the command in storage
|
||||
* @return the command
|
||||
*/
|
||||
public String getCommand(int index) {
|
||||
return commands[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time a message in storage was sent
|
||||
*
|
||||
@@ -308,6 +333,16 @@ public class User {
|
||||
return messageTimes[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time a command in storage was sent
|
||||
*
|
||||
* @param index Index of the command in storage
|
||||
* @return time the command was sent
|
||||
*/
|
||||
public Long getCommandTime(int index) {
|
||||
return commandTimes[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all stored messages
|
||||
*/
|
||||
@@ -316,6 +351,14 @@ public class User {
|
||||
messageTimes = new Long[2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all stored commands
|
||||
*/
|
||||
public void clearCommands() {
|
||||
commands = new String[2];
|
||||
commandTimes = new Long[2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time the very last stored message was sent
|
||||
*
|
||||
@@ -325,6 +368,15 @@ public class User {
|
||||
return getMessageTime(0) == null ? -1 : getMessageTime(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time the very last stored command was sent
|
||||
*
|
||||
* @return the last command's time
|
||||
*/
|
||||
public Long getLastCommandTime() {
|
||||
return getCommandTime(0) == null ? -1 : getCommandTime(0);
|
||||
}
|
||||
|
||||
private List<Group> getLevels() {
|
||||
return config.getGroups().getGroups();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ public enum Permission {
|
||||
CHECK_NOSWING,
|
||||
CHECK_FASTBREAK,
|
||||
CHECK_FASTPLACE,
|
||||
CHECK_SPAM,
|
||||
CHECK_CHATSPAM,
|
||||
CHECK_COMMANDSPAM,
|
||||
CHECK_SPRINT,
|
||||
CHECK_SNEAK,
|
||||
CHECK_SPEED,
|
||||
@@ -66,6 +67,7 @@ public enum Permission {
|
||||
private static final String PERMISSION_ALL = "anticheat.*";
|
||||
|
||||
public boolean get(CommandSender cs) {
|
||||
if ((this == CHECK_CHATSPAM || this == CHECK_COMMANDSPAM) && cs.hasPermission("anticheat.check.spam")) return true;
|
||||
return cs.hasPermission(toString()) || cs.hasPermission(getBase()) || cs.hasPermission(PERMISSION_ALL);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ public class XRayListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if (config.getConfig().logXRayStats.getValue()) {
|
||||
if (config.getConfig().checkXRay.getValue()) {
|
||||
Player p = event.getPlayer();
|
||||
if (p.getGameMode() == GameMode.CREATIVE && !config.getConfig().trackCreativeXRay.getValue()) {
|
||||
if (p.getGameMode() == GameMode.CREATIVE && !config.getConfig().checkCreativeXRay.getValue()) {
|
||||
return;
|
||||
}
|
||||
String player = p.getName();
|
||||
|
||||
@@ -5,16 +5,25 @@ xray:
|
||||
check-xray: true
|
||||
# Should a warning be sent to admins when a person is found that could be xraying?
|
||||
alert: false
|
||||
# How often (in seconds) should AntiCheat check for xrayers if alert is true?
|
||||
alert-interval: 60
|
||||
# Should players in creative mode be tracked for possible xray usage?
|
||||
check-creative: true
|
||||
spam:
|
||||
# Should AntiCheat block players spamming messages in chat?
|
||||
chat: true
|
||||
chat:
|
||||
# Should AntiCheat block players spamming messages in chat?
|
||||
block-speed: true
|
||||
block-repetition: true
|
||||
# Valid actions = NONE,KICK,BAN,COMMAND[command]
|
||||
action-one: KICK
|
||||
action-two: BAN
|
||||
# Should AntiCheat block players spamming commands in chat?
|
||||
command: true
|
||||
# Valid actions = NONE,KICK,BAN,COMMAND[command]
|
||||
action-one: KICK
|
||||
action-two: BAN
|
||||
command:
|
||||
block-speed: true
|
||||
block-repetition: true
|
||||
# Valid actions = NONE,KICK,BAN,COMMAND[command]
|
||||
action-one: KICK
|
||||
action-two: BAN
|
||||
system:
|
||||
# Turning auto-update off is a _BAD_ idea. You will no longer be protected by the latest hacks/cheats if you do so, and will have to update manually.
|
||||
auto-update: true
|
||||
|
||||
@@ -2,24 +2,28 @@
|
||||
# Please report any bugs: http://dev.bukkit.org/server-mods/anticheat/
|
||||
# Documentation for these values is available at http://gravitydevelopment.net/docs/anticheat/net/h31ix/anticheat/util/Magic.html
|
||||
ANIMATION_CHECK: 5
|
||||
ASCENSION_COUNT_MAX: 8
|
||||
ANIMATION_TIMEMIN: 400
|
||||
ANIMATION_MIN: 200
|
||||
ANIMATION_TIMEMIN: 400
|
||||
ASCENSION_COUNT_MAX: 8
|
||||
BLOCK_BREAK_MIN: 0.1
|
||||
BLOCK_MAX_DISTANCE: 5.5
|
||||
BLOCK_MAX_DISTANCE_CREATIVE: 6.0
|
||||
BLOCK_PLACE_MIN: 0.1
|
||||
BLOCK_PUNCH_MIN: 5
|
||||
BOW_ERROR: 0.25
|
||||
CHAT_BAN_LEVEL: 3
|
||||
CHAT_KICK_LEVEL: 10
|
||||
CHAT_ACTION_ONE_LEVEL: 3
|
||||
CHAT_ACTION_TWO_LEVEL: 5
|
||||
CHAT_MIN: 100
|
||||
CHAT_REPEAT_MIN: 260
|
||||
CHAT_WARN_LEVEL: 7
|
||||
COMMAND_ACTION_ONE_LEVEL: 3
|
||||
COMMAND_ACTION_TWO_LEVEL: 5
|
||||
COMMAND_MIN: 100
|
||||
COMMAND_REPEAT_MIN: 260
|
||||
DAMAGE_TIME: 3000
|
||||
DROP_CHECK: 10
|
||||
DROPPED_ITEM_TIME: 100
|
||||
DROP_TIME_MIN: 800
|
||||
DROPPED_ITEM_TIME: 100
|
||||
EAT_TIME_MIN: 1000
|
||||
ENTERED_EXITED_TIME: 1000
|
||||
ENTITY_MAX_DISTANCE: 5.5
|
||||
@@ -71,8 +75,8 @@ XZ_SPEED_MAX_FLY: 0.56
|
||||
XZ_SPEED_MAX_POTION: 0.7
|
||||
XZ_SPEED_MAX_SNEAK: 0.15
|
||||
XZ_SPEED_MAX_SOULSAND: 0.13
|
||||
XZ_SPEED_MAX_SOULSAND_SPRINT: 0.2
|
||||
XZ_SPEED_MAX_SOULSAND_POTION: 0.16
|
||||
XZ_SPEED_MAX_SOULSAND_SPRINT: 0.2
|
||||
XZ_SPEED_MAX_SPRINT: 0.65
|
||||
XZ_SPEED_MAX_WATER: 0.19
|
||||
XZ_SPEED_MAX_WATER_SPRINT: 0.3
|
||||
|
||||
Reference in new issue
Block a user