summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Ward <chris@chrisgward.com>2012-12-20 01:35:55 +1100
committerChris Ward <chris@chrisgward.com>2012-12-20 01:35:55 +1100
commitf57b3595ed7d3afaac141b9d73e767f7a628aa96 (patch)
tree9ecb400708b787c5f424a5b690de86182a2a9abf
parent4e399778b4ca83a8371cf426e44094a27a6ebbba (diff)
downloadEssentials-f57b3595ed7d3afaac141b9d73e767f7a628aa96.tar
Essentials-f57b3595ed7d3afaac141b9d73e767f7a628aa96.tar.gz
Essentials-f57b3595ed7d3afaac141b9d73e767f7a628aa96.tar.lz
Essentials-f57b3595ed7d3afaac141b9d73e767f7a628aa96.tar.xz
Essentials-f57b3595ed7d3afaac141b9d73e767f7a628aa96.zip
Fix recipe command
-rwxr-xr-xEssentials/src/com/earth2me/essentials/commands/Commandrecipe.java24
-rw-r--r--Essentials/src/messages.properties2
-rw-r--r--Essentials/src/messages_cs.properties2
-rw-r--r--Essentials/src/messages_da.properties2
-rw-r--r--Essentials/src/messages_de.properties2
-rw-r--r--Essentials/src/messages_en.properties2
-rw-r--r--Essentials/src/messages_es.properties2
-rw-r--r--Essentials/src/messages_fi.properties2
-rw-r--r--Essentials/src/messages_fr.properties2
-rw-r--r--Essentials/src/messages_it.properties2
-rw-r--r--Essentials/src/messages_nl.properties2
-rw-r--r--Essentials/src/messages_pl.properties2
-rw-r--r--Essentials/src/messages_pt.properties2
-rw-r--r--Essentials/src/messages_se.properties2
14 files changed, 30 insertions, 20 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java
index 80f7ed71a..721ccc857 100755
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java
@@ -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)));
}
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index 170f4b371..cec54fb85 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -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}
diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties
index 37a2e5c78..486c085cb 100644
--- a/Essentials/src/messages_cs.properties
+++ b/Essentials/src/messages_cs.properties
@@ -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}
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index bf8105ea6..f69dc4ebb 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -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}
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 1e4af4cb6..2d2284542 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -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}
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index 170f4b371..cec54fb85 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -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}
diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties
index c9eb4562e..7915968fb 100644
--- a/Essentials/src/messages_es.properties
+++ b/Essentials/src/messages_es.properties
@@ -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}
diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties
index ccfe32b4b..05da0a0d6 100644
--- a/Essentials/src/messages_fi.properties
+++ b/Essentials/src/messages_fi.properties
@@ -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}
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 1a45b51c4..82566c31e 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -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}
diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties
index c6ee3e5d8..c8bcdd711 100644
--- a/Essentials/src/messages_it.properties
+++ b/Essentials/src/messages_it.properties
@@ -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}
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index 589ca60e1..07c85443e 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -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}
diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties
index 9b9ff06b8..4c666c1cc 100644
--- a/Essentials/src/messages_pl.properties
+++ b/Essentials/src/messages_pl.properties
@@ -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}
diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties
index a0ebd8ad5..8db1a6bc4 100644
--- a/Essentials/src/messages_pt.properties
+++ b/Essentials/src/messages_pt.properties
@@ -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}
diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties
index 4b8f5ae4e..fde632b89 100644
--- a/Essentials/src/messages_se.properties
+++ b/Essentials/src/messages_se.properties
@@ -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}