Class Label
java.lang.Object
com.github.stefvanschie.inventoryframework.pane.Pane
com.github.stefvanschie.inventoryframework.pane.component.Label
-
Nested Class Summary
Nested classes/interfaces inherited from class Pane
Pane.Priority -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new labelCreates a new labelLabel(int length, int height, @NotNull Pane.Priority priority, @NotNull Font font) Creates a new labelLabel(int length, int height, @NotNull Pane.Priority priority, @NotNull Font font, @NotNull Plugin plugin) Creates a new label -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the entire pane of any items/panes.booleanclick(@NotNull Gui gui, @NotNull GuiComponent guiComponent, @NotNull InventoryClickEvent event, @NotNull Slot slot) Called whenever there is being clicked on this pane@NotNull Labelcopy()Makes a copy of this pane and returns it.@NotNull GuiItemContainerdisplay()Returns aGuiItemContainerwith all the items that should be displayed of this pane.@NotNull FontgetFont()Gets the character set currently used for the text in this label@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.@NotNull StringgetText()Gets the text currently displayed in this labelstatic @NotNull LabelLoads a label from a given elementvoidSets the text to be displayed in this label.voidsetText(@NotNull String text, @NotNull BiFunction<? super @NotNull Character, ? super @NotNull ItemStack, ? extends @NotNull GuiItem> processor) Sets the text to be displayed in this label.Methods inherited from class Pane
callOnClick, createBorder, findMatchingItem, getHeight, getLength, getPriority, getUUID, isVisible, load, matchesItem, setHeight, setLength, setOnClick, setPriority, setVisible
-
Constructor Details
-
Label
public Label(int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Font font, @NotNull @NotNull Plugin plugin) Creates a new label- Parameters:
length- the lengthheight- the heightpriority- the priorityfont- the character setplugin- the plugin that will be the owner for this label's items- Since:
- 0.12.0
-
Label
-
Label
public Label(int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Font font) Creates a new label- Parameters:
length- the lengthheight- the heightpriority- the priorityfont- the character set- Since:
- 0.12.0
-
Label
Creates a new label- Parameters:
length- the lengthheight- the heightfont- the character set- Since:
- 0.12.0
-
-
Method Details
-
setText
public void setText(@NotNull @NotNull String text, @NotNull @NotNull BiFunction<? super @NotNull Character, ? super @NotNull ItemStack, ? extends @NotNull GuiItem> processor) Sets the text to be displayed in this label. If this label already had text, this text will be overwritten. The specified processor will be called for each character that is part of the specified text. The provided character will be the original character that was attempted to be shown - it is not subject to any transformations that may be applied for finding a valid item corresponding to this character, such as capitalization changes.- Parameters:
text- the new textprocessor- processes each character before using them- Since:
- 0.10.4
-
setText
Sets the text to be displayed in this label. If this label already had text, this text will be overwritten.- Parameters:
text- the new text- 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. -
click
public boolean click(@NotNull @NotNull Gui gui, @NotNull @NotNull GuiComponent guiComponent, @NotNull @NotNull InventoryClickEvent event, @NotNull @NotNull Slot slot) Description copied from class:PaneCalled whenever there is being clicked on this pane -
display
Description copied from class:PaneReturns aGuiItemContainerwith all the items that should be displayed of this 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.) -
clear
-
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.) -
getText
Gets the text currently displayed in this label- Returns:
- the text in this label
- Since:
- 0.5.0
-
getFont
Gets the character set currently used for the text in this label- Returns:
- the character set
- Since:
- 0.5.0
-
load
@NotNull @Contract(pure=true) public static @NotNull Label load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element, @NotNull @NotNull Plugin plugin) Loads a label 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
-