diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java index d3ade5a03..b5fd48d5d 100644 --- a/Essentials/src/com/earth2me/essentials/Kit.java +++ b/Essentials/src/com/earth2me/essentials/Kit.java @@ -130,21 +130,35 @@ public class Kit } } - public static List getItems(final User user, final Map kit) throws Exception + public static List getItems(final IEssentials ess, final User user, final Map kit) throws Exception { if (kit == null) { throw new Exception(_("kitNotFound")); } - try { - return (List)kit.get("items"); + final List itemList = new ArrayList(); + final Object kitItems = kit.get("items"); + if (kitItems instanceof List) + { + for (Object item : (List)kitItems) + { + if (item instanceof String) + { + itemList.add(item.toString()); + continue; + } + throw new Exception("Error parsing kit item: " + item.toString()); + } + return itemList; + } + throw new Exception("Error parsing kit: " + kitItems.toString()); } catch (Exception e) { - user.sendMessage(_("kitError2")); - throw new Exception(_("kitErrorHelp"), e); + ess.getLogger().log(Level.WARNING, e.getMessage()); + throw new Exception(_("kitError2"), e); } } @@ -201,14 +215,7 @@ public class Kit catch (Exception e) { user.updateInventory(); - if (ess.getSettings().isDebug()) - { - ess.getLogger().log(Level.WARNING, e.getMessage()); - } - else - { - ess.getLogger().log(Level.WARNING, e.getMessage()); - } + ess.getLogger().log(Level.WARNING, e.getMessage()); throw new Exception(_("kitError2"), e); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index 1c9bec8d3..0cbab8cb6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -56,7 +56,7 @@ public class Commandkit extends EssentialsCommand final String kitName = args[0].toLowerCase(Locale.ENGLISH); final Map kit = ess.getSettings().getKit(kitName); - final List items = Kit.getItems(userTo, kit); + final List items = Kit.getItems(ess, userTo, kit); Kit.expandItems(ess, userTo, items); sender.sendMessage(_("kitGiveTo", kitName, userTo.getDisplayName())); @@ -78,7 +78,7 @@ public class Commandkit extends EssentialsCommand throw new Exception(_("noKitPermission", "essentials.kits." + kitName)); } - final List items = Kit.getItems(userTo, kit); + final List items = Kit.getItems(ess, userTo, kit); Kit.checkTime(userFrom, kitName, kit); diff --git a/Essentials/src/com/earth2me/essentials/signs/SignKit.java b/Essentials/src/com/earth2me/essentials/signs/SignKit.java index 391b23407..5616a969c 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignKit.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignKit.java @@ -60,7 +60,7 @@ public class SignKit extends EssentialsSign { final Map kit = ess.getSettings().getKit(kitName); Kit.checkTime(player, kitName, kit); - final List items = Kit.getItems(player, kit); + final List items = Kit.getItems(ess, player, kit); Kit.expandItems(ess, player, items); charge.charge(player); Trade.log("Sign", "Kit", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess);