mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-04 06:28:52 +00:00
Did I just miss a file in the mass reformatting?
This commit is contained in:
1 parent
30afc3edf9
commit
895c082325
1 file changed
+93
-93
@@ -38,97 +38,97 @@ import org.bukkit.ChatColor;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class AnticheatManager {
|
public class AnticheatManager {
|
||||||
private Anticheat plugin = null;
|
private Anticheat plugin = null;
|
||||||
private Configuration configuration;
|
private Configuration configuration;
|
||||||
private XRayTracker xrayTracker = null;
|
private XRayTracker xrayTracker = null;
|
||||||
private UserManager userManager = null;
|
private UserManager userManager = null;
|
||||||
private CheckManager checkManager = null;
|
private CheckManager checkManager = null;
|
||||||
private Backend backend = null;
|
private Backend backend = null;
|
||||||
private final Logger fileLogger;
|
private final Logger fileLogger;
|
||||||
private static List<String> logs = new CopyOnWriteArrayList<String>();
|
private static List<String> logs = new CopyOnWriteArrayList<String>();
|
||||||
private static Handler fileHandler;
|
private static Handler fileHandler;
|
||||||
private static final int LOG_LEVEL_HIGH = 3;
|
private static final int LOG_LEVEL_HIGH = 3;
|
||||||
|
|
||||||
public AnticheatManager(Anticheat instance, Logger logger) {
|
public AnticheatManager(Anticheat instance, Logger logger) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
// now load all the others!!!!!
|
// now load all the others!!!!!
|
||||||
fileLogger = Logger.getLogger("net.h31ix.anticheat.Anticheat");
|
fileLogger = Logger.getLogger("net.h31ix.anticheat.Anticheat");
|
||||||
configuration = new Configuration(this);
|
configuration = new Configuration(this);
|
||||||
xrayTracker = new XRayTracker();
|
xrayTracker = new XRayTracker();
|
||||||
userManager = new UserManager(configuration);
|
userManager = new UserManager(configuration);
|
||||||
checkManager = new CheckManager(this);
|
checkManager = new CheckManager(this);
|
||||||
backend = new Backend(this);
|
backend = new Backend(this);
|
||||||
try {
|
try {
|
||||||
File file = new File(plugin.getDataFolder() + "/log");
|
File file = new File(plugin.getDataFolder() + "/log");
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
file.mkdir();
|
file.mkdir();
|
||||||
}
|
}
|
||||||
fileHandler = new FileHandler(plugin.getDataFolder() + "/log/anticheat.log", true);
|
fileHandler = new FileHandler(plugin.getDataFolder() + "/log/anticheat.log", true);
|
||||||
fileHandler.setFormatter(new FileFormatter());
|
fileHandler.setFormatter(new FileFormatter());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
fileLogger.setUseParentHandlers(false);
|
fileLogger.setUseParentHandlers(false);
|
||||||
fileLogger.addHandler(fileHandler);
|
fileLogger.addHandler(fileHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(String message) {
|
public void log(String message) {
|
||||||
log(message, 0);
|
log(message, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(String message, int i) {
|
public void log(String message, int i) {
|
||||||
if (getConfiguration().logConsole()) {
|
if (getConfiguration().logConsole()) {
|
||||||
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + message);
|
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + message);
|
||||||
}
|
}
|
||||||
if (i == 0 && getConfiguration().getFileLogLevel() == LOG_LEVEL_HIGH) // Not an alert, normal log message
|
if (i == 0 && getConfiguration().getFileLogLevel() == LOG_LEVEL_HIGH) // Not an alert, normal log message
|
||||||
{
|
{
|
||||||
fileLog(message);
|
fileLog(message);
|
||||||
} else if (getConfiguration().getFileLogLevel() != 0)// alert
|
} else if (getConfiguration().getFileLogLevel() != 0)// alert
|
||||||
{
|
{
|
||||||
fileLog(message);
|
fileLog(message);
|
||||||
}
|
}
|
||||||
logs.add(ChatColor.stripColor(message));
|
logs.add(ChatColor.stripColor(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fileLog(String message) {
|
public void fileLog(String message) {
|
||||||
fileLogger.info(message);
|
fileLogger.info(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getLastLogs() {
|
public List<String> getLastLogs() {
|
||||||
List<String> log = new CopyOnWriteArrayList<String>();
|
List<String> log = new CopyOnWriteArrayList<String>();
|
||||||
if (logs.size() < 30) { return logs; }
|
if (logs.size() < 30) { return logs; }
|
||||||
for (int i = logs.size() - 1; i >= 0; i--) {
|
for (int i = logs.size() - 1; i >= 0; i--) {
|
||||||
log.add(logs.get(i));
|
log.add(logs.get(i));
|
||||||
}
|
}
|
||||||
logs.clear();
|
logs.clear();
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Anticheat getPlugin() {
|
public Anticheat getPlugin() {
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Configuration getConfiguration() {
|
public Configuration getConfiguration() {
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XRayTracker getXRayTracker() {
|
public XRayTracker getXRayTracker() {
|
||||||
return xrayTracker;
|
return xrayTracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserManager getUserManager() {
|
public UserManager getUserManager() {
|
||||||
return userManager;
|
return userManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckManager getCheckManager() {
|
public CheckManager getCheckManager() {
|
||||||
return checkManager;
|
return checkManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Backend getBackend() {
|
public Backend getBackend() {
|
||||||
return backend;
|
return backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void close() {
|
public static void close() {
|
||||||
fileHandler.close();
|
fileHandler.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user