Catch kit conversion.

This commit is contained in:
Brianna 2020-06-11 09:08:56 -05:00
parent 748538742c
commit af788389cd

View File

@ -38,17 +38,21 @@ public class Convert {
} }
private static void convertKits(Hook hook) { private static void convertKits(Hook hook) {
Set<String> kits = hook.getKits(); try {
for (String kit : kits) { Set<String> kits = hook.getKits();
Kit kitObj = UltimateKits.getInstance().getKitManager().addKit(new Kit(kit)); for (String kit : kits) {
if (kitObj == null) continue; Kit kitObj = UltimateKits.getInstance().getKitManager().addKit(new Kit(kit));
for (ItemStack item : hook.getItems(kit)) { if (kitObj == null) continue;
if (item == null || item.getType() == Material.AIR) continue; for (ItemStack item : hook.getItems(kit)) {
kitObj.getContents().add(new KitItem(item)); 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() { private static boolean isInJsonFormat() {