Class AutoCycleItem

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

public class AutoCycleItem extends AbstractItem
An Item that automatically cycles through a predefined array of ItemProvider at a predefined speed.
  • Constructor Details

    • AutoCycleItem

      public AutoCycleItem(int period, ItemProvider... itemProviders)
  • Method Details

    • start

      public void start()
    • cancel

      public void cancel()
    • 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
    • addWindow

      public void addWindow(AbstractWindow window)
      Description copied from interface: Item
      Adds an AbstractWindow to the window set, telling the Item that it is currently being displayed in that AbstractWindow.
      Specified by:
      addWindow in interface Item
      Overrides:
      addWindow in class AbstractItem
      Parameters:
      window - The AbstractWindow the Item is currently displayed in.
    • removeWindow

      public void removeWindow(AbstractWindow window)
      Description copied from interface: Item
      Removes an AbstractWindow from the window set, telling the Item that it is no longer being displayed in that AbstractWindow.
      Specified by:
      removeWindow in interface Item
      Overrides:
      removeWindow in class AbstractItem
      Parameters:
      window - The AbstractWindow the Item is no longer displayed in.
    • 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.