You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Various events may be thrown when the server shuts down but in other cases too, like PlayerQuitEvent. onDisable() can also be called when shutting down or when simply disabled for other reason.
That's why I suggest that there is a way to see is the server is currently shutting down.
It would for example allow to execute code synchronously instead of launching asynchronous tasks.
Examples:
Saving player-related data in PlayerQuitEvent usually done by an async task, but the server may shutdown at that point and kill this task.
Saving config/files synchronously in onDisable(). Usually you don't need to do anything async here because the server shuts down, but it just slow downs the server if the plugin has actually been disabled dynamically. I'm not sure about that one, maybe the plugin is no longer able to do anything after it has been disabled.
The text was updated successfully, but these errors were encountered:
Plugin can use Thread.interrupted() or Thread.isInterrupted() to do stuff when it is being shutdown. (only works if ShutdownMonitorThread in Glowstone is changed to use Thread.interrupt instead of Thread.stop, and only if the plugin does not fully stop after GlowServer disables them)
So it might not be a good idea to add onDisable() because only plugins that are continuing a task will continue running after disable, and they should check if they are interrupted anyway.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Here is a simple idea.
Various events may be thrown when the server shuts down but in other cases too, like
PlayerQuitEvent
.onDisable()
can also be called when shutting down or when simply disabled for other reason.That's why I suggest that there is a way to see is the server is currently shutting down.
It would for example allow to execute code synchronously instead of launching asynchronous tasks.
Examples:
PlayerQuitEvent
usually done by an async task, but the server may shutdown at that point and kill this task.onDisable()
. Usually you don't need to do anything async here because the server shuts down, but it just slow downs the server if the plugin has actually been disabled dynamically. I'm not sure about that one, maybe the plugin is no longer able to do anything after it has been disabled.The text was updated successfully, but these errors were encountered: