Class Slider
java.lang.Object
me.despical.inventoryframework.pane.Pane
me.despical.inventoryframework.pane.component.util.VariableBar
me.despical.inventoryframework.pane.component.Slider
- All Implemented Interfaces:
Flippable,Orientable
A slider for a graphical interface into what amount of a whole is set.
- Since:
- 0.5.0
Created at 04.09.2020
- Author:
- Despical
-
Nested Class Summary
Nested classes/interfaces inherited from class me.despical.inventoryframework.pane.Pane
Pane.PriorityNested classes/interfaces inherited from interface me.despical.inventoryframework.pane.Orientable
Orientable.Orientation -
Field Summary
Fields inherited from class me.despical.inventoryframework.pane.component.util.VariableBar
backgroundPane, fillPane, flipHorizontally, flipVertically, orientation, value -
Constructor Summary
ConstructorsConstructorDescriptionSlider(int length, int height) Slider(int x, int y, int length, int height) Slider(int x, int y, int length, int height, @NotNull Pane.Priority priority) -
Method Summary
Modifier and TypeMethodDescriptionbooleanclick(@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 panefloatgetValue()Gets the value as a float in between (0,1) this bar is currently set at.static @NotNull SliderLoads a percentage bar from a given elementvoidsetValue(float value) Sets the value of this bar.Methods inherited from class me.despical.inventoryframework.pane.component.util.VariableBar
clear, display, flipHorizontally, flipVertically, getItems, getOrientation, getPanes, isFlippedHorizontally, isFlippedVertically, setBackgroundItem, setFillItem, setHeight, setLength, setOrientation, setX, setYMethods inherited from class me.despical.inventoryframework.pane.Pane
findMatchingItem, getHeight, getLength, getPriority, getPropertyMappings, getX, getY, isVisible, load, loadItem, registerProperty, setOnClick, setOnLocalClick, setPriority, setVisible
-
Constructor Details
-
Slider
-
Slider
public Slider(int x, int y, int length, int height) -
Slider
public Slider(int length, int height)
-
-
Method Details
-
load
@NotNull @Contract(pure=true) public static @NotNull Slider load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element) Loads a percentage bar from a given element- Parameters:
instance- the instance classelement- the element- Returns:
- the percentage bar
-
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
-
getValue
public float getValue()Gets the value as a float in between (0,1) this bar is currently set at.- Returns:
- the value
- Since:
- 1.0.1
-
setValue
public void setValue(float value) Sets the value of this bar. The value has to be in (0,1). If not, this method will throw anIllegalArgumentException.- Parameters:
value- the new value.- Throws:
IllegalArgumentException- when the value is out of range- Since:
- 1.0.1
-