Migrate another batch of FilePrinter users to slf4j.Logger

Another FilePrinter method removed.
This commit is contained in:
P0nk
2022-02-08 21:00:51 +01:00
parent 53465bba25
commit 0c60606b4e
15 changed files with 97 additions and 120 deletions

View File

@@ -25,7 +25,8 @@ package client.autoban;
import client.Character;
import config.YamlConfig;
import net.server.Server;
import tools.FilePrinter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tools.PacketCreator;
import java.util.Collection;
@@ -59,6 +60,7 @@ public enum AutobanFactory {
FAST_ATTACK(10, SECONDS.toMillis(30)),
MPCON(25, SECONDS.toMillis(30));
private static final Logger log = LoggerFactory.getLogger(AutobanFactory.class);
private static final Set<Integer> ignoredChrIds = new HashSet<>();
private final int points;
@@ -98,7 +100,8 @@ public enum AutobanFactory {
Server.getInstance().broadcastGMMessage((chr != null ? chr.getWorld() : 0), PacketCreator.sendYellowTip((chr != null ? Character.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason));
}
if (YamlConfig.config.server.USE_AUTOBAN_LOG) {
FilePrinter.print(FilePrinter.AUTOBAN_WARNING, (chr != null ? Character.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason);
final String chrName = chr != null ? Character.makeMapleReadable(chr.getName()) : "";
log.info("Autoban alert - chr {} caused {}-{}", chrName, this.name(), reason);
}
}

View File

@@ -8,7 +8,8 @@ package client.autoban;
import client.Character;
import config.YamlConfig;
import net.server.Server;
import tools.FilePrinter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
@@ -17,6 +18,8 @@ import java.util.Map;
* @author kevintjuh93
*/
public class AutobanManager {
private static final Logger log = LoggerFactory.getLogger(AutobanManager.class);
private final Character chr;
private final Map<AutobanFactory, Integer> points = new HashMap<>();
private final Map<AutobanFactory, Long> lastTime = new HashMap<>();
@@ -59,7 +62,7 @@ public class AutobanManager {
}
if (YamlConfig.config.server.USE_AUTOBAN_LOG) {
// Lets log every single point too.
FilePrinter.print(FilePrinter.AUTOBAN_WARNING, Character.makeMapleReadable(chr.getName()) + " caused " + fac.name() + " " + reason);
log.info("Autoban - chr {} caused {} {}", Character.makeMapleReadable(chr.getName()), fac.name(), reason);
}
}
@@ -119,7 +122,7 @@ public class AutobanManager {
chr.getClient().disconnect(false, false);
}
FilePrinter.print(FilePrinter.EXPLOITS, "Player " + chr + " was caught spamming TYPE " + type + " and has been disconnected.");
log.info("Autoban - Chr {} was caught spamming TYPE {} and has been disconnected", chr, type);
}
} else {
this.timestamp[type] = time;