Type Parameters:
E - The Enum
All Implemented Interfaces:
Sizeable

public abstract class CycleGUIButton<E extends CycleEnum> extends GUIButton
GUIButton which cycles through values of an Enum
  • Constructor Details

    • CycleGUIButton

      public CycleGUIButton(GUI gui, int cooldown, org.bukkit.Sound sound, E[] values, E startValue)
      Creates a new CycleGUIButton. The permission is passed in the various enum values.
      Parameters:
      gui - The GUI
      values - The Enum values
      startValue - The Start-value
      cooldown - The cooldown of the Button. Applied to the material, not the Button alone.
      sound - The sound that is played when pressing that button
  • Method Details

    • getItem

      protected org.bukkit.inventory.ItemStack getItem(E value)
      Returns the Item to be displayed for an Enum-value Can be overridden for modifying Enum-Item-conversion
      Parameters:
      value - The Enum-value
      Returns:
      The according ItemStack
    • onClick

      public void onClick(ClickData data)
      Description copied from class: GUIButton
      Is called when the player clicks on the Button no matter how.
      Specified by:
      onClick in class GUIButton
      Parameters:
      data - The ClickData
    • cycle

      public void cycle(ClickData data)
      Cycles the Values
      Parameters:
      data - The clickData if the click event
    • onCycle

      protected abstract void onCycle(ClickData data, E newValue)
      Is called when cycling through the Enum-values
      Parameters:
      data - The ClickData
      newValue - The new Enum-value