mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-03 19:00:30 +02:00
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.
This commit is contained in:
parent
71513f2d0c
commit
c1c7e83bde
|
@ -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.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user