Class GuiActionButton

java.lang.Object
dev.esophose.playerparticles.gui.GuiActionButton

public class GuiActionButton
extends java.lang.Object
  • Constructor Details

    • GuiActionButton

      public GuiActionButton​(int slot, org.bukkit.inventory.ItemStack itemStack, GuiActionButton.GuiActionButtonClickCallback onClick)
      Constructor for creating a non-animated item from an already created ItemStack
      Parameters:
      slot - The slot ID of the inventory
      itemStack - The ItemStack to display
      onClick - The callback to execute when this button is clicked
    • GuiActionButton

      public GuiActionButton​(int slot, org.bukkit.Material[] icons, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)
      Constructor for creating animated icons
      Parameters:
      slot - The slot ID of the inventory
      icons - The Materials that this icon will cycle through
      name - The name that this icon will use
      lore - The lore of this icon
      onClick - The callback to execute when this button is clicked
    • GuiActionButton

      public GuiActionButton​(int slot, org.bukkit.Material icon, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)
      Constructor for creating non-animated icons
      Parameters:
      slot - The slot ID of the inventory
      icon - The Material that this icon will use
      name - The name that this icon will use
      lore - The lore of this icon
      onClick - The callback to execute when this button is clicked
    • GuiActionButton

      public GuiActionButton​(int slot, GuiInventoryEditData.ColorData[] iconColors, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)
      Constructor for creating animated icons using dyes
      Parameters:
      slot - The slot ID of the inventory
      iconColors - The ColorData that this icon will cycle through
      name - The name that this icon will use
      lore - The lore of this icon
      onClick - The callback to execute when this button is clicked
    • GuiActionButton

      public GuiActionButton​(int slot, GuiInventoryEditData.ColorData iconColor, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)
      Constructor for creating non-animated icons using dyes
      Parameters:
      slot - The slot ID of the inventory
      iconColor - The ColorData that this icon will use
      name - The name that this icon will use
      lore - The lore of this icon
      onClick - The callback to execute when this button is clicked
  • Method Details

    • getSlot

      public int getSlot()
      Gets the slot this GuiActionButton occupies in the GuiInventory
      Returns:
      The slot this GuiActionButton occupies in the GuiInventory
    • getIcon

      public org.bukkit.inventory.ItemStack getIcon​(PPlayer pplayer)
      Gets the ItemStack icon that goes into the GUI
      Parameters:
      pplayer - The PPlayer that is viewing the icon
      Returns:
      The icon ItemStack for the GUI
    • handleClick

      public void handleClick​(boolean isShiftClick)
      Executes the onClick callback passed in the constructor
      Parameters:
      isShiftClick - If the player was holding shift when they clicked
    • onTick

      public void onTick()
      Ticked at an interval to allow the icon/name to update
    • isTickable

      public boolean isTickable()
      Checks if this GuiActionButton has more than one icon/name that it can cycle through
      Returns:
      If this GuiActionButton has more than one icon/name
    • parseLore

      public static java.util.List<java.lang.String> parseLore​(PPlayer pplayer, java.lang.String... lore)
      Builds lore from a list of Strings Parses \n as a new lore line Ignores empty lore lines
      Parameters:
      pplayer - The PPlayer viewing the lore
      lore - The lines of lore
      Returns:
      A parsed list of lore text