Class CycleButton
java.lang.Object
com.github.stefvanschie.inventoryframework.pane.Pane
com.github.stefvanschie.inventoryframework.pane.component.CycleButton
A button for cycling between different options
- Since:
- 0.5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
Pane.Priority -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCycleButton(int length, int height) CycleButton(int x, int y, int length, int height) CycleButton(int x, int y, int length, int height, @NotNull Pane.Priority priority) CycleButton(@NotNull Slot slot, int length, int height) Creates a new cycle buttonCycleButton(@NotNull Slot slot, int length, int height, @NotNull Pane.Priority priority) Creates a new cycle button -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a pane to the current list of optionsvoidAdds a pane to the current list of optionsvoidclear()Clears the entire pane of any items/panes.booleanclick(@NotNull Gui gui, @NotNull InventoryComponent inventoryComponent, @NotNull InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Called whenever there is being clicked on this pane@NotNull CycleButtoncopy()Makes a copy of this pane and returns it.voidcycle()Cycles through one option, making it go to the next onevoiddisplay(@NotNull InventoryComponent inventoryComponent, 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 CycleButtonDeprecated.static @NotNull CycleButtonLoads a cycle button from a given elementMethods inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
callOnClick, createBorder, createBorder, findMatchingItem, getHeight, getLength, getPriority, getSlot, getUUID, getX, getY, isVisible, load, loadItem, loadItem, matchesItem, registerProperty, setHeight, setLength, setOnClick, setPriority, setSlot, setVisible, setX, setY
-
Constructor Details
-
CycleButton
public CycleButton(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Pane.Priority priority) Creates a new cycle button- Parameters:
slot- the slot of the buttonlength- the length of the buttonheight- the height of the buttonpriority- the priority of the button- Since:
- 0.10.8
-
CycleButton
-
CycleButton
Creates a new cycle button- Parameters:
slot- the slot of the buttonlength- the length of the buttonheight- the height of the button- Since:
- 0.10.8
-
CycleButton
public CycleButton(int x, int y, int length, int height) -
CycleButton
public CycleButton(int length, int height)
-
-
Method Details
-
click
public boolean click(@NotNull @NotNull Gui gui, @NotNull @NotNull InventoryComponent inventoryComponent, @NotNull @NotNull InventoryClickEvent event, int slot, 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 in which was clickedinventoryComponent- the inventory component in which this pane residesevent- the event that occurred while clicking on this itemslot- the slot that was clicked inpaneOffsetX- 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
-
display
public void display(@NotNull @NotNull InventoryComponent inventoryComponent, 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:
inventoryComponent- the inventory component in which the items should be displayedpaneOffsetX- 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
-
copy
Description copied from class:PaneMakes a copy of this pane and returns it. This makes a deep copy of the pane. This entails that the underlying panes and/or items will be copied as well. The returned pane will never be reference equal to the current pane. -
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.) -
addPane
Adds a pane to the current list of options- Parameters:
index- the index to insert the pane atpane- the pane to add- Since:
- 0.5.0
-
addPane
Adds a pane to the current list of options- Parameters:
pane- the pane to add- Since:
- 0.5.0
-
clear
public void clear()Description copied from class:PaneClears the entire pane of any items/panes. Underlying panes will not be cleared. -
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.) -
cycle
public void cycle()Cycles through one option, making it go to the next one- Since:
- 0.5.0
-
load
@NotNull public static @NotNull CycleButton load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element, @NotNull @NotNull Plugin plugin) Loads a cycle button from a given element- Parameters:
instance- the instance classelement- the elementplugin- the plugin that will be the owner of the underlying items- Returns:
- the cycle button
- Since:
- 0.10.8
-
load
@NotNull @Deprecated public static @NotNull CycleButton load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element) Deprecated.this method is no longer used internally and has been superseded byload(Object, Element, Plugin)Loads a cycle button from a given element- Parameters:
instance- the instance classelement- the element- Returns:
- the cycle button
- Since:
- 0.5.0
-
load(Object, Element, Plugin)