Class ToggleGUIButton

All Implemented Interfaces:
Sizeable

public abstract class ToggleGUIButton extends GUIButton
GUIButton which toggles between on and off
  • Constructor Details

    • ToggleGUIButton

      protected ToggleGUIButton(GUI gui, int cooldown, org.bukkit.Sound sound, String permission, boolean toggled)
      Creates a new ToggleGUIButton
      Parameters:
      gui - The GUI
      permission - The permission required to toggle
      toggled - The default value of the toggled-state
      cooldown - The cooldown of the Button
      sound - The sound played when pressing this button
  • Method Details

    • onClick

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

      public void toggle(ClickData clickData)
      Toggles the state of the Button
      Parameters:
      clickData - The clickData of the action
    • getEnabledItem

      protected abstract org.bukkit.inventory.ItemStack getEnabledItem()
      Returns:
      The Item for the enabled-state
    • getDisabledItem

      protected abstract org.bukkit.inventory.ItemStack getDisabledItem()
      Returns:
      The Item for the disabled-state
    • onToggle

      protected abstract void onToggle(ClickData clickData, boolean toggled)
      Gets called when the Button gets toggled
      Parameters:
      clickData - The clickData of the action
      toggled - The current state