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 TypeMethodDescriptionvoid
addWindow
(AbstractWindow window) Adds anAbstractWindow
to the window set, telling theItem
that it is currently being displayed in thatAbstractWindow
.default ItemProvider
Gets theItemProvider
.default ItemProvider
getItemProvider
(org.bukkit.entity.Player viewer) Gets theItemProvider
for a specificPlayer
.void
handleClick
(@NotNull org.bukkit.event.inventory.ClickType clickType, @NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.event.inventory.InventoryClickEvent event) A method called if theItemStack
associated to thisItem
has been clicked by a player.void
Calls a refresh method on everyWindow
in which thisItem
is displayed, notifying them that theItemProvider
has been updated, thus theItemStack
inside theWindow
'sInventory
should be replaced.void
removeWindow
(AbstractWindow window) Removes anAbstractWindow
from the window set, telling theItem
that 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 theItemProvider
for a specificPlayer
. This method gets called every time aWindow
is 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 anAbstractWindow
to the window set, telling theItem
that it is currently being displayed in thatAbstractWindow
.- Parameters:
window
- TheAbstractWindow
theItem
is currently displayed in.
-
removeWindow
Removes anAbstractWindow
from the window set, telling theItem
that it is no longer being displayed in thatAbstractWindow
.- Parameters:
window
- TheAbstractWindow
theItem
is no longer displayed in.
-
getWindows
-
notifyWindows
void notifyWindows()Calls a refresh method on everyWindow
in which thisItem
is displayed, notifying them that theItemProvider
has been updated, thus theItemStack
inside theWindow
'sInventory
should 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 theItemStack
associated to thisItem
has been clicked by a player.- Parameters:
clickType
- TheClickType
thePlayer
performed.player
- ThePlayer
who clicked on theItemStack
.event
- TheInventoryClickEvent
associated with this click.
-