Class ToggleButton
java.lang.Object
me.despical.inventoryframework.pane.Pane
me.despical.inventoryframework.pane.component.ToggleButton
A button that toggles between an enabled and disabled state.
- Since:
- 1.0.1
Created at 04.09.2020
- Author:
- Despical
-
Nested Class Summary
Nested classes/interfaces inherited from class me.despical.inventoryframework.pane.Pane
Pane.Priority -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionToggleButton(int length, int height) ToggleButton(int x, int y, int length, int height) ToggleButton(int x, int y, int length, int height, @NotNull Pane.Priority priority) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the entire pane of any items/panes.booleanclick(@NotNull Gui gui, @NotNull org.bukkit.event.inventory.InventoryClickEvent event, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Called whenever there is being clicked on this panevoiddisplay(@NotNull Gui gui, @NotNull org.bukkit.inventory.Inventory inventory, @NotNull org.bukkit.inventory.PlayerInventory playerInventory, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Has to set all the items in the right spot inside the inventory@NotNull Collection<GuiItem> getItems()Gets all the items in this pane and all underlying panes.@NotNull Collection<Pane> getPanes()Gets all the panes in this panes, including any child panes from other panes.static @NotNull ToggleButtonLoads a toggle button from an XML elementvoidsetDisabledItem(@NotNull GuiItem item) Sets the item to use when the button is set to disabledvoidsetEnabledItem(@NotNull GuiItem item) Sets the item to use when the button is set to enabledvoidtoggle()Toggles between the enabled and disabled statesMethods inherited from class me.despical.inventoryframework.pane.Pane
findMatchingItem, getHeight, getLength, getPriority, getPropertyMappings, getX, getY, isVisible, load, loadItem, registerProperty, setHeight, setLength, setOnClick, setOnLocalClick, setPriority, setVisible, setX, setY
-
Constructor Details
-
ToggleButton
-
ToggleButton
public ToggleButton(int length, int height) -
ToggleButton
public ToggleButton(int x, int y, int length, int height)
-
-
Method Details
-
load
@NotNull @Contract(pure=true) public static @NotNull ToggleButton load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element) Loads a toggle button from an XML element- Parameters:
instance- the instance classelement- the element- Returns:
- the toggle button
- Since:
- 1.0.1
-
display
public void display(@NotNull @NotNull Gui gui, @NotNull @NotNull org.bukkit.inventory.Inventory inventory, @NotNull @NotNull org.bukkit.inventory.PlayerInventory playerInventory, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Description copied from class:PaneHas to set all the items in the right spot inside the inventory- Specified by:
displayin classPane- Parameters:
gui- the gui for which we're renderinginventory- the inventory that the items should be displayed inplayerInventory- the player's inventorypaneOffsetX- the pane's offset on the x axispaneOffsetY- the pane's offset on the y axismaxLength- the maximum length of the panemaxHeight- the maximum height of the pane
-
click
public boolean click(@NotNull @NotNull Gui gui, @NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent event, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Description copied from class:PaneCalled whenever there is being clicked on this pane- Specified by:
clickin classPane- Parameters:
gui- the gui this event stems fromevent- the event that occurred while clicking on this itempaneOffsetX- the pane's offset on the x axispaneOffsetY- the pane's offset on the y axismaxLength- the maximum length of the panemaxHeight- the maximum height of the pane- Returns:
- whether the item was found or not
-
setDisabledItem
Sets the item to use when the button is set to disabled- Parameters:
item- the disabled item- Since:
- 1.0.1
-
setEnabledItem
Sets the item to use when the button is set to enabled- Parameters:
item- the enabled item- Since:
- 1.0.1
-
getItems
Description copied from class:PaneGets all the items in this pane and all underlying panes. The returned collection is not guaranteed to be mutable or to be a view of the underlying data. (So changes to the gui are not guaranteed to be visible in the returned value.) -
getPanes
Description copied from class:PaneGets all the panes in this panes, including any child panes from other panes. The returned collection is not guaranteed to be mutable or to be a view of the underlying data. (So changes to the gui are not guaranteed to be visible in the returned value.) -
toggle
public void toggle()Toggles between the enabled and disabled states- Since:
- 1.0.1
-
clear
public void clear()Description copied from class:PaneClears the entire pane of any items/panes. Underlying panes will not be cleared.
-