-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
git-Spigot-4f661b2-d06991d
-
Yes
When using the Player.openInventory(Inventory) method, you are not able to open the inventories manually created with Server.createInventory(InventoryHolder, InventoryType) with the following inventory types: CARTOGRAPHY, CRAFTING, CREATIVE, GRINDSTONE, LECTERN, LOOM, MERCHANT, The openinventorylogs.txt file shows the console output of the exception that is generated.
To replicate this, upload the BugTestingPlugin.jar plugin to your server and run the command /openInventory with one of the inventory types listed above as the first argument.
Ex. /openInventory LOOM
This will generate the internal error associated with this exception. To verify that the command works properly, run "/openInventory ANVIL" to show that it does in fact open other inventory types.
Here's some of the example code that has been causing this issue:
InventoryType it = InventoryType.valueOf(args[0]); if (it == null) { sender.sendMessage("Please specify a valid inventory type."); return true; } Player p = (Player) sender; Inventory i = Bukkit.getServer().createInventory(null, it); p.openInventory(i);
(I did a check prior to make sure the sender was a player.)
While I might understand not being able to open a crafting or creative inventory through this method, all of the other inventories listed should be accessible without generating this exception.