Server flag to log autobans (#296)

This commit is contained in:
MedicOP
2019-01-02 22:22:00 +01:00
committed by Ronan Lana
parent fc935d5f87
commit ee40626c7d
3 changed files with 25 additions and 21 deletions

View File

@@ -80,19 +80,19 @@ public enum AutobanFactory {
} }
public void addPoint(AutobanManager ban, String reason) { public void addPoint(AutobanManager ban, String reason) {
if(ServerConstants.USE_AUTOBAN == true) {
ban.addPoint(this, reason); ban.addPoint(this, reason);
} }
}
public void alert(MapleCharacter chr, String reason) { public void alert(MapleCharacter chr, String reason) {
if(ServerConstants.USE_AUTOBAN == true) { if(ServerConstants.USE_AUTOBAN == true) {
FilePrinter.printError("autobanwarning.txt", (chr != null ? MapleCharacter.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason + "\r\n");
if (chr != null && MapleLogger.ignored.contains(chr.getName())){ if (chr != null && MapleLogger.ignored.contains(chr.getName())){
return; return;
} }
Server.getInstance().broadcastGMMessage((chr != null ? chr.getWorld() : 0), MaplePacketCreator.sendYellowTip((chr != null ? MapleCharacter.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason)); Server.getInstance().broadcastGMMessage((chr != null ? chr.getWorld() : 0), MaplePacketCreator.sendYellowTip((chr != null ? MapleCharacter.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason));
} }
if (ServerConstants.USE_AUTOBAN_LOG) {
FilePrinter.printError("autobanwarning.txt", (chr != null ? MapleCharacter.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason + "\r\n");
}
} }
public void autoban(MapleCharacter chr, String value) { public void autoban(MapleCharacter chr, String value) {

View File

@@ -36,6 +36,7 @@ public class AutobanManager {
if (chr.isGM() || chr.isBanned()){ if (chr.isGM() || chr.isBanned()){
return; return;
} }
if (ServerConstants.USE_AUTOBAN) {
if (lastTime.containsKey(fac)) { if (lastTime.containsKey(fac)) {
if (lastTime.get(fac) < (Server.getInstance().getCurrentTime() - fac.getExpire())) { if (lastTime.get(fac) < (Server.getInstance().getCurrentTime() - fac.getExpire())) {
points.put(fac, points.get(fac) / 2); //So the points are not completely gone. points.put(fac, points.get(fac) / 2); //So the points are not completely gone.
@@ -54,10 +55,12 @@ public class AutobanManager {
//chr.autoban("Autobanned for " + fac.name() + " ;" + reason, 1); //chr.autoban("Autobanned for " + fac.name() + " ;" + reason, 1);
//chr.sendPolice("You have been blocked by #bMooplePolice for the HACK reason#k."); //chr.sendPolice("You have been blocked by #bMooplePolice for the HACK reason#k.");
} }
}
if (ServerConstants.USE_AUTOBAN_LOG) {
// Lets log every single point too. // Lets log every single point too.
FilePrinter.printError("autobanwarning.txt", MapleCharacter.makeMapleReadable(chr.getName()) + " caused " + fac.name() + " " + reason + "\r\n"); FilePrinter.printError("autobanwarning.txt", MapleCharacter.makeMapleReadable(chr.getName()) + " caused " + fac.name() + " " + reason + "\r\n");
} }
}
public void addMiss() { public void addMiss() {
this.misses++; this.misses++;

View File

@@ -78,6 +78,7 @@ public class ServerConstants {
public static final boolean USE_PARTY_FOR_STARTERS = true; //Players level 10 or below can create/invite other players on the given level range. public static final boolean USE_PARTY_FOR_STARTERS = true; //Players level 10 or below can create/invite other players on the given level range.
public static final boolean USE_AUTOASSIGN_STARTERS_AP = false; //Beginners level 10 or below have their AP autoassigned (they can't choose to levelup a stat). Set true if the localhost doesn't support AP assigning for beginners level 10 or below. public static final boolean USE_AUTOASSIGN_STARTERS_AP = false; //Beginners level 10 or below have their AP autoassigned (they can't choose to levelup a stat). Set true if the localhost doesn't support AP assigning for beginners level 10 or below.
public static final boolean USE_AUTOBAN = false; //Commands the server to detect infractors automatically. public static final boolean USE_AUTOBAN = false; //Commands the server to detect infractors automatically.
public static final boolean USE_AUTOBAN_LOG = true; //Log autoban related messages. Still logs even with USE_AUTOBAN disabled.
public static final boolean USE_AUTOSAVE = true; //Enables server autosaving feature (saves characters to DB each 1 hour). public static final boolean USE_AUTOSAVE = true; //Enables server autosaving feature (saves characters to DB each 1 hour).
public static final boolean USE_SERVER_AUTOASSIGNER = true; //HeavenMS-builtin autoassigner, uses algorithm based on distributing AP accordingly with required secondary stat on equipments. public static final boolean USE_SERVER_AUTOASSIGNER = true; //HeavenMS-builtin autoassigner, uses algorithm based on distributing AP accordingly with required secondary stat on equipments.
public static final boolean USE_REFRESH_RANK_MOVE = true; public static final boolean USE_REFRESH_RANK_MOVE = true;