mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-02 08:40:01 +01:00
differentiate commands/chat, modified defaults
This commit is contained in:
parent
c83bbd999b
commit
22a82b8beb
@ -17,6 +17,7 @@ public class ChatConfig implements ConfigItem {
|
|||||||
public final ActionList spamActions;
|
public final ActionList spamActions;
|
||||||
public final boolean colorCheck;
|
public final boolean colorCheck;
|
||||||
public final ActionList colorActions;
|
public final ActionList colorActions;
|
||||||
|
public final int commandLimit;
|
||||||
|
|
||||||
public ChatConfig(NoCheatConfiguration data) {
|
public ChatConfig(NoCheatConfiguration data) {
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ public class ChatConfig implements ConfigItem {
|
|||||||
spamWhitelist = splitWhitelist(data.getString(ConfPaths.CHAT_SPAM_WHITELIST));
|
spamWhitelist = splitWhitelist(data.getString(ConfPaths.CHAT_SPAM_WHITELIST));
|
||||||
spamTimeframe = data.getInt(ConfPaths.CHAT_SPAM_TIMEFRAME);
|
spamTimeframe = data.getInt(ConfPaths.CHAT_SPAM_TIMEFRAME);
|
||||||
spamLimit = data.getInt(ConfPaths.CHAT_SPAM_LIMIT);
|
spamLimit = data.getInt(ConfPaths.CHAT_SPAM_LIMIT);
|
||||||
|
commandLimit = data.getInt(ConfPaths.CHAT_SPAM_COMMANDLIMIT);
|
||||||
spamActions = data.getActionList(ConfPaths.CHAT_SPAM_ACTIONS);
|
spamActions = data.getActionList(ConfPaths.CHAT_SPAM_ACTIONS);
|
||||||
colorCheck = data.getBoolean(ConfPaths.CHAT_COLOR_CHECK);
|
colorCheck = data.getBoolean(ConfPaths.CHAT_COLOR_CHECK);
|
||||||
colorActions = data.getActionList(ConfPaths.CHAT_COLOR_ACTIONS);
|
colorActions = data.getActionList(ConfPaths.CHAT_COLOR_ACTIONS);
|
||||||
|
@ -16,6 +16,7 @@ public class ChatData implements DataItem {
|
|||||||
public int colorFailed;
|
public int colorFailed;
|
||||||
|
|
||||||
public int messageCount = 0;
|
public int messageCount = 0;
|
||||||
|
public int commandCount = 0;
|
||||||
public long spamLastTime = 0;
|
public long spamLastTime = 0;
|
||||||
public String message = "";
|
public String message = "";
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package cc.co.evenprime.bukkit.nocheat.checks.chat;
|
package cc.co.evenprime.bukkit.nocheat.checks.chat;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import cc.co.evenprime.bukkit.nocheat.NoCheat;
|
import cc.co.evenprime.bukkit.nocheat.NoCheat;
|
||||||
import cc.co.evenprime.bukkit.nocheat.NoCheatPlayer;
|
import cc.co.evenprime.bukkit.nocheat.NoCheatPlayer;
|
||||||
import cc.co.evenprime.bukkit.nocheat.actions.ParameterName;
|
import cc.co.evenprime.bukkit.nocheat.actions.ParameterName;
|
||||||
@ -29,17 +28,22 @@ public class SpamCheck extends ChatCheck {
|
|||||||
if(data.spamLastTime + cc.spamTimeframe <= time) {
|
if(data.spamLastTime + cc.spamTimeframe <= time) {
|
||||||
data.spamLastTime = time;
|
data.spamLastTime = time;
|
||||||
data.messageCount = 0;
|
data.messageCount = 0;
|
||||||
|
data.commandCount = 0;
|
||||||
}
|
}
|
||||||
// Security check, if the system time changes
|
// Security check, if the system time changes
|
||||||
else if(data.spamLastTime > time) {
|
else if(data.spamLastTime > time) {
|
||||||
data.spamLastTime = Integer.MIN_VALUE;
|
data.spamLastTime = Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(data.message.startsWith("/"))
|
||||||
|
data.commandCount++;
|
||||||
|
else
|
||||||
data.messageCount++;
|
data.messageCount++;
|
||||||
|
|
||||||
if(data.messageCount > cc.spamLimit) {
|
if(data.messageCount > cc.spamLimit || data.commandCount > cc.commandLimit) {
|
||||||
|
|
||||||
data.spamVL = data.messageCount - cc.spamLimit;
|
data.spamVL = Math.max(0, data.messageCount - cc.spamLimit);
|
||||||
|
data.spamVL += Math.max(0, data.commandCount - cc.commandLimit);
|
||||||
data.spamTotalVL++;
|
data.spamTotalVL++;
|
||||||
data.spamFailed++;
|
data.spamFailed++;
|
||||||
|
|
||||||
|
@ -82,7 +82,8 @@ public abstract class ConfPaths {
|
|||||||
public final static String CHAT_SPAM_CHECK = CHAT_SPAM + "active";
|
public final static String CHAT_SPAM_CHECK = CHAT_SPAM + "active";
|
||||||
public final static String CHAT_SPAM_WHITELIST = CHAT_SPAM + "whitelist";
|
public final static String CHAT_SPAM_WHITELIST = CHAT_SPAM + "whitelist";
|
||||||
public final static String CHAT_SPAM_TIMEFRAME = CHAT_SPAM + "timeframe";
|
public final static String CHAT_SPAM_TIMEFRAME = CHAT_SPAM + "timeframe";
|
||||||
public final static String CHAT_SPAM_LIMIT = CHAT_SPAM + "limit";
|
public final static String CHAT_SPAM_LIMIT = CHAT_SPAM + "messagelimit";
|
||||||
|
public final static String CHAT_SPAM_COMMANDLIMIT = CHAT_SPAM + "commandlimit";
|
||||||
public final static String CHAT_SPAM_ACTIONS = CHAT_SPAM + "actions";
|
public final static String CHAT_SPAM_ACTIONS = CHAT_SPAM + "actions";
|
||||||
|
|
||||||
private final static String FIGHT = CHECKS + "fight.";
|
private final static String FIGHT = CHECKS + "fight.";
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cc.co.evenprime.bukkit.nocheat.config;
|
package cc.co.evenprime.bukkit.nocheat.config;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These are the default settings for NoCheat. They will be used
|
* These are the default settings for NoCheat. They will be used
|
||||||
* in addition to/in replacement of configurations given in the
|
* in addition to/in replacement of configurations given in the
|
||||||
@ -54,37 +53,38 @@ public class DefaultConfiguration extends NoCheatConfiguration {
|
|||||||
set(ConfPaths.BLOCKBREAK_DIRECTION_CHECK, true);
|
set(ConfPaths.BLOCKBREAK_DIRECTION_CHECK, true);
|
||||||
set(ConfPaths.BLOCKBREAK_DIRECTION_PRECISION, 50);
|
set(ConfPaths.BLOCKBREAK_DIRECTION_PRECISION, 50);
|
||||||
set(ConfPaths.BLOCKBREAK_DIRECTION_PENALTYTIME, 300);
|
set(ConfPaths.BLOCKBREAK_DIRECTION_PENALTYTIME, 300);
|
||||||
set(ConfPaths.BLOCKBREAK_DIRECTION_ACTIONS, "cancel vl>10 log:bbdirection:0:5:cif cancel");
|
set(ConfPaths.BLOCKBREAK_DIRECTION_ACTIONS, "cancel vl>10 log:bbdirection:0:5:if cancel");
|
||||||
|
|
||||||
set(ConfPaths.BLOCKBREAK_NOSWING_CHECK, true);
|
set(ConfPaths.BLOCKBREAK_NOSWING_CHECK, true);
|
||||||
set(ConfPaths.BLOCKBREAK_NOSWING_ACTIONS, "log:bbnoswing:0:2:cif cancel");
|
set(ConfPaths.BLOCKBREAK_NOSWING_ACTIONS, "log:bbnoswing:0:2:if cancel");
|
||||||
|
|
||||||
/*** BLOCKPLACE ***/
|
/*** BLOCKPLACE ***/
|
||||||
|
|
||||||
set(ConfPaths.BLOCKPLACE_REACH_CHECK, true);
|
set(ConfPaths.BLOCKPLACE_REACH_CHECK, true);
|
||||||
set(ConfPaths.BLOCKPLACE_REACH_ACTIONS, "cancel vl>5 log:bpreach:0:2:cif cancel");
|
set(ConfPaths.BLOCKPLACE_REACH_ACTIONS, "cancel vl>5 log:bpreach:0:2:if cancel");
|
||||||
|
|
||||||
set(ConfPaths.BLOCKPLACE_DIRECTION_CHECK, true);
|
set(ConfPaths.BLOCKPLACE_DIRECTION_CHECK, true);
|
||||||
set(ConfPaths.BLOCKPLACE_DIRECTION_PRECISION, 75);
|
set(ConfPaths.BLOCKPLACE_DIRECTION_PRECISION, 75);
|
||||||
set(ConfPaths.BLOCKPLACE_DIRECTION_PENALTYTIME, 100);
|
set(ConfPaths.BLOCKPLACE_DIRECTION_PENALTYTIME, 100);
|
||||||
set(ConfPaths.BLOCKPLACE_DIRECTION_ACTIONS, "cancel vl>10 log:bpdirection:0:3:cif cancel");
|
set(ConfPaths.BLOCKPLACE_DIRECTION_ACTIONS, "cancel vl>10 log:bpdirection:0:3:if cancel");
|
||||||
|
|
||||||
/*** CHAT ***/
|
/*** CHAT ***/
|
||||||
set(ConfPaths.CHAT_COLOR_CHECK, true);
|
set(ConfPaths.CHAT_COLOR_CHECK, true);
|
||||||
set(ConfPaths.CHAT_COLOR_ACTIONS, "log:color:0:1:cif cancel");
|
set(ConfPaths.CHAT_COLOR_ACTIONS, "log:color:0:1:if cancel");
|
||||||
|
|
||||||
set(ConfPaths.CHAT_SPAM_CHECK, true);
|
set(ConfPaths.CHAT_SPAM_CHECK, true);
|
||||||
set(ConfPaths.CHAT_SPAM_WHITELIST, "");
|
set(ConfPaths.CHAT_SPAM_WHITELIST, "");
|
||||||
set(ConfPaths.CHAT_SPAM_TIMEFRAME, 5);
|
set(ConfPaths.CHAT_SPAM_TIMEFRAME, 3);
|
||||||
set(ConfPaths.CHAT_SPAM_LIMIT, 5);
|
set(ConfPaths.CHAT_SPAM_LIMIT, 3);
|
||||||
set(ConfPaths.CHAT_SPAM_ACTIONS, "log:spam:0:5:cif cancel vl>50 log:spam:0:5:cif cancel cmd:kick");
|
set(ConfPaths.CHAT_SPAM_COMMANDLIMIT, 12);
|
||||||
|
set(ConfPaths.CHAT_SPAM_ACTIONS, "log:spam:0:3:if cancel vl>30 log:spam:0:3:cif cancel cmd:kick");
|
||||||
|
|
||||||
/*** FIGHT ***/
|
/*** FIGHT ***/
|
||||||
|
|
||||||
set(ConfPaths.FIGHT_DIRECTION_CHECK, true);
|
set(ConfPaths.FIGHT_DIRECTION_CHECK, true);
|
||||||
set(ConfPaths.FIGHT_DIRECTION_PRECISION, 75);
|
set(ConfPaths.FIGHT_DIRECTION_PRECISION, 75);
|
||||||
set(ConfPaths.FIGHT_DIRECTION_PENALTYTIME, 500);
|
set(ConfPaths.FIGHT_DIRECTION_PENALTYTIME, 500);
|
||||||
set(ConfPaths.FIGHT_DIRECTION_ACTIONS, "cancel vl>5 log:fdirection:3:5:f cancel vl>20 log:fdirection:0:5:cf cancel vl>50 log:fdirection:0:5:cif cancel");
|
set(ConfPaths.FIGHT_DIRECTION_ACTIONS, "cancel vl>5 log:fdirection:3:5:f cancel vl>20 log:fdirection:0:5:if cancel vl>50 log:fdirection:0:5:cif cancel");
|
||||||
|
|
||||||
set(ConfPaths.FIGHT_NOSWING_CHECK, true);
|
set(ConfPaths.FIGHT_NOSWING_CHECK, true);
|
||||||
set(ConfPaths.FIGHT_NOSWING_ACTIONS, "log:fnoswing:0:5:cif cancel");
|
set(ConfPaths.FIGHT_NOSWING_ACTIONS, "log:fnoswing:0:5:cif cancel");
|
||||||
|
Loading…
Reference in New Issue
Block a user