mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Fixed logging
This commit is contained in:
1 parent
98cf43a0fc
commit
4ef2534114
6 files changed
+13
-55
No files matched your search
@@ -23,6 +23,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.h31ix.anticheat.event.*;
|
||||
import net.h31ix.anticheat.manage.AnticheatManager;
|
||||
import net.h31ix.anticheat.manage.CheckType;
|
||||
|
||||
@@ -65,6 +65,7 @@ public class PlayerListener extends EventListener
|
||||
@EventHandler
|
||||
public void onPlayerToggleFlight(PlayerToggleFlightEvent event)
|
||||
{
|
||||
log("wtf'ed", event.getPlayer(), CheckType.FLY);
|
||||
if(!event.isFlying())
|
||||
{
|
||||
backend.logEnterExit(event.getPlayer());
|
||||
|
||||
@@ -45,8 +45,7 @@ public class AnticheatManager
|
||||
private UserManager userManager = null;
|
||||
private CheckManager checkManager = null;
|
||||
private Backend backend = null;
|
||||
private Logger logger;
|
||||
private Logger fileLogger;
|
||||
private final Logger fileLogger;
|
||||
private static List<String> logs = new CopyOnWriteArrayList<String>();
|
||||
private static Handler fileHandler;
|
||||
private static final int LOG_LEVEL_HIGH = 3;
|
||||
@@ -55,8 +54,7 @@ public class AnticheatManager
|
||||
{
|
||||
plugin = instance;
|
||||
// now load all the others!!!!!
|
||||
this.logger = logger;
|
||||
this.fileLogger = Logger.getLogger("net.h31ix.anticheat.Anticheat");
|
||||
fileLogger = Logger.getLogger("net.h31ix.anticheat.Anticheat");
|
||||
configuration = new Configuration(this);
|
||||
xrayTracker = new XRayTracker();
|
||||
userManager = new UserManager(configuration);
|
||||
@@ -84,7 +82,7 @@ public class AnticheatManager
|
||||
{
|
||||
if (getConfiguration().logConsole())
|
||||
{
|
||||
Bukkit.getConsoleSender().sendMessage(message);
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.RED+message);
|
||||
}
|
||||
if (getConfiguration().getFileLogLevel() == LOG_LEVEL_HIGH)
|
||||
{
|
||||
@@ -95,15 +93,18 @@ public class AnticheatManager
|
||||
|
||||
public void fileLog(String message)
|
||||
{
|
||||
logger.info(message);
|
||||
fileLogger.info(message);
|
||||
}
|
||||
|
||||
public List<String> getLastLogs()
|
||||
{
|
||||
List<String> log = new CopyOnWriteArrayList<String>();
|
||||
if (logs.size() < 30)
|
||||
{
|
||||
return logs;
|
||||
for(int i = 1; i < 31; i++) {
|
||||
}
|
||||
for(int i = 1; i < 31; i++)
|
||||
{
|
||||
log.add(logs.get(logs.size() - i));
|
||||
}
|
||||
logs.clear();
|
||||
|
||||
@@ -73,7 +73,7 @@ public class User
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,21 +26,13 @@ import java.util.logging.LogRecord;
|
||||
|
||||
public class FileFormatter extends Formatter
|
||||
{
|
||||
|
||||
private static final DateFormat format = new SimpleDateFormat("h:mm:ss");
|
||||
private static final String lineSep = System.getProperty("line.separator");
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
if (record.getMessage().startsWith("[AntiCheat]"))
|
||||
{
|
||||
StringBuilder output = new StringBuilder().append("[").append(record.getLevel()).append('|').append(format.format(new Date(record.getMillis()))).append("]: ").append(record.getMessage()).append(' ').append(lineSep);
|
||||
return output.toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
StringBuilder output = new StringBuilder().append("[").append(record.getLevel()).append('|').append(format.format(new Date(record.getMillis()))).append("]: ").append(record.getMessage()).append(' ').append(lineSep);
|
||||
return output.toString();
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@
|
||||
package net.h31ix.anticheat.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import net.h31ix.anticheat.Anticheat;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -33,7 +32,6 @@ public final class Utilities
|
||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||
private static final List<Material> INTERACTABLE = new ArrayList<Material>();
|
||||
private static final HashSet<Byte> NOTSOLID = new HashSet<Byte>();
|
||||
|
||||
public static void alert(List<String> message)
|
||||
{
|
||||
@@ -91,11 +89,6 @@ public final class Utilities
|
||||
return INTERACTABLE.contains(m);
|
||||
}
|
||||
|
||||
public static HashSet<Byte> getNonSolid()
|
||||
{
|
||||
return NOTSOLID;
|
||||
}
|
||||
|
||||
public static boolean sprintFly(Player player)
|
||||
{
|
||||
return player.isSprinting() || player.isFlying();
|
||||
@@ -168,36 +161,6 @@ public final class Utilities
|
||||
INTERACTABLE.add(Material.STONE_BUTTON);
|
||||
INTERACTABLE.add(Material.LEVER);
|
||||
INTERACTABLE.add(Material.CHEST);
|
||||
NOTSOLID.add((byte) Material.TORCH.getId());
|
||||
NOTSOLID.add((byte) Material.REDSTONE_TORCH_OFF.getId());
|
||||
NOTSOLID.add((byte) Material.REDSTONE_TORCH_OFF.getId());
|
||||
NOTSOLID.add((byte) Material.FENCE.getId());
|
||||
NOTSOLID.add((byte) Material.FENCE_GATE.getId());
|
||||
NOTSOLID.add((byte) Material.IRON_FENCE.getId());
|
||||
NOTSOLID.add((byte) Material.NETHER_FENCE.getId());
|
||||
NOTSOLID.add((byte) Material.TRAP_DOOR.getId());
|
||||
NOTSOLID.add((byte) Material.SIGN.getId());
|
||||
NOTSOLID.add((byte) Material.STONE_BUTTON.getId());
|
||||
NOTSOLID.add((byte) Material.LEVER.getId());
|
||||
NOTSOLID.add((byte) Material.AIR.getId());
|
||||
NOTSOLID.add((byte) Material.WATER.getId());
|
||||
NOTSOLID.add((byte) Material.LAVA.getId());
|
||||
NOTSOLID.add((byte) Material.REDSTONE_WIRE.getId());
|
||||
NOTSOLID.add((byte) Material.WOOD_PLATE.getId());
|
||||
NOTSOLID.add((byte) Material.STONE_PLATE.getId());
|
||||
NOTSOLID.add((byte) Material.SAPLING.getId());
|
||||
NOTSOLID.add((byte) Material.RED_ROSE.getId());
|
||||
NOTSOLID.add((byte) Material.YELLOW_FLOWER.getId());
|
||||
NOTSOLID.add((byte) Material.BROWN_MUSHROOM.getId());
|
||||
NOTSOLID.add((byte) Material.RED_MUSHROOM.getId());
|
||||
NOTSOLID.add((byte) Material.THIN_GLASS.getId());
|
||||
NOTSOLID.add((byte) Material.LADDER.getId());
|
||||
NOTSOLID.add((byte) Material.RAILS.getId());
|
||||
NOTSOLID.add((byte) Material.DETECTOR_RAIL.getId());
|
||||
NOTSOLID.add((byte) Material.POWERED_RAIL.getId());
|
||||
NOTSOLID.add((byte) Material.STEP.getId());
|
||||
NOTSOLID.add((byte) Material.VINE.getId());
|
||||
NOTSOLID.add((byte) Material.ENCHANTMENT_TABLE.getId());
|
||||
FOOD.add(Material.COOKED_BEEF);
|
||||
FOOD.add(Material.COOKED_CHICKEN);
|
||||
FOOD.add(Material.COOKED_FISH);
|
||||
|
||||
Reference in new issue
Block a user