Class PercentageBar
java.lang.Object
com.github.stefvanschie.inventoryframework.pane.Pane
com.github.stefvanschie.inventoryframework.pane.component.util.VariableBar
com.github.stefvanschie.inventoryframework.pane.component.PercentageBar
- All Implemented Interfaces:
Flippable,Orientable
A percentage bar for a graphical interface into what amount of a whole is set.
- Since:
- 0.5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
Pane.PriorityNested classes/interfaces inherited from interface com.github.stefvanschie.inventoryframework.pane.Orientable
Orientable.Orientation -
Field Summary
Fields inherited from class com.github.stefvanschie.inventoryframework.pane.component.util.VariableBar
backgroundPane, fillPane, flipHorizontally, flipVertically, orientation, value -
Constructor Summary
ConstructorsConstructorDescriptionPercentageBar(int length, int height) PercentageBar(int x, int y, int length, int height) PercentageBar(int x, int y, int length, int height, @NotNull Pane.Priority priority) PercentageBar(int x, int y, int length, int height, @NotNull Pane.Priority priority, @NotNull Plugin plugin) Creates a new percentage barPercentageBar(int x, int y, int length, int height, @NotNull Plugin plugin) Creates a new percentage barPercentageBar(int length, int height, @NotNull Plugin plugin) Creates a new percentage barPercentageBar(@NotNull Slot slot, int length, int height) Creates a new percentage barPercentageBar(@NotNull Slot slot, int length, int height, @NotNull Pane.Priority priority) Creates a new percentage barPercentageBar(@NotNull Slot slot, int length, int height, @NotNull Pane.Priority priority, @NotNull Plugin plugin) Creates a new percentage barPercentageBar(@NotNull Slot slot, int length, int height, @NotNull Plugin plugin) Creates a new percentage bar -
Method Summary
Modifier and TypeMethodDescriptionbooleanclick(@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 PercentageBarcopy()Makes a copy of this pane and returns it.floatGets the percentage as a float in between (0,1) this bar is currently set at.static @NotNull PercentageBarDeprecated.static @NotNull PercentageBarLoads a percentage bar from a given elementvoidsetPercentage(float percentage) Sets the percentage of this bar.Methods inherited from class com.github.stefvanschie.inventoryframework.pane.component.util.VariableBar
applyContents, clear, display, flipHorizontally, flipVertically, getItems, getOrientation, getPanes, isFlippedHorizontally, isFlippedVertically, setBackgroundItem, setFillItem, setHeight, setLength, setOrientation, setValueMethods inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
callOnClick, createBorder, createBorder, findMatchingItem, getHeight, getLength, getPriority, getSlot, getUUID, getX, getY, isVisible, load, loadItem, loadItem, registerProperty, setOnClick, setPriority, setSlot, setVisible, setX, setY
-
Constructor Details
-
PercentageBar
public PercentageBar(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Plugin plugin) Creates a new percentage bar- Parameters:
slot- the slot of the barlength- the length of the barheight- the height of the barpriority- the priority of the barplugin- the plugin that will be the owner for this percentage bar's items- Since:
- 0.10.8
-
PercentageBar
public PercentageBar(int x, int y, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Plugin plugin) Creates a new percentage bar- Parameters:
x- the x coordinate of the bary- the y coordinate of the barlength- the length of the barheight- the height of the barpriority- the priority of the barplugin- the plugin that will be the owner for this percentage bar's items- Since:
- 0.10.8
-
PercentageBar
public PercentageBar(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Plugin plugin) Creates a new percentage bar- Parameters:
slot- the slot of the barlength- the length of the barheight- the height of the barplugin- the plugin that will be the owner for this percentage bar's items- Since:
- 0.10.8
-
PercentageBar
Creates a new percentage bar- Parameters:
x- the x coordinate of the bary- the y coordinate of the barlength- the length of the barheight- the height of the barplugin- the plugin that will be the owner for this percentage bar's items- Since:
- 0.10.8
-
PercentageBar
Creates a new percentage bar- Parameters:
length- the length of the barheight- the height of the barplugin- the plugin that will be the owner for this percentage bar's items- Since:
- 0.10.8
-
PercentageBar
public PercentageBar(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Pane.Priority priority) Creates a new percentage bar- Parameters:
slot- the slot of the barlength- the length of the barheight- the height of the barpriority- the priority of the bar- Since:
- 0.10.8
-
PercentageBar
public PercentageBar(int x, int y, int length, int height, @NotNull @NotNull Pane.Priority priority) -
PercentageBar
Creates a new percentage bar- Parameters:
slot- the slot of the barlength- the length of the barheight- the height of the bar- Since:
- 0.10.8
-
PercentageBar
public PercentageBar(int x, int y, int length, int height) -
PercentageBar
public PercentageBar(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
-
setPercentage
public void setPercentage(float percentage) Sets the percentage of this bar. The percentage has to be in (0,1). If not, this method will throw anIllegalArgumentException.- Parameters:
percentage- the new percentage.- Throws:
IllegalArgumentException- when the percentage is out of range- Since:
- 0.5.0
- See Also:
-
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. -
getPercentage
public float getPercentage()Gets the percentage as a float in between (0,1) this bar is currently set at.- Returns:
- the percentage
- Since:
- 0.5.0
-
load
@NotNull @Contract(pure=true) public static @NotNull PercentageBar load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element, @NotNull @NotNull Plugin plugin) Loads a percentage bar from a given element- Parameters:
instance- the instance classelement- the elementplugin- the plugin that will be the owner of the underlying items- Returns:
- the percentage bar
- Since:
- 0.10.8
-
load
@NotNull @Contract(pure=true) @Deprecated public static @NotNull PercentageBar 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 percentage bar from a given element- Parameters:
instance- the instance classelement- the element- Returns:
- the percentage bar
-
load(Object, Element, Plugin)