mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +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
+36
-5
No files matched your search
@@ -45,6 +45,8 @@ public class Configuration
|
||||
private boolean alertXRay;
|
||||
private boolean autoUpdate;
|
||||
private boolean verboseStartup;
|
||||
private boolean chatSpam;
|
||||
private boolean commandSpam;
|
||||
private int fileLogLevel = 0;
|
||||
private String updateFolder;
|
||||
private static Language language;
|
||||
@@ -97,6 +99,16 @@ public class Configuration
|
||||
return verboseStartup;
|
||||
}
|
||||
|
||||
public boolean chatSpam()
|
||||
{
|
||||
return chatSpam;
|
||||
}
|
||||
|
||||
public boolean commandSpam()
|
||||
{
|
||||
return commandSpam;
|
||||
}
|
||||
|
||||
public String updateFolder()
|
||||
{
|
||||
return updateFolder;
|
||||
@@ -170,7 +182,19 @@ public class Configuration
|
||||
config.set("System.File log level", 1);
|
||||
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)
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
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.CheckManager;
|
||||
import net.h31ix.anticheat.manage.CheckType;
|
||||
@@ -39,13 +41,14 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
public class PlayerListener extends EventListener
|
||||
{
|
||||
private final Backend backend = getBackend();
|
||||
private final CheckManager checkManager = getCheckManager();
|
||||
private final CheckManager checkManager = getCheckManager();
|
||||
private final Configuration config = Anticheat.getManager().getConfiguration();
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(checkManager.willCheck(player, CheckType.SPAM))
|
||||
if(checkManager.willCheck(player, CheckType.SPAM) && config.commandSpam())
|
||||
{
|
||||
backend.logChat(player);
|
||||
if(backend.checkSpam(player, event.getMessage()))
|
||||
@@ -115,7 +118,7 @@ public class PlayerListener extends EventListener
|
||||
public void onPlayerChat(PlayerChatEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(checkManager.willCheck(player, CheckType.SPAM))
|
||||
if(checkManager.willCheck(player, CheckType.SPAM) && config.chatSpam())
|
||||
{
|
||||
backend.logChat(player);
|
||||
if(backend.checkSpam(player, event.getMessage()))
|
||||
|
||||
Reference in new issue
Block a user