Fix plugin crash caused by SkinsRestorer integration

SkinsRestorer integration now just shows warning instead of plugin crash when SkinsRestorer not installed and integration enabled
This commit is contained in:
owlnull 2020-04-28 15:10:25 +05:00
parent ef2a45ab2a
commit c7cb56bc1d

View File

@ -899,15 +899,18 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
}
/* Skins support via SkinsRestorer */
SkinsRestorer skinsRestorer = null;
if (core.configuration.getBoolean("skinsrestorer-integration", false))
skinsRestorer = JavaPlugin.getPlugin(SkinsRestorer.class);
SkinsRestorerSkinUrlProvider skinUrlProvider = null;
if (skinsRestorer != null)
skinUrlProvider = new SkinsRestorerSkinUrlProvider(skinsRestorer);
if (core.configuration.getBoolean("skinsrestorer-integration", false)) {
SkinsRestorer skinsRestorer = (SkinsRestorer) getServer().getPluginManager().getPlugin("SkinsRestorer");
if (skinsRestorer == null) {
Log.warning("SkinsRestorer integration can't be enabled because SkinsRestorer not installed");
} else {
skinUrlProvider = new SkinsRestorerSkinUrlProvider(skinsRestorer);
Log.info("SkinsRestorer integration enabled");
}
}
core.setSkinUrlProvider(skinUrlProvider);