From b3c0f4194864b09431c43824ef1b2304f91906dd Mon Sep 17 00:00:00 2001 From: ceze88 Date: Mon, 15 Apr 2024 16:53:51 +0200 Subject: [PATCH] Update EssentialsX kit conversion (EssentialsX 2.20.1+ required) --- pom.xml | 35 +++++++++++++++++-- .../ultimatekits/conversion/Convert.java | 3 +- .../conversion/hooks/EssentialsHook.java | 7 ++-- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 74262e6..c7cbbc9 100644 --- a/pom.xml +++ b/pom.xml @@ -111,11 +111,31 @@ + + spigot-repo + https://hub.spigotmc.org/nexus/content/groups/public/ + + spigotmc-repo https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + essentials-snapshots + https://repo.essentialsx.net/snapshots/ + + + + essentials-releases + https://repo.essentialsx.net/releases/ + + + + paper-repo + https://papermc.io/repo/repository/maven-public/ + + public https://repo.craftaro.com/repository/public/ @@ -144,10 +164,19 @@ provided + - com.earth2me - essentials - 2.17.1 + net.essentialsx + EssentialsX + 2.19.1-SNAPSHOT + provided + + + + + org.bstats + bstats-bukkit + 3.0.2 provided diff --git a/src/main/java/com/craftaro/ultimatekits/conversion/Convert.java b/src/main/java/com/craftaro/ultimatekits/conversion/Convert.java index 2c6428d..1c2c5ac 100644 --- a/src/main/java/com/craftaro/ultimatekits/conversion/Convert.java +++ b/src/main/java/com/craftaro/ultimatekits/conversion/Convert.java @@ -53,7 +53,8 @@ public class Convert { } plugin.saveKits(true); } catch (NoSuchMethodError | NoClassDefFoundError e) { - System.out.println("UltimateKits conversion failed."); + plugin.getLogger().severe("Failed to convert kits from " + hook.getClass().getSimpleName() + "most likely due to an outdated plugin version."); + e.printStackTrace(); } } diff --git a/src/main/java/com/craftaro/ultimatekits/conversion/hooks/EssentialsHook.java b/src/main/java/com/craftaro/ultimatekits/conversion/hooks/EssentialsHook.java index 6188cdd..d956177 100644 --- a/src/main/java/com/craftaro/ultimatekits/conversion/hooks/EssentialsHook.java +++ b/src/main/java/com/craftaro/ultimatekits/conversion/hooks/EssentialsHook.java @@ -5,6 +5,7 @@ import com.craftaro.ultimatekits.conversion.Hook; import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Kit; import com.earth2me.essentials.MetaItemStack; +import com.earth2me.essentials.config.EssentialsConfiguration; import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.inventory.ItemStack; @@ -23,10 +24,10 @@ public class EssentialsHook implements Hook { @Override public Map getKits() { - ConfigurationSection cs = this.essentials.getSettings().getKits(); + EssentialsConfiguration cs = this.essentials.getKits().getRootConfig(); Map kits = new LinkedHashMap<>(); try { - for (String name : cs.getKeys(false)) { + for (String name : cs.getKeys()) { Set stacks = new HashSet<>(); Kit kitObj = new Kit(name, this.essentials); for (String nonParse : kitObj.getItems()) { @@ -42,7 +43,7 @@ public class EssentialsHook implements Hook { } stacks.add(metaStack.getItemStack()); } - kits.put(name, new ConversionKit(stacks, Integer.toUnsignedLong((int) this.essentials.getSettings().getKit(name).getOrDefault("delay", 0)))); + kits.put(name, new ConversionKit(stacks, Integer.toUnsignedLong((int) cs.getInt("delay", 0)))); } } catch (Exception e) { return kits;