diff --git a/src/com/dre/brewery/BIngredients.java b/src/com/dre/brewery/BIngredients.java index 6daec83..2a7874b 100644 --- a/src/com/dre/brewery/BIngredients.java +++ b/src/com/dre/brewery/BIngredients.java @@ -1,8 +1,10 @@ package com.dre.brewery; import java.util.ArrayList; +import java.util.HashSet; import java.util.Map; import java.util.HashMap; +import java.util.Set; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.inventory.ItemStack; @@ -11,7 +13,7 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.inventory.meta.PotionMeta; public class BIngredients { - public static ArrayList possibleIngredients = new ArrayList(); + public static Set possibleIngredients = new HashSet(); public static ArrayList recipes = new ArrayList(); public static Map cookedNames = new HashMap(); private static int lastId = 0; diff --git a/src/com/dre/brewery/BRecipe.java b/src/com/dre/brewery/BRecipe.java index 6d1f8bf..320a832 100644 --- a/src/com/dre/brewery/BRecipe.java +++ b/src/com/dre/brewery/BRecipe.java @@ -72,6 +72,7 @@ public class BRecipe { if (mat != null) { ItemStack stack = new ItemStack(mat, P.p.parseInt(ingredParts[1]), durability); this.ingredients.add(stack); + BIngredients.possibleIngredients.add(mat); } else { P.p.errorLog("Unknown Material: " + ingredParts[0]); this.ingredients = null; diff --git a/src/com/dre/brewery/P.java b/src/com/dre/brewery/P.java index e1d95fd..c69fabb 100644 --- a/src/com/dre/brewery/P.java +++ b/src/com/dre/brewery/P.java @@ -70,7 +70,15 @@ public class P extends JavaPlugin { String v = Bukkit.getBukkitVersion(); useUUID = !v.matches(".*1\\.[1-6].*") && !v.matches(".*1\\.7\\.[0-5].*"); - if (!readConfig()) { + // load the Config + try { + if (!readConfig()) { + p = null; + getServer().getPluginManager().disablePlugin(this); + return; + } + } catch (Exception e) { + e.printStackTrace(); p = null; getServer().getPluginManager().disablePlugin(this); return; @@ -161,7 +169,18 @@ public class P extends JavaPlugin { } // load the Config - readConfig(); + try { + if (!readConfig()) { + p = null; + getServer().getPluginManager().disablePlugin(this); + return; + } + } catch (Exception e) { + e.printStackTrace(); + p = null; + getServer().getPluginManager().disablePlugin(this); + return; + } // save and load LanguageReader languageReader.save();