mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-09 20:41:23 +01:00
Swap method order on recipe
This commit is contained in:
parent
226a75472c
commit
a8a8b52977
@ -84,7 +84,18 @@ public class Commandrecipe extends EssentialsCommand
|
||||
public void shapedRecipe(CommandSender sender, ShapedRecipe recipe)
|
||||
{
|
||||
Map<Character, ItemStack> 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<Character, ItemStack> e : ((ShapedRecipe)recipe).getIngredientMap().entrySet())
|
||||
{
|
||||
view.setItem(" abcdefghi".indexOf(e.getKey()), e.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
HashMap<Material, String> colorMap = new HashMap<Material, String>();
|
||||
int i = 1;
|
||||
@ -116,22 +127,23 @@ public class Commandrecipe extends EssentialsCommand
|
||||
}
|
||||
sender.sendMessage(_("recipeWhere", s.toString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
User user = ess.getUser(sender);
|
||||
user.setRecipeSee(true);
|
||||
InventoryView view = user.openWorkbench(null, true);
|
||||
for (Entry<Character, ItemStack> e : ((ShapedRecipe)recipe).getIngredientMap().entrySet())
|
||||
{
|
||||
view.setItem(" abcdefghi".indexOf(e.getKey()), e.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void shapelessRecipe(CommandSender sender, ShapelessRecipe recipe)
|
||||
{
|
||||
List<ItemStack> ingredients = recipe.getIngredientList();
|
||||
if (!(sender instanceof Player))
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user