Allow all ingedients of recipes into the cauldron

This commit is contained in:
Sn0wStorm 2015-03-16 16:31:45 +01:00
parent b8e0f1f38b
commit 82837e1977
3 changed files with 25 additions and 3 deletions

View File

@ -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<Material> possibleIngredients = new ArrayList<Material>();
public static Set<Material> possibleIngredients = new HashSet<Material>();
public static ArrayList<BRecipe> recipes = new ArrayList<BRecipe>();
public static Map<Material, String> cookedNames = new HashMap<Material, String>();
private static int lastId = 0;

View File

@ -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;

View File

@ -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();