mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-03-02 10:31:25 +01:00
Use LogUtil for logging exceptions.
This commit is contained in:
parent
b566bc1d00
commit
d38b09bc1f
@ -191,7 +191,7 @@ public class ActionFactory {
|
|||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
LogUtil.logWarning("[NoCheatPlus] Couldn't parse details of log action '" + definition
|
LogUtil.logWarning("[NoCheatPlus] Couldn't parse details of log action '" + definition
|
||||||
+ "', will use default values instead.");
|
+ "', will use default values instead.");
|
||||||
e.printStackTrace();
|
LogUtil.logWarning(e);
|
||||||
delay = 0;
|
delay = 0;
|
||||||
repeat = 1;
|
repeat = 1;
|
||||||
toConsole = true;
|
toConsole = true;
|
||||||
|
@ -14,6 +14,7 @@ import fr.neatmonster.nocheatplus.hooks.NCPHookManager;
|
|||||||
import fr.neatmonster.nocheatplus.metrics.MetricsData;
|
import fr.neatmonster.nocheatplus.metrics.MetricsData;
|
||||||
import fr.neatmonster.nocheatplus.players.DataManager;
|
import fr.neatmonster.nocheatplus.players.DataManager;
|
||||||
import fr.neatmonster.nocheatplus.players.ExecutionHistory;
|
import fr.neatmonster.nocheatplus.players.ExecutionHistory;
|
||||||
|
import fr.neatmonster.nocheatplus.utilities.LogUtil;
|
||||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -177,7 +178,7 @@ public abstract class Check {
|
|||||||
if (!type.isEnabled(player) || player.hasPermission(type.getPermission()))
|
if (!type.isEnabled(player) || player.hasPermission(type.getPermission()))
|
||||||
return false;
|
return false;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
}
|
}
|
||||||
return !NCPExemptionManager.isExempted(player, type);
|
return !NCPExemptionManager.isExempted(player, type);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import fr.neatmonster.nocheatplus.actions.ActionList;
|
|||||||
import fr.neatmonster.nocheatplus.actions.ParameterName;
|
import fr.neatmonster.nocheatplus.actions.ParameterName;
|
||||||
import fr.neatmonster.nocheatplus.actions.types.CancelAction;
|
import fr.neatmonster.nocheatplus.actions.types.CancelAction;
|
||||||
import fr.neatmonster.nocheatplus.checks.access.IViolationInfo;
|
import fr.neatmonster.nocheatplus.checks.access.IViolationInfo;
|
||||||
|
import fr.neatmonster.nocheatplus.utilities.LogUtil;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* M""MMMMM""M oo dP dP oo M""""""'YMM dP
|
* M""MMMMM""M oo dP dP oo M""""""'YMM dP
|
||||||
@ -110,7 +111,7 @@ public class ViolationData implements IViolationInfo{
|
|||||||
|
|
||||||
return cancel;
|
return cancel;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
// On exceptions cancel events.
|
// On exceptions cancel events.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
import fr.neatmonster.nocheatplus.checks.chat.ChatConfig;
|
import fr.neatmonster.nocheatplus.checks.chat.ChatConfig;
|
||||||
import fr.neatmonster.nocheatplus.checks.chat.ChatData;
|
import fr.neatmonster.nocheatplus.checks.chat.ChatData;
|
||||||
@ -23,6 +21,7 @@ import fr.neatmonster.nocheatplus.components.IHaveCheckType;
|
|||||||
import fr.neatmonster.nocheatplus.components.IRemoveData;
|
import fr.neatmonster.nocheatplus.components.IRemoveData;
|
||||||
import fr.neatmonster.nocheatplus.config.ConfPaths;
|
import fr.neatmonster.nocheatplus.config.ConfPaths;
|
||||||
import fr.neatmonster.nocheatplus.config.ConfigFile;
|
import fr.neatmonster.nocheatplus.config.ConfigFile;
|
||||||
|
import fr.neatmonster.nocheatplus.utilities.LogUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,8 +75,8 @@ public class LetterEngine implements IRemoveData, IHaveCheckType{
|
|||||||
result.put(processor.getProcessorName(), processor.process(letterCount) * cc.textGlobalWeight);
|
result.put(processor.getProcessorName(), processor.process(letterCount) * cc.textGlobalWeight);
|
||||||
}
|
}
|
||||||
catch( final Exception e){
|
catch( final Exception e){
|
||||||
Bukkit.getLogger().warning("[NoCheatPlus] chat.text: processor("+processor.getProcessorName()+") generated an exception: " + e.getClass().getSimpleName() + ": " + e.getMessage());
|
LogUtil.logSevere("[NoCheatPlus] chat.text: processor("+processor.getProcessorName()+") generated an exception: " + e.getClass().getSimpleName() + ": " + e.getMessage());
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,8 +90,8 @@ public class LetterEngine implements IRemoveData, IHaveCheckType{
|
|||||||
result.put(processor.getProcessorName(), processor.process(letterCount) * cc.textPlayerWeight);
|
result.put(processor.getProcessorName(), processor.process(letterCount) * cc.textPlayerWeight);
|
||||||
}
|
}
|
||||||
catch( final Exception e){
|
catch( final Exception e){
|
||||||
Bukkit.getLogger().warning("[NoCheatPlus] chat.text: processor("+processor.getProcessorName()+") generated an exception: " + e.getClass().getSimpleName() + ": " + e.getMessage());
|
LogUtil.logSevere("[NoCheatPlus] chat.text: processor("+processor.getProcessorName()+") generated an exception: " + e.getClass().getSimpleName() + ": " + e.getMessage());
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import org.bukkit.configuration.MemoryConfiguration;
|
|||||||
import fr.neatmonster.nocheatplus.NoCheatPlus;
|
import fr.neatmonster.nocheatplus.NoCheatPlus;
|
||||||
import fr.neatmonster.nocheatplus.actions.ActionFactory;
|
import fr.neatmonster.nocheatplus.actions.ActionFactory;
|
||||||
import fr.neatmonster.nocheatplus.utilities.CheckUtils;
|
import fr.neatmonster.nocheatplus.utilities.CheckUtils;
|
||||||
|
import fr.neatmonster.nocheatplus.utilities.LogUtil;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MM'""""'YMM .8888b oo M"""""`'"""`YM
|
* MM'""""'YMM .8888b oo M"""""`'"""`YM
|
||||||
@ -215,11 +216,11 @@ public class ConfigManager {
|
|||||||
if (globalConfig.getBoolean(ConfPaths.SAVEBACKCONFIG)) globalConfig.save(globalFile);
|
if (globalConfig.getBoolean(ConfPaths.SAVEBACKCONFIG)) globalConfig.save(globalFile);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
Bukkit.getLogger().severe("[NoCheatPlus] Could not save back config.yml (see exception below).");
|
Bukkit.getLogger().severe("[NoCheatPlus] Could not save back config.yml (see exception below).");
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
Bukkit.getLogger().severe("[NoCheatPlus] Could not load config.yml (see exception below). Continue with default settings...");
|
Bukkit.getLogger().severe("[NoCheatPlus] Could not load config.yml (see exception below). Continue with default settings...");
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
globalConfig.options().header(
|
globalConfig.options().header(
|
||||||
@ -229,7 +230,7 @@ public class ConfigManager {
|
|||||||
globalConfig.save(globalFile);
|
globalConfig.save(globalFile);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
Bukkit.getLogger().severe("[NoCheatPlus] Could not save default config.yml (see exception below).");
|
Bukkit.getLogger().severe("[NoCheatPlus] Could not save default config.yml (see exception below).");
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globalConfig.regenerateActionLists();
|
globalConfig.regenerateActionLists();
|
||||||
@ -251,14 +252,14 @@ public class ConfigManager {
|
|||||||
try {
|
try {
|
||||||
logFile.getParentFile().mkdirs();
|
logFile.getParentFile().mkdirs();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
}
|
}
|
||||||
fileHandler = new FileHandler(logFile.getCanonicalPath(), true);
|
fileHandler = new FileHandler(logFile.getCanonicalPath(), true);
|
||||||
fileHandler.setLevel(Level.ALL);
|
fileHandler.setLevel(Level.ALL);
|
||||||
fileHandler.setFormatter(LogFileFormatter.newInstance());
|
fileHandler.setFormatter(LogFileFormatter.newInstance());
|
||||||
logger.addHandler(fileHandler);
|
logger.addHandler(fileHandler);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
}
|
}
|
||||||
CheckUtils.fileLogger = logger;
|
CheckUtils.fileLogger = logger;
|
||||||
|
|
||||||
@ -289,12 +290,12 @@ public class ConfigManager {
|
|||||||
} catch (final Exception e){
|
} catch (final Exception e){
|
||||||
Bukkit.getLogger().severe("[NoCheatPlus] Couldn't save back world-specific configuration for "
|
Bukkit.getLogger().severe("[NoCheatPlus] Couldn't save back world-specific configuration for "
|
||||||
+ worldEntry.getKey() + " (see exception below).");
|
+ worldEntry.getKey() + " (see exception below).");
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
Bukkit.getLogger().severe("[NoCheatPlus] Couldn't load world-specific configuration for "
|
Bukkit.getLogger().severe("[NoCheatPlus] Couldn't load world-specific configuration for "
|
||||||
+ worldEntry.getKey() + " (see exception below). Continue with global default settings...");
|
+ worldEntry.getKey() + " (see exception below). Continue with global default settings...");
|
||||||
e.printStackTrace();
|
LogUtil.logSevere(e);
|
||||||
}
|
}
|
||||||
worldConfig.setDefaults(globalConfig);
|
worldConfig.setDefaults(globalConfig);
|
||||||
worldConfig.options().copyDefaults(true);
|
worldConfig.options().copyDefaults(true);
|
||||||
|
@ -282,7 +282,7 @@ public class BlockProperties {
|
|||||||
initBlocks();
|
initBlocks();
|
||||||
}
|
}
|
||||||
catch(Throwable t){
|
catch(Throwable t){
|
||||||
t.printStackTrace();
|
LogUtil.logSevere(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user