mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Option to disable chat and command spam, fixes issue #45
This commit is contained in:
1 parent
7454edf8d6
commit
0b6339a529
3 files changed
+33
-2
No files matched your search
@@ -45,6 +45,8 @@ public class Configuration
|
|||||||
private boolean alertXRay;
|
private boolean alertXRay;
|
||||||
private boolean autoUpdate;
|
private boolean autoUpdate;
|
||||||
private boolean verboseStartup;
|
private boolean verboseStartup;
|
||||||
|
private boolean chatSpam;
|
||||||
|
private boolean commandSpam;
|
||||||
private int fileLogLevel = 0;
|
private int fileLogLevel = 0;
|
||||||
private String updateFolder;
|
private String updateFolder;
|
||||||
private static Language language;
|
private static Language language;
|
||||||
@@ -97,6 +99,16 @@ public class Configuration
|
|||||||
return verboseStartup;
|
return verboseStartup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean chatSpam()
|
||||||
|
{
|
||||||
|
return chatSpam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean commandSpam()
|
||||||
|
{
|
||||||
|
return commandSpam;
|
||||||
|
}
|
||||||
|
|
||||||
public String updateFolder()
|
public String updateFolder()
|
||||||
{
|
{
|
||||||
return updateFolder;
|
return updateFolder;
|
||||||
@@ -171,6 +183,18 @@ public class Configuration
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
fileLogLevel = config.getInt("System.File log level");
|
fileLogLevel = config.getInt("System.File log level");
|
||||||
|
if(config.getString("System.Block chat spam") == null)
|
||||||
|
{
|
||||||
|
config.set("System.Block chat spam", true);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
chatSpam = config.getBoolean("System.Block chat spam");
|
||||||
|
if(config.getString("System.Block command spam") == null)
|
||||||
|
{
|
||||||
|
config.set("System.Block command spam", true);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
commandSpam = config.getBoolean("System.Block command spam");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResult(String event)
|
public String getResult(String event)
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
package net.h31ix.anticheat.event;
|
package net.h31ix.anticheat.event;
|
||||||
|
|
||||||
|
import net.h31ix.anticheat.Anticheat;
|
||||||
|
import net.h31ix.anticheat.Configuration;
|
||||||
import net.h31ix.anticheat.manage.Backend;
|
import net.h31ix.anticheat.manage.Backend;
|
||||||
import net.h31ix.anticheat.manage.CheckManager;
|
import net.h31ix.anticheat.manage.CheckManager;
|
||||||
import net.h31ix.anticheat.manage.CheckType;
|
import net.h31ix.anticheat.manage.CheckType;
|
||||||
@@ -40,12 +42,13 @@ public class PlayerListener extends EventListener
|
|||||||
{
|
{
|
||||||
private final Backend backend = getBackend();
|
private final Backend backend = getBackend();
|
||||||
private final CheckManager checkManager = getCheckManager();
|
private final CheckManager checkManager = getCheckManager();
|
||||||
|
private final Configuration config = Anticheat.getManager().getConfiguration();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(checkManager.willCheck(player, CheckType.SPAM))
|
if(checkManager.willCheck(player, CheckType.SPAM) && config.commandSpam())
|
||||||
{
|
{
|
||||||
backend.logChat(player);
|
backend.logChat(player);
|
||||||
if(backend.checkSpam(player, event.getMessage()))
|
if(backend.checkSpam(player, event.getMessage()))
|
||||||
@@ -115,7 +118,7 @@ public class PlayerListener extends EventListener
|
|||||||
public void onPlayerChat(PlayerChatEvent event)
|
public void onPlayerChat(PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(checkManager.willCheck(player, CheckType.SPAM))
|
if(checkManager.willCheck(player, CheckType.SPAM) && config.chatSpam())
|
||||||
{
|
{
|
||||||
backend.logChat(player);
|
backend.logChat(player);
|
||||||
if(backend.checkSpam(player, event.getMessage()))
|
if(backend.checkSpam(player, event.getMessage()))
|
||||||
|
|||||||
@@ -20,3 +20,7 @@ System:
|
|||||||
#0 = off, 1 = log when an event takes place, 2 = more detailed logs, 3 = most detailed logs
|
#0 = off, 1 = log when an event takes place, 2 = more detailed logs, 3 = most detailed logs
|
||||||
File log level: 1
|
File log level: 1
|
||||||
Verbose startup: false
|
Verbose startup: false
|
||||||
|
#Should AntiCheat block when players spam messages in chat?
|
||||||
|
Block chat spam: true
|
||||||
|
#Should AntiCheat block when players spam commands in chat?
|
||||||
|
Block command spam: true
|
||||||
Reference in new issue
Block a user