InventoryOpener is an interface used by SmartInvs to open the inventories. When an inventory is trying to be opened for a player, the InventoryManager will try to find an InventoryOpener that supports the InventoryType of the inventory, if no opener is found, the inventory will not be opened and an exception will be thrown.
This is the list of the InventoryOpeners currently supported by SmartInvs:
If the inventory type you need to open is not supported by default, you can define your own support by creating a new Inventory Opener, to do this, you need to implement the InventoryOpener interface, like this:
publicclassCustomInventoryOpenerimplementsInventoryOpener{@OverridepublicInventoryopen(SmartInventoryinv,Playerplayer){InventoryManager manager =SmartInvsPlugin.manager();Inventory handle =Bukkit.createCustomInventory(player,inv.getRows()*inv.getColumns(),inv.getTitle());fill(handle,manager.getContents(player).get());player.openInventory(handle);return handle;}@Overridepublicbooleansupports(InventoryTypetype){return type ==InventoryType.CUSTOM;}}
(The InventoryType.CUSTOM and the Bukkit.createCustomInventory methods don't exist, it's just for the example)
Then, when your InventoryOpener is done, register it using:
And it's all, now SmartInvs will handle all the other things for you!