Fix recipe command

This commit is contained in:
Chris Ward 2012-12-20 01:35:55 +11:00
parent 4e399778b4
commit f57b3595ed
14 changed files with 30 additions and 20 deletions

View File

@ -86,21 +86,31 @@ public class Commandrecipe extends EssentialsCommand
Map<Character, ItemStack> recipeMap = recipe.getIngredientMap();
if (!(sender instanceof Player))
{
HashMap<ItemStack, String> colorMap = new HashMap<ItemStack, String>();
HashMap<Material, String> colorMap = new HashMap<Material, String>();
int i = 1;
for (Character c : "abcdefghi".toCharArray())
{
if (!colorMap.containsKey(recipeMap.get(c)))
ItemStack item = recipeMap.get(c);
if (!colorMap.containsKey(item == null ? null : item.getType()))
{
colorMap.put(recipeMap.get(c), String.valueOf(i++));
colorMap.put(item == null ? null : item.getType(), String.valueOf(i++));
}
}
sender.sendMessage(_("recipeGrid", colorMap.get(recipeMap.get('a')), colorMap.get(recipeMap.get('b')), colorMap.get(recipeMap.get('c'))));
sender.sendMessage(_("recipeGrid", colorMap.get(recipeMap.get('d')), colorMap.get(recipeMap.get('e')), colorMap.get(recipeMap.get('f'))));
sender.sendMessage(_("recipeGrid", colorMap.get(recipeMap.get('g')), colorMap.get(recipeMap.get('h')), colorMap.get(recipeMap.get('i'))));
Material[][] materials = new Material[3][3];
for (int j = 0; j < recipe.getShape().length; j++)
{
for (int k = 0; k < recipe.getShape()[j].length(); k++)
{
ItemStack item = recipe.getIngredientMap().get(recipe.getShape()[j].toCharArray()[k]);
materials[j][k] = item == null ? null : item.getType();
}
}
sender.sendMessage(_("recipeGrid", colorMap.get(materials[0][0]), colorMap.get(materials[0][1]), colorMap.get(materials[0][2])));
sender.sendMessage(_("recipeGrid", colorMap.get(materials[1][0]), colorMap.get(materials[1][1]), colorMap.get(materials[1][2])));
sender.sendMessage(_("recipeGrid", colorMap.get(materials[2][0]), colorMap.get(materials[2][1]), colorMap.get(materials[2][2])));
StringBuilder s = new StringBuilder();
for (ItemStack items : colorMap.keySet().toArray(new ItemStack[colorMap.size()]))
for (Material items : colorMap.keySet().toArray(new Material[colorMap.size()]))
{
s.append(_("recipeGridItem", colorMap.get(items), getMaterialName(items)));
}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -474,10 +474,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}

View File

@ -471,10 +471,10 @@ recipeNone=No recipes exist for {0}
invalidNumber=Invalid Number
recipeBadIndex=There is no recipe by that number
recipeNothing=nothing
recipeShapeless=\u00a7eCombine \u00a7c{0}
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2})
recipeFurnace=\u00a76Smelt \u00a7c{0}
recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}