Adapt to LogUtil use.

This commit is contained in:
asofold 2012-11-09 08:47:24 +01:00
parent b158d5369a
commit 8ac003508f
17 changed files with 65 additions and 51 deletions

View File

@ -52,8 +52,8 @@ import fr.neatmonster.nocheatplus.permissions.PermissionUtil.CommandProtectionEn
import fr.neatmonster.nocheatplus.permissions.Permissions; import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.players.DataManager; import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.utilities.BlockProperties; import fr.neatmonster.nocheatplus.utilities.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.CheckUtils;
import fr.neatmonster.nocheatplus.utilities.LagMeasureTask; import fr.neatmonster.nocheatplus.utilities.LagMeasureTask;
import fr.neatmonster.nocheatplus.utilities.LogUtil;
import fr.neatmonster.nocheatplus.utilities.TickTask; import fr.neatmonster.nocheatplus.utilities.TickTask;
import fr.neatmonster.nocheatplus.utilities.Updates; import fr.neatmonster.nocheatplus.utilities.Updates;
@ -218,7 +218,7 @@ public class NoCheatPlus extends JavaPlugin implements Listener, NoCheatPlusAPI
if (listener instanceof IHaveMethodOrder){ if (listener instanceof IHaveMethodOrder){
// TODO: Might log the order too, might prevent registration ? // TODO: Might log the order too, might prevent registration ?
// TODO: Alternative: queue listeners and register after startup (!) // TODO: Alternative: queue listeners and register after startup (!)
CheckUtils.logWarning("[NoCheatPlus] Listener demands registration order, but listeners are not managed: " + listener.getClass().getName()); LogUtil.logWarning("[NoCheatPlus] Listener demands registration order, but listeners are not managed: " + listener.getClass().getName());
} }
} }
} }
@ -283,9 +283,9 @@ public class NoCheatPlus extends JavaPlugin implements Listener, NoCheatPlusAPI
listenerManager.setRegisterDirectly(false); listenerManager.setRegisterDirectly(false);
listenerManager.clear(); listenerManager.clear();
// Tell the server administrator the we finished unloading NoCheatPlus. // Tell the server administrator the we finished unloading NoCheatPlus.
CheckUtils.logInfo("[NoCheatPlus] Version " + pdfFile.getVersion() + " is disabled."); LogUtil.logInfo("[NoCheatPlus] Version " + pdfFile.getVersion() + " is disabled.");
} }
/** /**
* Does not undo 100%, but restore old permission, permission-message, label (unlikely to be changed), permission default. * Does not undo 100%, but restore old permission, permission-message, label (unlikely to be changed), permission default.
@ -443,9 +443,9 @@ public class NoCheatPlus extends JavaPlugin implements Listener, NoCheatPlusAPI
}); });
} }
// Tell the server administrator that we finished loading NoCheatPlus now. // Tell the server administrator that we finished loading NoCheatPlus now.
CheckUtils.logInfo("[NoCheatPlus] Version " + getDescription().getVersion() + " is enabled."); LogUtil.logInfo("[NoCheatPlus] Version " + getDescription().getVersion() + " is enabled.");
} }
// public void onPlayerJoinLow(final PlayerJoinEvent event) { // public void onPlayerJoinLow(final PlayerJoinEvent event) {
// /* // /*

View File

@ -9,7 +9,7 @@ import fr.neatmonster.nocheatplus.actions.types.CancelAction;
import fr.neatmonster.nocheatplus.actions.types.CommandAction; import fr.neatmonster.nocheatplus.actions.types.CommandAction;
import fr.neatmonster.nocheatplus.actions.types.DummyAction; import fr.neatmonster.nocheatplus.actions.types.DummyAction;
import fr.neatmonster.nocheatplus.actions.types.LogAction; import fr.neatmonster.nocheatplus.actions.types.LogAction;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.LogUtil;
/* /*
* MMP"""""""MM dP oo MM""""""""`M dP * MMP"""""""MM dP oo MM""""""""`M dP
@ -98,7 +98,7 @@ public class ActionFactory {
} }
list.setActions(vl, createActions(def.split("\\s+"))); list.setActions(vl, createActions(def.split("\\s+")));
} catch (final Exception e) { } catch (final Exception e) {
CheckUtils.logWarning("[NoCheatPlus] Couldn't parse action definition 'vl:" + s + "'."); LogUtil.logWarning("[NoCheatPlus] Couldn't parse action definition 'vl:" + s + "'.");
} }
} }
@ -121,7 +121,7 @@ public class ActionFactory {
try { try {
actions.add(createAction(def)); actions.add(createAction(def));
} catch (final IllegalArgumentException e) { } catch (final IllegalArgumentException e) {
CheckUtils.logWarning("[NoCheatPlus] Failed to create action: " + e.getMessage()); LogUtil.logWarning("[NoCheatPlus] Failed to create action: " + e.getMessage());
actions.add(new DummyAction(def)); actions.add(new DummyAction(def));
} }
} }
@ -152,7 +152,7 @@ public class ActionFactory {
delay = Integer.parseInt(parts[1]); delay = Integer.parseInt(parts[1]);
repeat = Integer.parseInt(parts[2]); repeat = Integer.parseInt(parts[2]);
} catch (final Exception e) { } catch (final Exception e) {
CheckUtils.logWarning("[NoCheatPlus] Couldn't parse details of command '" + definition LogUtil.logWarning("[NoCheatPlus] Couldn't parse details of command '" + definition
+ "', will use default values instead."); + "', will use default values instead.");
delay = 0; delay = 0;
repeat = 0; repeat = 0;
@ -189,7 +189,7 @@ public class ActionFactory {
toChat = parts[3].contains("i"); toChat = parts[3].contains("i");
toFile = parts[3].contains("f"); toFile = parts[3].contains("f");
} catch (final Exception e) { } catch (final Exception e) {
CheckUtils.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(); e.printStackTrace();
delay = 0; delay = 0;

View File

@ -4,7 +4,7 @@ import org.bukkit.Bukkit;
import org.bukkit.command.CommandException; import org.bukkit.command.CommandException;
import fr.neatmonster.nocheatplus.checks.ViolationData; import fr.neatmonster.nocheatplus.checks.ViolationData;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.LogUtil;
/* /*
* MM'""""'YMM dP * MM'""""'YMM dP
@ -54,7 +54,7 @@ public class CommandAction extends ActionWithParameters {
try { try {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command); Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
} catch (final CommandException e) { } catch (final CommandException e) {
CheckUtils.logWarning("[NoCheatPlus] Failed to execute the command '" + command + "': " + e.getMessage() LogUtil.logWarning("[NoCheatPlus] Failed to execute the command '" + command + "': " + e.getMessage()
+ ", please check if everything is setup correct."); + ", please check if everything is setup correct.");
} catch (final Exception e) { } catch (final Exception e) {
// I don't care in this case, your problem if your command fails. // I don't care in this case, your problem if your command fails.

View File

@ -10,6 +10,7 @@ import fr.neatmonster.nocheatplus.config.ConfigFile;
import fr.neatmonster.nocheatplus.config.ConfigManager; import fr.neatmonster.nocheatplus.config.ConfigManager;
import fr.neatmonster.nocheatplus.permissions.Permissions; import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.CheckUtils;
import fr.neatmonster.nocheatplus.utilities.LogUtil;
/* /*
* M""MMMMMMMM MMP"""""""MM dP oo * M""MMMMMMMM MMP"""""""MM dP oo
@ -77,7 +78,7 @@ public class LogAction extends ActionWithParameters {
otherPlayer.sendMessage(ChatColor.RED + "NCP: " + ChatColor.WHITE otherPlayer.sendMessage(ChatColor.RED + "NCP: " + ChatColor.WHITE
+ CheckUtils.replaceColors(message)); + CheckUtils.replaceColors(message));
if (toConsole && configurationFile.getBoolean(ConfPaths.LOGGING_CONSOLE)) if (toConsole && configurationFile.getBoolean(ConfPaths.LOGGING_CONSOLE))
CheckUtils.logInfo("[NoCheatPlus] " + CheckUtils.removeColors(message)); LogUtil.logInfo("[NoCheatPlus] " + CheckUtils.removeColors(message));
if (toFile && configurationFile.getBoolean(ConfPaths.LOGGING_FILE)) if (toFile && configurationFile.getBoolean(ConfPaths.LOGGING_FILE))
CheckUtils.fileLogger.info(CheckUtils.removeColors(message)); CheckUtils.fileLogger.info(CheckUtils.removeColors(message));
} }

View File

@ -3,7 +3,7 @@ package fr.neatmonster.nocheatplus.checks;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager; import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.LogUtil;
public abstract class AsyncCheck extends Check { public abstract class AsyncCheck extends Check {
@ -17,7 +17,7 @@ public abstract class AsyncCheck extends Check {
if (!type.isEnabled(player) || type.hasCachedPermission(player)) if (!type.isEnabled(player) || type.hasCachedPermission(player))
return false; return false;
} catch (final Exception e) { } catch (final Exception e) {
CheckUtils.scheduleOutput(e); LogUtil.scheduleLogSevere(e);
} }
return !NCPExemptionManager.isExempted(player, type); return !NCPExemptionManager.isExempted(player, type);
} }

View File

@ -20,6 +20,7 @@ import fr.neatmonster.nocheatplus.command.INotifyReload;
import fr.neatmonster.nocheatplus.config.ConfigFile; import fr.neatmonster.nocheatplus.config.ConfigFile;
import fr.neatmonster.nocheatplus.config.ConfigManager; import fr.neatmonster.nocheatplus.config.ConfigManager;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.CheckUtils;
import fr.neatmonster.nocheatplus.utilities.LogUtil;
/** /**
* Some alternative more or less advanced analysis methods. * Some alternative more or less advanced analysis methods.
@ -293,7 +294,7 @@ public class Text extends AsyncCheck implements INotifyReload{
debugParts.add("Normal: min=" + CheckUtils.fdec3.format(cc.textFreqNormMin) +", weight=" + CheckUtils.fdec3.format(cc.textFreqNormWeight) + " => accumulated=" + CheckUtils.fdec3.format(accumulated)); debugParts.add("Normal: min=" + CheckUtils.fdec3.format(cc.textFreqNormMin) +", weight=" + CheckUtils.fdec3.format(cc.textFreqNormWeight) + " => accumulated=" + CheckUtils.fdec3.format(accumulated));
debugParts.add("Short-term: min=" + CheckUtils.fdec3.format(cc.textFreqShortTermMin) +", weight=" + CheckUtils.fdec3.format(cc.textFreqShortTermWeight) + " => accumulated=" + CheckUtils.fdec3.format(shortTermAccumulated)); debugParts.add("Short-term: min=" + CheckUtils.fdec3.format(cc.textFreqShortTermMin) +", weight=" + CheckUtils.fdec3.format(cc.textFreqShortTermWeight) + " => accumulated=" + CheckUtils.fdec3.format(shortTermAccumulated));
debugParts.add("vl: " + CheckUtils.fdec3.format(data.textVL)); debugParts.add("vl: " + CheckUtils.fdec3.format(data.textVL));
CheckUtils.scheduleOutputJoined(debugParts, " | "); LogUtil.scheduleLogInfo(debugParts, " | ");
debugParts.clear(); debugParts.clear();
} }

View File

@ -20,6 +20,7 @@ import fr.neatmonster.nocheatplus.config.ConfigFile;
import fr.neatmonster.nocheatplus.config.ConfigManager; import fr.neatmonster.nocheatplus.config.ConfigManager;
import fr.neatmonster.nocheatplus.permissions.Permissions; import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.CheckUtils;
import fr.neatmonster.nocheatplus.utilities.LogUtil;
public class CombinedConfig extends ACheckConfig { public class CombinedConfig extends ACheckConfig {
@ -81,7 +82,7 @@ public class CombinedConfig extends ACheckConfig {
} }
catch (final Exception e){ catch (final Exception e){
error = true; error = true;
CheckUtils.logWarning("[NoCheatPlus] Bad damage cause (combined.invulnerable.ignore): " + input); LogUtil.logWarning("[NoCheatPlus] Bad damage cause (combined.invulnerable.ignore): " + input);
} }
} }
// Read modifiers for causes. // Read modifiers for causes.
@ -99,11 +100,11 @@ public class CombinedConfig extends ACheckConfig {
} }
catch (final Exception e){ catch (final Exception e){
error = true; error = true;
CheckUtils.logWarning("[NoCheatPlus] Bad damage cause (combined.invulnerable.modifiers): " + input); LogUtil.logWarning("[NoCheatPlus] Bad damage cause (combined.invulnerable.modifiers): " + input);
} }
} }
invulnerableModifierDefault = defaultMod; invulnerableModifierDefault = defaultMod;
if (error) CheckUtils.logInfo("[NoCheatPlus] Damage causes can be: " + CheckUtils.join(Arrays.asList(DamageCause.values()), ", ")); if (error) LogUtil.logInfo("[NoCheatPlus] Damage causes can be: " + CheckUtils.join(Arrays.asList(DamageCause.values()), ", "));
invulnerableTriggerAlways = config.getBoolean(ConfPaths.COMBINED_INVULNERABLE_TRIGGERS_ALWAYS); invulnerableTriggerAlways = config.getBoolean(ConfPaths.COMBINED_INVULNERABLE_TRIGGERS_ALWAYS);
invulnerableTriggerFallDistance = config.getBoolean(ConfPaths.COMBINED_INVULNERABLE_TRIGGERS_FALLDISTANCE); invulnerableTriggerFallDistance = config.getBoolean(ConfPaths.COMBINED_INVULNERABLE_TRIGGERS_FALLDISTANCE);
yawRate = config.getInt(ConfPaths.COMBINED_YAWRATE_RATE); yawRate = config.getInt(ConfPaths.COMBINED_YAWRATE_RATE);

View File

@ -46,6 +46,7 @@ import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.utilities.BlockCache; import fr.neatmonster.nocheatplus.utilities.BlockCache;
import fr.neatmonster.nocheatplus.utilities.BlockProperties; import fr.neatmonster.nocheatplus.utilities.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.CheckUtils;
import fr.neatmonster.nocheatplus.utilities.LogUtil;
import fr.neatmonster.nocheatplus.utilities.PlayerLocation; import fr.neatmonster.nocheatplus.utilities.PlayerLocation;
/* /*
@ -492,7 +493,7 @@ public class MovingListener implements Listener {
if (!restored){ if (!restored){
// TODO: correct the location ? // TODO: correct the location ?
NoCheatPlus.denyLogin(player.getName(), 24L * 60L * 60L * 1000L); NoCheatPlus.denyLogin(player.getName(), 24L * 60L * 60L * 1000L);
CheckUtils.logSevere("[NCP] could not restore location for " + player.getName() + " deny login for 24 hours"); LogUtil.logSevere("[NCP] could not restore location for " + player.getName() + " deny login for 24 hours");
} }
// TODO: reset the bounding box of the player ? // TODO: reset the bounding box of the player ?
CheckUtils.onIllegalMove(player); CheckUtils.onIllegalMove(player);

View File

@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.NoCheatPlus; import fr.neatmonster.nocheatplus.NoCheatPlus;
import fr.neatmonster.nocheatplus.command.DelayableCommand; import fr.neatmonster.nocheatplus.command.DelayableCommand;
import fr.neatmonster.nocheatplus.permissions.Permissions; import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.LogUtil;
public class BanCommand extends DelayableCommand { public class BanCommand extends DelayableCommand {
@ -41,7 +41,7 @@ public class BanCommand extends DelayableCommand {
player.kickPlayer(reason); player.kickPlayer(reason);
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(name); OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(name);
offlinePlayer.setBanned(true); offlinePlayer.setBanned(true);
CheckUtils.logInfo("[NoCheatPlus] (" + sender.getName() + ") Banned " + offlinePlayer.getName() + " : " + reason); LogUtil.logInfo("[NoCheatPlus] (" + sender.getName() + ") Banned " + offlinePlayer.getName() + " : " + reason);
} }
} }

View File

@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.NoCheatPlus; import fr.neatmonster.nocheatplus.NoCheatPlus;
import fr.neatmonster.nocheatplus.command.DelayableCommand; import fr.neatmonster.nocheatplus.command.DelayableCommand;
import fr.neatmonster.nocheatplus.permissions.Permissions; import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.LogUtil;
public class KickCommand extends DelayableCommand { public class KickCommand extends DelayableCommand {
@ -38,7 +38,7 @@ public class KickCommand extends DelayableCommand {
Player player = Bukkit.getPlayerExact(name); Player player = Bukkit.getPlayerExact(name);
if (player == null) return; if (player == null) return;
player.kickPlayer(reason); player.kickPlayer(reason);
CheckUtils.logInfo("[NoCheatPlus] (" + sender.getName() + ") Kicked " + player.getName() + " : " + reason); LogUtil.logInfo("[NoCheatPlus] (" + sender.getName() + ") Kicked " + player.getName() + " : " + reason);
} }
} }

View File

@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.NoCheatPlus; import fr.neatmonster.nocheatplus.NoCheatPlus;
import fr.neatmonster.nocheatplus.command.DelayableCommand; import fr.neatmonster.nocheatplus.command.DelayableCommand;
import fr.neatmonster.nocheatplus.permissions.Permissions; import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.LogUtil;
public class TempKickCommand extends DelayableCommand { public class TempKickCommand extends DelayableCommand {
@ -51,6 +51,6 @@ public class TempKickCommand extends DelayableCommand {
NoCheatPlus.denyLogin(name, duration); NoCheatPlus.denyLogin(name, duration);
if (player == null) return; if (player == null) return;
player.kickPlayer(reason); player.kickPlayer(reason);
CheckUtils.logInfo("[NoCheatPlus] (" + sender.getName() + ") Kicked " + player.getName() + " for " + duration/60000 +" minutes: " + reason); LogUtil.logInfo("[NoCheatPlus] (" + sender.getName() + ") Kicked " + player.getName() + " for " + duration/60000 +" minutes: " + reason);
} }
} }

View File

@ -14,7 +14,7 @@ import org.bukkit.event.Listener;
import org.bukkit.plugin.EventExecutor; import org.bukkit.plugin.EventExecutor;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.LogUtil;
/** /**
* listener registered for one event only. Allows to delegate to other registered listeners. * listener registered for one event only. Allows to delegate to other registered listeners.
@ -87,7 +87,7 @@ public class GenericListener<E extends Event> implements Listener, EventExecutor
} }
@Override @Override
public final void execute(final Listener listener, final Event event){ public void execute(final Listener listener, final Event event){
if (!clazz.isAssignableFrom(event.getClass())){ if (!clazz.isAssignableFrom(event.getClass())){
// Strange but true. // Strange but true.
return; return;
@ -102,15 +102,25 @@ public class GenericListener<E extends Event> implements Listener, EventExecutor
if (!isCancellable || !entry.ignoreCancelled || !cancellable.isCancelled()) entry.method.invoke(entry.listener, event); if (!isCancellable || !entry.ignoreCancelled || !cancellable.isCancelled()) entry.method.invoke(entry.listener, event);
} catch (Throwable t) { } catch (Throwable t) {
// IllegalArgumentException IllegalAccessException InvocationTargetException // IllegalArgumentException IllegalAccessException InvocationTargetException
final EventException e = new EventException(t, "GenericListener<" + clazz.getName() +"> @" + priority +" encountered an exception for " + entry.listener.getClass().getName() + " with method " + entry.method.toGenericString()); onError(entry, event, t);
// TODO: log it / more details!
if (event.isAsynchronous()) CheckUtils.scheduleOutput(e);
else CheckUtils.logSevere(e);
} }
} }
} }
private void onError(final MethodEntry entry, final Event event, final Throwable t) {
final String descr = "GenericListener<" + clazz.getName() +"> @" + priority +" encountered an exception for " + entry.listener.getClass().getName() + " with method " + entry.method.toGenericString();
try{
final EventException e = new EventException(t, descr);
// TODO: log it / more details!
if (event.isAsynchronous()) LogUtil.scheduleLogSevere(e);
else LogUtil.logSevere(e);
}
catch (Throwable t2){
LogUtil.scheduleLogSevere("Could not log exception: " + descr);
}
}
public void register(Plugin plugin) { public void register(Plugin plugin) {
if (registered) return; if (registered) return;
Bukkit.getPluginManager().registerEvent(clazz, this, priority, this, plugin, false); Bukkit.getPluginManager().registerEvent(clazz, this, priority, this, plugin, false);

View File

@ -16,7 +16,7 @@ import org.bukkit.plugin.Plugin;
import fr.neatmonster.nocheatplus.components.ComponentWithName; import fr.neatmonster.nocheatplus.components.ComponentWithName;
import fr.neatmonster.nocheatplus.event.GenericListener.MethodEntry; import fr.neatmonster.nocheatplus.event.GenericListener.MethodEntry;
import fr.neatmonster.nocheatplus.event.GenericListener.MethodEntry.MethodOrder; import fr.neatmonster.nocheatplus.event.GenericListener.MethodEntry.MethodOrder;
import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.LogUtil;
/** /**
* This class allows to register event-listeners which will all be called form within one event handler per event+priority combination.<br> * This class allows to register event-listeners which will all be called form within one event handler per event+priority combination.<br>
@ -135,17 +135,17 @@ public class ListenerManager {
try{ try{
method.setAccessible(true); method.setAccessible(true);
} catch (SecurityException e){ } catch (SecurityException e){
CheckUtils.logWarning("[ListenerManager] Can not set method accessible: " + method.toGenericString() +" registered in " + clazz.getName()+ ", ignoring it!"); LogUtil.logWarning("[ListenerManager] Can not set method accessible: " + method.toGenericString() +" registered in " + clazz.getName()+ ", ignoring it!");
} }
} }
Class<?>[] argTypes = method.getParameterTypes(); Class<?>[] argTypes = method.getParameterTypes();
if (argTypes.length != 1){ if (argTypes.length != 1){
CheckUtils.logWarning("[ListenerManager] Bad method signature (number of arguments not 1): " + method.toGenericString() +" registered in " + clazz.getName()+ ", ignoring it!"); LogUtil.logWarning("[ListenerManager] Bad method signature (number of arguments not 1): " + method.toGenericString() +" registered in " + clazz.getName()+ ", ignoring it!");
continue; continue;
} }
Class<?> eventType = argTypes[0]; Class<?> eventType = argTypes[0];
if (!Event.class.isAssignableFrom(eventType)){ if (!Event.class.isAssignableFrom(eventType)){
CheckUtils.logWarning("[ListenerManager] Bad method signature (argument does not extend Event): " + method.toGenericString() +" registered in " + clazz.getName()+ ", ignoring it!"); LogUtil.logWarning("[ListenerManager] Bad method signature (argument does not extend Event): " + method.toGenericString() +" registered in " + clazz.getName()+ ", ignoring it!");
continue; continue;
} }
Class<? extends Event> checkedEventType = eventType.asSubclass(Event.class); Class<? extends Event> checkedEventType = eventType.asSubclass(Event.class);

View File

@ -531,8 +531,8 @@ public class BlockProperties {
public static void dumpBlocks(boolean all) { public static void dumpBlocks(boolean all) {
List<String> missing = new LinkedList<String>(); List<String> missing = new LinkedList<String>();
if (all) { if (all) {
CheckUtils.logInfo("[NoCheatPlus] Dump block properties for fastbreak check:"); LogUtil.logInfo("[NoCheatPlus] Dump block properties for fastbreak check:");
CheckUtils.logInfo("--- Present entries -------------------------------"); LogUtil.logInfo("--- Present entries -------------------------------");
} }
for (int i = 0; i < blocks.length; i++){ for (int i = 0; i < blocks.length; i++){
String mat; String mat;
@ -548,13 +548,13 @@ public class BlockProperties {
if (mat.equals("?")) continue; if (mat.equals("?")) continue;
missing.add("* MISSING "+i + "(" + mat +") "); missing.add("* MISSING "+i + "(" + mat +") ");
} }
else if (all) CheckUtils.logInfo(i + ": (" + mat + ") " + blocks[i].toString()); else if (all) LogUtil.logInfo(i + ": (" + mat + ") " + blocks[i].toString());
} }
if (!missing.isEmpty()){ if (!missing.isEmpty()){
Bukkit.getLogger().warning("[NoCheatPlus] The block breaking data is incomplete, default to allow instant breaking:"); Bukkit.getLogger().warning("[NoCheatPlus] The block breaking data is incomplete, default to allow instant breaking:");
CheckUtils.logWarning("--- Missing entries -------------------------------"); LogUtil.logWarning("--- Missing entries -------------------------------");
for (String spec : missing){ for (String spec : missing){
CheckUtils.logWarning(spec); LogUtil.logWarning(spec);
} }
} }
} }
@ -1016,7 +1016,7 @@ public class BlockProperties {
// Ignore passable. // Ignore passable.
for (final String input : config.getStringList(pathPrefix + ConfPaths.SUB_IGNOREPASSABLE)){ for (final String input : config.getStringList(pathPrefix + ConfPaths.SUB_IGNOREPASSABLE)){
final Integer id = ConfigFile.parseTypeId(input); final Integer id = ConfigFile.parseTypeId(input);
if (id == null || id < 0 || id >= 4096) CheckUtils.logWarning("[NoCheatplus] Bad block id (" + pathPrefix + ConfPaths.SUB_IGNOREPASSABLE + "): " + input); if (id == null || id < 0 || id >= 4096) LogUtil.logWarning("[NoCheatplus] Bad block id (" + pathPrefix + ConfPaths.SUB_IGNOREPASSABLE + "): " + input);
else blockFlags[id] |= F_IGN_PASSABLE; else blockFlags[id] |= F_IGN_PASSABLE;
} }
} }

View File

@ -41,7 +41,7 @@ public class LagMeasureTask implements Runnable {
try { try {
Bukkit.getServer().getScheduler().cancelTask(instance.lagMeasureTaskId); Bukkit.getServer().getScheduler().cancelTask(instance.lagMeasureTaskId);
} catch (final Exception e) { } catch (final Exception e) {
CheckUtils.logWarning("[NoCheatPlus] Couldn't cancel LagMeasureTask: " + e.getMessage() + "."); LogUtil.logWarning("[NoCheatPlus] Couldn't cancel LagMeasureTask: " + e.getMessage() + ".");
} }
instance.lagMeasureTaskId = -1; instance.lagMeasureTaskId = -1;
} }
@ -98,9 +98,9 @@ public class LagMeasureTask implements Runnable {
// Show the debug messages. // Show the debug messages.
if (ConfigManager.getConfigFile().getBoolean(ConfPaths.LOGGING_DEBUG)) if (ConfigManager.getConfigFile().getBoolean(ConfPaths.LOGGING_DEBUG))
if (oldStatus != skipCheck && skipCheck) if (oldStatus != skipCheck && skipCheck)
CheckUtils.logInfo("[NoCheatPlus] Detected server lag, some checks will not work."); LogUtil.logInfo("[NoCheatPlus] Detected server lag, some checks will not work.");
else if (oldStatus != skipCheck && !skipCheck) else if (oldStatus != skipCheck && !skipCheck)
CheckUtils.logInfo("[NoCheatPlus] Server lag seems to have stopped, reenabling checks."); LogUtil.logInfo("[NoCheatPlus] Server lag seems to have stopped, reenabling checks.");
final long time = System.currentTimeMillis(); final long time = System.currentTimeMillis();
lastInGameSecondDuration = time - lastInGameSecondTime; lastInGameSecondDuration = time - lastInGameSecondTime;

View File

@ -81,7 +81,7 @@ public final class Stats {
if ( ts > tsStats+periodStats){ if ( ts > tsStats+periodStats){
tsStats = ts; tsStats = ts;
// print out stats ! // print out stats !
CheckUtils.logInfo(getStatsStr()); LogUtil.logInfo(getStatsStr());
} }
} }
} }

View File

@ -177,7 +177,7 @@ public class TickTask implements Runnable {
if (!delayedActions.isEmpty()) executeActions(); if (!delayedActions.isEmpty()) executeActions();
if (!permissionUpdates.isEmpty()) updatePermissions(); if (!permissionUpdates.isEmpty()) updatePermissions();
if (timeLast > time) { if (timeLast > time) {
CheckUtils.logSevere("[NoCheatPlus] System time ran backwards (" + timeLast + "->" + time + "), clear all data and history..."); LogUtil.logSevere("[NoCheatPlus] System time ran backwards (" + timeLast + "->" + time + "), clear all data and history...");
DataManager.clearData(CheckType.ALL); DataManager.clearData(CheckType.ALL);
} }
timeLast = time; timeLast = time;