mrgeneralq / sleep-most

Control the amount of percentage of sleeping players required to make it day. 100K+ downloads on spigot!
https://www.spigotmc.org/resources/sleep-most-1-14-4-configurable-messages-and-percentage.60623/
30 stars 12 forks source link

Disabling the plugin will not cancel the task, causing error when re enabling #177

Closed eikyu625 closed 9 months ago

eikyu625 commented 1 year ago

Describe the bug Disabling the plugin will not cancel the task, causing error when re enabling. I tested it in version 5.2.5, and can avoid this problem by cancelTasks when closing the plugin.

To Reproduce Use the plugin management plugin to disable the plugin, then restart it.

Additional context Add any other context about the problem here.

[21:11:05] [Server thread/ERROR]: Error occurred while enabling sleep-most v5.3.0 (Is it up to date?)
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@12733a89 rejected from java.util.concurrent.ScheduledThreadPoolExecutor@1fa117e[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 68]
        at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(Unknown Source) ~[?:1.8.0_301]
        at java.util.concurrent.ThreadPoolExecutor.reject(Unknown Source) ~[?:1.8.0_301]
        at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(Unknown Source) ~[?:1.8.0_301]
        at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(Unknown Source) ~[?:1.8.0_301]
        at me.mrgeneralq.sleepmost.bstats.MetricsBase.startSubmitting(MetricsBase.java:134) ~[?:?]
        at me.mrgeneralq.sleepmost.bstats.MetricsBase.<init>(MetricsBase.java:107) ~[?:?]
        at me.mrgeneralq.sleepmost.bstats.bukkit.Metrics.<init>(Metrics.java:74) ~[?:?]
        at me.mrgeneralq.sleepmost.Sleepmost.onEnable(Sleepmost.java:42) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[JavaPlugin.class:git-CatServer-1.12.2-fed56812]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:328) ~[JavaPluginLoader.class:git-CatServer-1.12.2-fed56812]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) ~[SimplePluginManager.class:git-CatServer-1.12.2-fed56812]
eikyu625 commented 1 year ago

PAPI has the same problem. [PlaceholderAPI] Failed to load expansion sleepmost. Identifier is already in use. need unregister.

mrgeneralq commented 9 months ago

@eikyu625 First of all apologies for the delay. 2nd, you only got this error when reloading the server? It's good practice not to reload but restart instead. I can still see if I can unregister PAPI when reloading.

Please let me know if this is what you are looking for.

Kind regards

MrGeneralQ

mrgeneralq commented 9 months ago

You should not reload the server, restart the server instead