9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2025-12-19 15:09:23 +00:00

shut down scheduler on disable

This commit is contained in:
XiaoMoMi
2024-12-21 19:39:30 +08:00
parent 26b593950d
commit 6f0e61ae48
2 changed files with 2 additions and 19 deletions

View File

@@ -81,28 +81,12 @@ public abstract class AbstractJavaScheduler<T> implements SchedulerAdapter<T> {
@Override
public void shutdownScheduler() {
this.scheduler.shutdown();
try {
if (!this.scheduler.awaitTermination(1, TimeUnit.MINUTES)) {
this.plugin.getPluginLogger().severe("Timed out waiting for the CustomNameplates scheduler to terminate");
reportRunningTasks(thread -> thread.getName().equals("nameplates-scheduler"));
}
} catch (InterruptedException e) {
e.printStackTrace();
}
this.scheduler.shutdownNow();
}
@Override
public void shutdownExecutor() {
this.worker.shutdown();
try {
if (!this.worker.awaitTermination(1, TimeUnit.MINUTES)) {
this.plugin.getPluginLogger().severe("Timed out waiting for the CustomNameplates worker thread pool to terminate");
reportRunningTasks(thread -> thread.getName().startsWith("nameplates-worker-"));
}
} catch (InterruptedException e) {
e.printStackTrace();
}
this.worker.shutdownNow();
}
private void reportRunningTasks(Predicate<Thread> predicate) {

View File

@@ -310,7 +310,6 @@ public class BukkitCustomNameplates extends CustomNameplates implements Listener
this.scheduledMainTask = getScheduler().asyncRepeating(mainTask, 50, 50, TimeUnit.MILLISECONDS);
}
@Override
public InputStream getResourceStream(String filePath) {
return getBootstrap().getResource(filePath.replace("\\", "/"));