Fix auto-updater failing
- Implemented a new self-reload system, which will boot up a separate plugin to load ServerUtils back up again.
This commit is contained in:
parent
e2a9fb1dc3
commit
2c1c92fef6
10 changed files with 75 additions and 7 deletions
|
|
@ -8,6 +8,7 @@ import net.frankheijden.serverutils.bungee.managers.BungeePluginManager;
|
|||
import net.frankheijden.serverutils.bungee.managers.BungeeTaskManager;
|
||||
import net.frankheijden.serverutils.bungee.managers.BungeeVersionManager;
|
||||
import net.frankheijden.serverutils.common.entities.ServerUtilsPlugin;
|
||||
import net.md_5.bungee.api.plugin.PluginDescription;
|
||||
|
||||
public class BungeePlugin extends ServerUtilsPlugin {
|
||||
|
||||
|
|
@ -67,4 +68,15 @@ public class BungeePlugin extends ServerUtilsPlugin {
|
|||
public File getDataFolder() {
|
||||
return plugin.getDataFolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public PluginDescription fetchUpdaterData() {
|
||||
try {
|
||||
return BungeePluginManager.getPluginDescription(pluginManager.getPluginFile("ServerUtils"));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,6 +114,19 @@ public class BungeePluginManager extends AbstractPluginManager<Plugin> {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result disablePlugin(Plugin plugin) {
|
||||
PluginDescription desc = plugin.getDescription();
|
||||
String name = desc.getName();
|
||||
try {
|
||||
plugin.onDisable();
|
||||
return Result.SUCCESS;
|
||||
} catch (Throwable th) {
|
||||
proxy.getLogger().log(Level.WARNING, "Exception encountered when disabling plugin: " + name, th);
|
||||
return Result.ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result reloadPlugin(String pluginName) {
|
||||
Plugin plugin = proxy.getPluginManager().getPlugin(pluginName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue