Bind BridgeHealth API incompatibility warnings to logging.debug.

This commit is contained in:
asofold 2013-07-15 00:24:46 +02:00
parent cf1c89d646
commit 83187fa549

View File

@ -9,6 +9,8 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import fr.neatmonster.nocheatplus.config.ConfPaths;
import fr.neatmonster.nocheatplus.config.ConfigManager;
import fr.neatmonster.nocheatplus.logging.LogUtil;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
@ -38,7 +40,7 @@ public class BridgeHealth {
final String tag = obj.getClass().getName() + "." + methodName;
if (failures.add(tag)){
// New entry.
LogUtil.logWarning("[NoCheatPlus] API incompatibility detected: " + tag);
checkLogEntry(tag);
}
}
final Object o1 = ReflectionUtil.invokeMethodNoArgs(obj, methodName, double.class, int.class);
@ -183,8 +185,7 @@ public class BridgeHealth {
if (reason != null){
final String tag = obj.getClass().getName() + "." + methodName;
if (failures.add(tag)){
// New entry.
LogUtil.logWarning("[NoCheatPlus] API incompatibility detected: " + tag);
checkLogEntry(tag);
}
}
try {
@ -193,5 +194,12 @@ public class BridgeHealth {
throw new RuntimeException("Could not invoke " + methodName + " with one argument (int) on: " + obj.getClass().getName(), reason);
}
}
private static void checkLogEntry(final String tag) {
// New entry.
if (ConfigManager.getConfigFile().getBoolean(ConfPaths.LOGGING_DEBUG)){
LogUtil.logWarning("[NoCheatPlus] API incompatibility detected: " + tag);
}
}
}