Class CycleItem

java.lang.Object
xyz.xenondevs.invui.item.impl.AbstractItem
xyz.xenondevs.invui.item.impl.CycleItem
All Implemented Interfaces:
Item

public class CycleItem extends AbstractItem
An Item that cycles through a predefined array of ItemProviders when clicked.
  • Constructor Details

    • CycleItem

      public CycleItem(@NotNull @NotNull ItemProvider... states)
    • CycleItem

      public CycleItem(int startState, @NotNull @NotNull ItemProvider... states)
  • Method Details

    • withStateChangeHandler

      public static CycleItem withStateChangeHandler(BiConsumer<org.bukkit.entity.Player,Integer> stateChangeHandler, @NotNull @NotNull ItemProvider... states)
    • withStateChangeHandler

      public static CycleItem withStateChangeHandler(BiConsumer<org.bukkit.entity.Player,Integer> stateChangeHandler, int startState, @NotNull @NotNull ItemProvider... states)
    • getItemProvider

      public ItemProvider getItemProvider()
      Description copied from interface: Item
      Gets the ItemProvider. This method gets called every time a Window is notified (Item.notifyWindows()).
      Returns:
      The ItemProvider
    • handleClick

      public 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)
      Description copied from interface: Item
      A method called if the ItemStack associated to this Item has been clicked by a player.
      Parameters:
      clickType - The ClickType the Player performed.
      player - The Player who clicked on the ItemStack.
      event - The InventoryClickEvent associated with this click.
    • cycle

      public void cycle(boolean forward)
    • handleStateChange

      protected void handleStateChange(@Nullable @Nullable org.bukkit.entity.Player player, int state)
    • getState

      public int getState()