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