From c7cb56bc1de9bba295ddfcd668f877026aa4bf3d Mon Sep 17 00:00:00 2001 From: owlnull Date: Tue, 28 Apr 2020 15:10:25 +0500 Subject: [PATCH] Fix plugin crash caused by SkinsRestorer integration SkinsRestorer integration now just shows warning instead of plugin crash when SkinsRestorer not installed and integration enabled --- .../java/org/dynmap/bukkit/DynmapPlugin.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java b/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java index 579fc4f1..4307f67a 100644 --- a/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java +++ b/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java @@ -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);