Add fine info to spam check

This commit is contained in:
gravitylow committed 2014-01-20 15:45:03 -05:00
1 parent 14aa2a8905
commit b735a37663
4 files changed
+12 -4

No files matched your search

@@ -766,8 +766,10 @@ public class Backend {
break; break;
} else { } else {
if (manager.getConfiguration().getConfig().blockChatSpamRepetition.getValue() && m.equalsIgnoreCase(msg) && i == 1) { if (manager.getConfiguration().getConfig().blockChatSpamRepetition.getValue() && m.equalsIgnoreCase(msg) && i == 1) {
manager.getLoggingManager().logFineInfo(player.getName() + " spam-repeated \"" + msg + "\"");
return new CheckResult(CheckResult.Result.FAILED, lang.spamWarning.getValue()); return new CheckResult(CheckResult.Result.FAILED, lang.spamWarning.getValue());
} else if (manager.getConfiguration().getConfig().blockChatSpamSpeed.getValue() && System.currentTimeMillis() - user.getLastCommandTime() < magic.COMMAND_MIN * 2) { } else if (manager.getConfiguration().getConfig().blockChatSpamSpeed.getValue() && System.currentTimeMillis() - user.getLastCommandTime() < magic.COMMAND_MIN * 2) {
manager.getLoggingManager().logFineInfo(player.getName() + " spammed quickly \"" + msg + "\"");
return new CheckResult(CheckResult.Result.FAILED, lang.spamWarning.getValue()); return new CheckResult(CheckResult.Result.FAILED, lang.spamWarning.getValue());
} }
} }
@@ -33,6 +33,7 @@ public class CommandHelp extends CommandBase {
GRAY + "/anti " + AQUA + "reload", GRAY + "/anti " + AQUA + "reload",
GRAY + "/anti " + AQUA + "update", GRAY + "/anti " + AQUA + "update",
GRAY + "/anti " + AQUA + "debug " + AQUA + "<user>", GRAY + "/anti " + AQUA + "debug " + AQUA + "<user>",
GRAY + "/anti " + AQUA + "check " + GOLD + "[check] [on/off]",
GRAY + "/anti " + AQUA + "log " + GOLD + "[file/console] [on/off]", GRAY + "/anti " + AQUA + "log " + GOLD + "[file/console] [on/off]",
GRAY + "/anti " + AQUA + "report " + GOLD + "[group/user]", GRAY + "/anti " + AQUA + "report " + GOLD + "[group/user]",
GRAY + "/anti " + AQUA + "reload", GRAY + "/anti " + AQUA + "reload",
@@ -54,7 +54,7 @@ public class CheckManager {
*/ */
public void activateCheck(CheckType type, String className) { public void activateCheck(CheckType type, String className) {
if (!isActive(type)) { if (!isActive(type)) {
manager.getLoggingManager().logToFile("The " + type.toString() + " check was activated by " + className + "."); manager.getLoggingManager().logFineInfo("The " + type.toString() + " check was activated by " + className + ".");
checkIgnoreList.remove(type); checkIgnoreList.remove(type);
} }
} }
@@ -66,7 +66,7 @@ public class CheckManager {
*/ */
public void deactivateCheck(CheckType type, String className) { public void deactivateCheck(CheckType type, String className) {
if (isActive(type)) { if (isActive(type)) {
manager.getLoggingManager().logToFile("The " + type.toString() + " check was deactivated by " + className + "."); manager.getLoggingManager().logFineInfo("The " + type.toString() + " check was deactivated by " + className + ".");
checkIgnoreList.add(type); checkIgnoreList.add(type);
disabled++; disabled++;
} }
@@ -93,7 +93,7 @@ public class CheckManager {
if (!exemptList.containsKey(player.getName())) { if (!exemptList.containsKey(player.getName())) {
exemptList.put(player.getName(), new ArrayList<CheckType>()); exemptList.put(player.getName(), new ArrayList<CheckType>());
} }
manager.getLoggingManager().logToFile(player.getName() + " was exempted from the " + type.toString() + " check by " + className + "."); manager.getLoggingManager().logFineInfo(player.getName() + " was exempted from the " + type.toString() + " check by " + className + ".");
exemptList.get(player.getName()).add(type); exemptList.get(player.getName()).add(type);
exempt++; exempt++;
} }
@@ -107,7 +107,7 @@ public class CheckManager {
*/ */
public void unexemptPlayer(Player player, CheckType type, String className) { public void unexemptPlayer(Player player, CheckType type, String className) {
if (isExempt(player, type)) { if (isExempt(player, type)) {
manager.getLoggingManager().logToFile(player.getName() + " was unexempted from the " + type.toString() + " check by " + className + "."); manager.getLoggingManager().logFineInfo(player.getName() + " was unexempted from the " + type.toString() + " check by " + className + ".");
exemptList.get(player.getName()).remove(type); exemptList.get(player.getName()).remove(type);
} }
} }
@@ -81,6 +81,11 @@ public class LoggingManager {
fileLogger.info(message); fileLogger.info(message);
} }
public void logFineInfo(String message) {
logToFile(message);
logToLogs(message);
}
public void logToPlayers(String message) { public void logToPlayers(String message) {
for(Player player : Bukkit.getOnlinePlayers()) { for(Player player : Bukkit.getOnlinePlayers()) {
if (Permission.SYSTEM_NOTICE.get(player)) { if (Permission.SYSTEM_NOTICE.get(player)) {