From af788389cd6b72b063307d9dcbb4a2cd3e3db8a8 Mon Sep 17 00:00:00 2001 From: Brianna Date: Thu, 11 Jun 2020 09:08:56 -0500 Subject: [PATCH] Catch kit conversion. --- .../ultimatekits/conversion/Convert.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/songoda/ultimatekits/conversion/Convert.java b/src/main/java/com/songoda/ultimatekits/conversion/Convert.java index 3eccd31..1b8ae28 100644 --- a/src/main/java/com/songoda/ultimatekits/conversion/Convert.java +++ b/src/main/java/com/songoda/ultimatekits/conversion/Convert.java @@ -38,17 +38,21 @@ public class Convert { } private static void convertKits(Hook hook) { - Set kits = hook.getKits(); - for (String kit : kits) { - Kit kitObj = UltimateKits.getInstance().getKitManager().addKit(new Kit(kit)); - if (kitObj == null) continue; - for (ItemStack item : hook.getItems(kit)) { - if (item == null || item.getType() == Material.AIR) continue; - kitObj.getContents().add(new KitItem(item)); + try { + Set kits = hook.getKits(); + for (String kit : kits) { + Kit kitObj = UltimateKits.getInstance().getKitManager().addKit(new Kit(kit)); + if (kitObj == null) continue; + for (ItemStack item : hook.getItems(kit)) { + if (item == null || item.getType() == Material.AIR) continue; + kitObj.getContents().add(new KitItem(item)); + } + kitObj.setDelay(hook.getDelay(kit)); } - kitObj.setDelay(hook.getDelay(kit)); + UltimateKits.getInstance().saveKits(true); + } catch (NoSuchMethodError | NoClassDefFoundError e) { + System.out.println("UltimateKits conversion failed."); } - UltimateKits.getInstance().saveKits(true); } private static boolean isInJsonFormat() {