From eb222545642ccf31aabe346f30d2cbe47f5d10a9 Mon Sep 17 00:00:00 2001 From: GunfighterJ Date: Wed, 24 Jul 2013 15:53:48 -0500 Subject: [PATCH] Close inventories before opening any others --- .../com/earth2me/essentials/commands/Commandenderchest.java | 4 +++- .../src/com/earth2me/essentials/commands/Commandinvsee.java | 4 ++-- .../src/com/earth2me/essentials/commands/Commandrecipe.java | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java b/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java index d256e9786..829eeefb1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java @@ -13,15 +13,17 @@ public class Commandenderchest extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception - { + { if (args.length > 0 && user.isAuthorized("essentials.enderchest.others")) { final User invUser = getPlayer(server, user, args, 0); + user.closeInventory(); user.openInventory(invUser.getEnderChest()); user.setEnderSee(true); } else { + user.closeInventory(); user.openInventory(user.getEnderChest()); user.setEnderSee(false); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java index c993217c1..368a03a74 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java @@ -11,9 +11,8 @@ public class Commandinvsee extends EssentialsCommand { super("invsee"); } - - //This method has a hidden param, which if given will display the equip slots. #easteregg + //This method has a hidden param, which if given will display the equip slots. #easteregg @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { @@ -34,6 +33,7 @@ public class Commandinvsee extends EssentialsCommand { inv = invUser.getInventory(); } + user.closeInventory(); user.openInventory(inv); user.setInvSee(true); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java index 5284a5cae..6661233ac 100755 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java @@ -89,6 +89,7 @@ public class Commandrecipe extends EssentialsCommand if (sender instanceof Player) { final User user = ess.getUser(sender); + user.closeInventory(); user.setRecipeSee(true); final InventoryView view = user.openWorkbench(null, true); final String[] recipeShape = recipe.getShape(); @@ -98,7 +99,7 @@ public class Commandrecipe extends EssentialsCommand for (int k = 0; k < recipeShape[j].length(); k++) { final ItemStack item = ingredientMap.get(recipeShape[j].toCharArray()[k]); - if(item == null) + if (item == null) { continue; }