mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-21 01:01:35 +08:00
Fix ConsoleInjector not getting reinjecting on reload (#5149)
This commit is contained in:
parent
22a0d53cf2
commit
6e931b2b3b
@ -392,7 +392,7 @@ public class JDADiscordService implements DiscordService, IEssentialsModule {
|
||||
|
||||
shutdownConsoleRelay(false);
|
||||
consoleWebhook = DiscordUtil.getWebhookClient(webhookId, webhookToken, jda.getHttpClient());
|
||||
if (injector == null) {
|
||||
if (injector == null || injector.isRemoved()) {
|
||||
injector = new ConsoleInjector(this);
|
||||
injector.start();
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ public class ConsoleInjector extends AbstractAppender {
|
||||
private final JDADiscordService jda;
|
||||
private final BlockingQueue<String> messageQueue = new LinkedBlockingQueue<>();
|
||||
private final int taskId;
|
||||
private boolean removed = false;
|
||||
|
||||
public ConsoleInjector(JDADiscordService jda) {
|
||||
super("EssentialsX-ConsoleInjector", null, null, false);
|
||||
@ -93,5 +94,10 @@ public class ConsoleInjector extends AbstractAppender {
|
||||
((Logger) LogManager.getRootLogger()).removeAppender(this);
|
||||
Bukkit.getScheduler().cancelTask(taskId);
|
||||
messageQueue.clear();
|
||||
removed = true;
|
||||
}
|
||||
|
||||
public boolean isRemoved() {
|
||||
return removed;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user