Closed BaxAndrei closed 2 years ago
Support for what API?
For example to attach another plugin to it to initiate some kind of update. I want to add a command that will download latest file from Jenkins, remove the curent one and then uses api to unload old one and load the new one.
You can add SpigotPluginManager as a depend/softdepend in your Plugin and call the PluginManager.getInstance()
method and access the instance of the PluginUtils.
You could use the PluginManager internal updater as some inspiration for an updater: https://github.com/Lenni0451/SpigotPluginManager/blob/948d735f04ae400c99973faf7a4fda93abad501d/src/main/java/net/lenni0451/spm/PluginManager.java#L94-L113
Or better you could download the new plugin file into the plugins/update
(PluginManager.getInstance().getPluginUtils().getUpdateDirectory()
) directory and call:
PluginManager.getInstance().getPluginUtils().reloadPlugin(plugin);
PM then unloads the plugin, moves the new plugin file and loads it again.
Make sure to name the updated file in the plugins/update
folder exactly like the current one since PM would be unable to find it and your plugins would just get reloaded.
Here is a bit example code for that:
Thank you very much!
Is it ok if I uploaded the jar file to my server? (I'm the only person who knows the location). I use Jenkins and it is much easier for me to create a repo in which to put the jar for self-build. If you want, I can give you the public address. Thanks again for the help.
I guess you are speaking of PM. You can do that and I don't want the url. But thanks for asking
Is there any support for API?