Cuberite Forum
[SOLVED] Server shutdown event - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: [SOLVED] Server shutdown event (/thread-2455.html)



[SOLVED] Server shutdown event - LuaIsAnoying - 05-27-2016

I need to hook into the server shutdown event so that I can save a file. The docs say nothing about this.


RE: Server shutdown event - NiLSPACE - 05-27-2016

Similar to the Initialize function there is also an OnDisable function. Here is an example: https://github.com/cuberite/WorldEdit/blob/master/main.lua#L77 No need to register it anywhere as long as it's a global function.

Keep in mind that this gets fired when the plugin gets disabled, so it also gets called when reloading the plugin. I believe it's exactly what you're looking for though Smile


RE: Server shutdown event - LuaIsAnoying - 05-27-2016

(05-27-2016, 05:11 AM)NiLSPACE Wrote: Similar to the Initialize function there is also an OnDisable function. Here is an example: https://github.com/cuberite/WorldEdit/blob/master/main.lua#L77  No need to register it anywhere as long as it's a global function.

Keep in mind that this gets fired when the plugin gets disabled, so it also gets called when reloading the plugin. I believe it's exactly what you're looking for though Smile

This is perfect thanks. The docs need to be more detailed

The bukkit docs are a great modal.


RE: Server shutdown event - PureTryOut - 05-27-2016

(05-27-2016, 05:19 AM)LuaIsAnoying Wrote: The docs need to be more detailed

I disagree, I think they do a really good job at explaining what each function is and what you can use.
The function you were searching for was in the main "Writing a Cuberite plugin", which you should've read if you wanted to start writing plugins.


RE: Server shutdown event - LuaIsAnoying - 05-31-2016

(05-27-2016, 06:39 AM)PureTryOut Wrote:
(05-27-2016, 05:19 AM)LuaIsAnoying Wrote: The docs need to be more detailed

I disagree, I think they do a really good job at explaining what each function is and what you can use.
The function you were searching for was in the main "Writing a Cuberite plugin", which you should've read if you wanted to start writing plugins.

Yeah, but the event is not in the docs. I searched for a while but found nothing.