mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-27 03:28:30 +01:00
Fix recipe command
This commit is contained in:
parent
4e399778b4
commit
f57b3595ed
@ -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)));
|
||||
}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user