From c1c7e83bde892187e6bcfdebc6c38304665e6812 Mon Sep 17 00:00:00 2001 From: asofold Date: Wed, 4 Feb 2015 21:29:29 +0100 Subject: [PATCH] Catch IllegalPluginAccessExcption with scheduling logging tasks. While we can/could control which stream to log to within onDisable, we should still assume that an asynchronous task could be using the logging system. Since we don't have a clean entry to onDisable, we have to catch the exception. --- .../logging/details/BukkitLogNodeDispatcher.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/details/BukkitLogNodeDispatcher.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/details/BukkitLogNodeDispatcher.java index c688686b..e752bdb4 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/details/BukkitLogNodeDispatcher.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/details/BukkitLogNodeDispatcher.java @@ -1,6 +1,7 @@ package fr.neatmonster.nocheatplus.logging.details; import org.bukkit.Bukkit; +import org.bukkit.plugin.IllegalPluginAccessException; import org.bukkit.plugin.Plugin; import fr.neatmonster.nocheatplus.components.TickListener; @@ -47,7 +48,11 @@ public class BukkitLogNodeDispatcher extends AbstractLogNodeDispatcher { // TODO synchronized (queueAsynchronous) { if (taskAsynchronousID == -1) { // Deadlocking should not be possible. - taskAsynchronousID = Bukkit.getScheduler().runTaskAsynchronously(plugin, taskAsynchronous).getTaskId(); + try { + taskAsynchronousID = Bukkit.getScheduler().runTaskAsynchronously(plugin, taskAsynchronous).getTaskId(); + } catch (IllegalPluginAccessException ex) { + // (Should be during onDisable, ignore for now.) + } // TODO: Re-check task id here. } }