Package xyz.xenondevs.invui.item
Interface Item
- All Known Implementing Classes:
AbstractItem,AsyncItem,AutoCycleItem,AutoUpdateItem,CommandItem,ControlItem,CycleItem,PageItem,ScrollItem,SimpleItem,SuppliedItem,TabItem
public interface Item
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddWindow(AbstractWindow window) Adds anAbstractWindowto the window set, telling theItemthat it is currently being displayed in thatAbstractWindow.default ItemProviderGets theItemProvider.default ItemProvidergetItemProvider(org.bukkit.entity.Player viewer) Gets theItemProviderfor a specificPlayer.voidhandleClick(@NotNull org.bukkit.event.inventory.ClickType clickType, @NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.event.inventory.InventoryClickEvent event) A method called if theItemStackassociated to thisItemhas been clicked by a player.voidCalls a refresh method on everyWindowin which thisItemis displayed, notifying them that theItemProviderhas been updated, thus theItemStackinside theWindow'sInventoryshould be replaced.voidremoveWindow(AbstractWindow window) Removes anAbstractWindowfrom the window set, telling theItemthat it is no longer being displayed in thatAbstractWindow.
-
Method Details
-
getItemProvider
- Returns:
- The
ItemProvider - Throws:
UnsupportedOperationException- if neither this method norgetItemProvider(Player)is overridden
-
getItemProvider
Gets theItemProviderfor a specificPlayer. This method gets called every time aWindowis notified (notifyWindows()).The default implementation delegates to
getItemProvider()- Parameters:
viewer- the viewer (provides context for rendering player-specific information in the item)- Returns:
- The
ItemProvider
-
addWindow
Adds anAbstractWindowto the window set, telling theItemthat it is currently being displayed in thatAbstractWindow.- Parameters:
window- TheAbstractWindowtheItemis currently displayed in.
-
removeWindow
Removes anAbstractWindowfrom the window set, telling theItemthat it is no longer being displayed in thatAbstractWindow.- Parameters:
window- TheAbstractWindowtheItemis no longer displayed in.
-
getWindows
-
notifyWindows
void notifyWindows()Calls a refresh method on everyWindowin which thisItemis displayed, notifying them that theItemProviderhas been updated, thus theItemStackinside theWindow'sInventoryshould be replaced. -
handleClick
void handleClick(@NotNull @NotNull org.bukkit.event.inventory.ClickType clickType, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent event) A method called if theItemStackassociated to thisItemhas been clicked by a player.- Parameters:
clickType- TheClickTypethePlayerperformed.player- ThePlayerwho clicked on theItemStack.event- TheInventoryClickEventassociated with this click.
-