From a8a8b529770765cd6e30ecbc6281e361918275c0 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Fri, 21 Dec 2012 03:21:35 +0000 Subject: Swap method order on recipe --- .../essentials/commands/Commandrecipe.java | 42 +++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java index 721ccc857..6f1b6252e 100755 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java @@ -84,7 +84,18 @@ public class Commandrecipe extends EssentialsCommand public void shapedRecipe(CommandSender sender, ShapedRecipe recipe) { Map recipeMap = recipe.getIngredientMap(); - if (!(sender instanceof Player)) + if (sender instanceof Player) + { + User user = ess.getUser(sender); + user.setRecipeSee(true); + InventoryView view = user.openWorkbench(null, true); + for (Entry e : ((ShapedRecipe)recipe).getIngredientMap().entrySet()) + { + view.setItem(" abcdefghi".indexOf(e.getKey()), e.getValue()); + } + + } + else { HashMap colorMap = new HashMap(); int i = 1; @@ -116,22 +127,23 @@ public class Commandrecipe extends EssentialsCommand } sender.sendMessage(_("recipeWhere", s.toString())); } - else + } + + public void shapelessRecipe(CommandSender sender, ShapelessRecipe recipe) + { + List ingredients = recipe.getIngredientList(); + if (sender instanceof Player) { User user = ess.getUser(sender); user.setRecipeSee(true); InventoryView view = user.openWorkbench(null, true); - for (Entry e : ((ShapedRecipe)recipe).getIngredientMap().entrySet()) + for (int i = 0; i < ingredients.size(); i++) { - view.setItem(" abcdefghi".indexOf(e.getKey()), e.getValue()); + view.setItem(i + 1, ingredients.get(i)); } - } - } - public void shapelessRecipe(CommandSender sender, ShapelessRecipe recipe) - { - List ingredients = recipe.getIngredientList(); - if (!(sender instanceof Player)) + } + else { StringBuilder s = new StringBuilder(); for (int i = 0; i < ingredients.size(); i++) @@ -145,16 +157,6 @@ public class Commandrecipe extends EssentialsCommand } sender.sendMessage(_("recipeShapeless", s.toString())); } - else - { - User user = ess.getUser(sender); - user.setRecipeSee(true); - InventoryView view = user.openWorkbench(null, true); - for (int i = 0; i < ingredients.size(); i++) - { - view.setItem(i + 1, ingredients.get(i)); - } - } } public String getMaterialName(ItemStack stack) -- cgit v1.2.3