From 9ebb6b514fd050799fc4ba7e98cb6f73db41c49c Mon Sep 17 00:00:00 2001 From: stepech Date: Sat, 11 Dec 2021 14:35:29 +0100 Subject: [PATCH] dependency: Update SkinsRestorer --- spigot/build.gradle | 4 +-- .../java/org/dynmap/bukkit/DynmapPlugin.java | 25 +++++++++++-------- .../bukkit/SkinsRestorerSkinUrlProvider.java | 3 +-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/spigot/build.gradle b/spigot/build.gradle index f5965df9..29f64f8f 100644 --- a/spigot/build.gradle +++ b/spigot/build.gradle @@ -5,7 +5,7 @@ repositories { url 'https://jitpack.io' } maven { - url 'https://repo.codemc.org/repository/maven-snapshots' + url 'https://repo.codemc.org/repository/maven-releases/' } } @@ -15,7 +15,7 @@ dependencies { implementation 'me.lucko.luckperms:luckperms-api:4.3' implementation 'net.luckperms:api:5.0' implementation('com.github.MilkBowl:VaultAPI:1.7') { transitive = false } - compileOnly 'net.skinsrestorer:skinsrestorer:14.1.0-SNAPSHOT@jar' + compileOnly 'net.skinsrestorer:skinsrestorer-api:14.1.+' implementation project(":dynmap-api") implementation project(path: ":DynmapCore", configuration: "shadow") implementation group: 'ru.tehkode', name: 'PermissionsEx', version: '1.19.1' diff --git a/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java b/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java index f580bf93..dd52e7fd 100644 --- a/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java +++ b/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java @@ -110,7 +110,6 @@ import org.dynmap.renderer.DynmapBlockState; import org.dynmap.utils.MapChunkCache; import org.dynmap.utils.Polygon; import org.dynmap.utils.VisibilityLimit; -import net.skinsrestorer.bukkit.SkinsRestorer; public class DynmapPlugin extends JavaPlugin implements DynmapAPI { private DynmapCore core; @@ -959,18 +958,24 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI { SkinsRestorerSkinUrlProvider skinUrlProvider = null; if (core.configuration.getBoolean("skinsrestorer-integration", false)) { - try { - SkinsRestorer skinsRestorer = (SkinsRestorer) getServer().getPluginManager().getPlugin("SkinsRestorer"); - if (skinsRestorer == null) { - Log.warning("SkinsRestorer integration can't be enabled because SkinsRestorer not installed"); - } else { + Plugin skinsRestorer = getServer().getPluginManager().getPlugin("SkinsRestorer"); + + if (skinsRestorer == null) { + Log.warning("SkinsRestorer integration can't be enabled because SkinsRestorer is not installed"); + } else { + try { skinUrlProvider = new SkinsRestorerSkinUrlProvider(); - Log.info("SkinsRestorer API v14 integration enabled"); + Log.info("SkinsRestorer API integration enabled"); + } catch (NoClassDefFoundError e) { + skinUrlProvider = null; + Log.warning("You are using unsupported version of SkinsRestorer. Use v14.1 or newer."); + Log.warning("Disabled SkinsRestorer integration for this session"); + } catch (Throwable e) { + // SkinsRestorer probably updated its API + skinUrlProvider = null; + Log.warning("Error while enabling SkinsRestorer integration", e); } - } catch(NoClassDefFoundError e) { - Log.warning("You are using unsupported version of SkinsRestorer. Use v14 or newer."); - Log.warning("Disabled SkinsRestorer integration for this session"); } } diff --git a/spigot/src/main/java/org/dynmap/bukkit/SkinsRestorerSkinUrlProvider.java b/spigot/src/main/java/org/dynmap/bukkit/SkinsRestorerSkinUrlProvider.java index f3ac7ffd..54a84493 100644 --- a/spigot/src/main/java/org/dynmap/bukkit/SkinsRestorerSkinUrlProvider.java +++ b/spigot/src/main/java/org/dynmap/bukkit/SkinsRestorerSkinUrlProvider.java @@ -5,8 +5,7 @@ import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import org.json.simple.JSONObject; import net.skinsrestorer.api.SkinsRestorerAPI; -import net.skinsrestorer.bukkit.SkinsRestorer; -import net.skinsrestorer.shared.utils.ReflectionUtil; +import net.skinsrestorer.api.reflection.ReflectionUtil; import java.net.MalformedURLException; import java.net.URL;