mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
Any warnings are now logged to files stored in /log
This commit is contained in:
1 parent
189ba31abe
commit
be4bd0cdcc
2 files changed
+29
-4
No files matched your search
@@ -36,11 +36,8 @@ public class EventListener implements Listener
|
|||||||
private static final PlayerManager PLAYER_MANAGER = Anticheat.getManager().getPlayerManager();
|
private static final PlayerManager PLAYER_MANAGER = Anticheat.getManager().getPlayerManager();
|
||||||
|
|
||||||
public void log(String message,Player player, CheckType type)
|
public void log(String message,Player player, CheckType type)
|
||||||
{
|
|
||||||
if(Anticheat.getManager().getConfiguration().logConsole())
|
|
||||||
{
|
{
|
||||||
Anticheat.getManager().log(player.getName()+" "+message);
|
Anticheat.getManager().log(player.getName()+" "+message);
|
||||||
}
|
|
||||||
PLAYER_MANAGER.increaseLevel(player);
|
PLAYER_MANAGER.increaseLevel(player);
|
||||||
removeDecrease(player);
|
removeDecrease(player);
|
||||||
logCheat(type);
|
logCheat(type);
|
||||||
|
|||||||
@@ -18,9 +18,14 @@
|
|||||||
|
|
||||||
package net.h31ix.anticheat.manage;
|
package net.h31ix.anticheat.manage;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.FileHandler;
|
||||||
|
import java.util.logging.Handler;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import java.util.logging.SimpleFormatter;
|
||||||
import net.h31ix.anticheat.Anticheat;
|
import net.h31ix.anticheat.Anticheat;
|
||||||
import net.h31ix.anticheat.Configuration;
|
import net.h31ix.anticheat.Configuration;
|
||||||
import net.h31ix.anticheat.xray.XRayTracker;
|
import net.h31ix.anticheat.xray.XRayTracker;
|
||||||
@@ -38,7 +43,9 @@ public class AnticheatManager
|
|||||||
private PlayerManager PLAYER_MANAGER = null;
|
private PlayerManager PLAYER_MANAGER = null;
|
||||||
private CheckManager CHECK_MANAGER = null;
|
private CheckManager CHECK_MANAGER = null;
|
||||||
private Backend BACKEND = null;
|
private Backend BACKEND = null;
|
||||||
private Logger LOGGER = null;
|
private static Logger LOGGER = null;
|
||||||
|
private static Logger FILE_LOGGER = null;
|
||||||
|
private static Handler HANDLER;
|
||||||
|
|
||||||
public AnticheatManager(Anticheat instance)
|
public AnticheatManager(Anticheat instance)
|
||||||
{
|
{
|
||||||
@@ -50,12 +57,33 @@ public class AnticheatManager
|
|||||||
CHECK_MANAGER = new CheckManager(this);
|
CHECK_MANAGER = new CheckManager(this);
|
||||||
BACKEND = new Backend(this);
|
BACKEND = new Backend(this);
|
||||||
LOGGER = Logger.getLogger("Minecraft");
|
LOGGER = Logger.getLogger("Minecraft");
|
||||||
|
FILE_LOGGER = Logger.getLogger(AnticheatManager.class.getName());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File file = new File(plugin.getDataFolder()+"/log");
|
||||||
|
if(!file.exists())
|
||||||
|
{
|
||||||
|
file.mkdir();
|
||||||
|
}
|
||||||
|
HANDLER = new FileHandler(plugin.getDataFolder()+"/log/anticheat.log.%u.txt",true);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
LOGGER.log(Level.SEVERE, null, ex);
|
||||||
|
} catch (SecurityException ex) {
|
||||||
|
LOGGER.log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
HANDLER.setFormatter(new SimpleFormatter());
|
||||||
|
FILE_LOGGER.setUseParentHandlers(false);
|
||||||
|
FILE_LOGGER.addHandler(HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(String message)
|
public void log(String message)
|
||||||
|
{
|
||||||
|
if(getConfiguration().logConsole())
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING,"[AC] ".concat(message));
|
LOGGER.log(Level.WARNING,"[AC] ".concat(message));
|
||||||
}
|
}
|
||||||
|
FILE_LOGGER.log(Level.WARNING, message);
|
||||||
|
}
|
||||||
|
|
||||||
public Anticheat getPlugin()
|
public Anticheat getPlugin()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user