This commit is contained in:
asofold 2015-11-29 09:03:51 +01:00
parent 4a8f19ef7a
commit fdf15fc33e

View File

@ -275,22 +275,22 @@ public final class NCPHookManager {
* @param throwable * @param throwable
* the throwable * the throwable
*/ */
private static final void logHookFailure(final CheckType checkType, final Player player, final NCPHook hook, private static final void logHookFailure(final CheckType checkType, final Player player, final NCPHook hook, final Throwable t) {
final Throwable t) {
// TODO: might accumulate failure rate and only log every so and so seconds or disable hook if spamming (leads // TODO: might accumulate failure rate and only log every so and so seconds or disable hook if spamming (leads
// to NCP spam though)? // to NCP spam though)?
final StringBuilder builder = new StringBuilder(1024); final StringBuilder builder = new StringBuilder(1024);
builder.append("Hook " + getHookDescription(hook) + " encountered an unexpected exception:\n"); builder.append("Hook " + getHookDescription(hook) + " encountered an unexpected exception:\n");
builder.append("Processing: "); builder.append("Processing: ");
if (checkType.getParent() != null) if (checkType.getParent() != null) {
builder.append("Prent " + checkType.getParent() + " "); builder.append("Parent " + checkType.getParent() + " ");
}
builder.append("Check " + checkType); builder.append("Check " + checkType);
builder.append(" Player " + player.getName()); builder.append(" Player " + player.getName());
builder.append("\n"); builder.append("\n");
builder.append("Exception (" + t.getClass().getSimpleName() + "): " + t.getMessage() + "\n"); builder.append("Exception (" + t.getClass().getSimpleName() + "): " + t.getMessage() + "\n");
for (final StackTraceElement el : t.getStackTrace()) for (final StackTraceElement el : t.getStackTrace()) {
builder.append(el.toString()); builder.append(el.toString());
}
Bukkit.getLogger().severe(builder.toString()); Bukkit.getLogger().severe(builder.toString());
} }