Class OutlinePane
java.lang.Object
me.despical.inventoryframework.pane.Pane
me.despical.inventoryframework.pane.OutlinePane
- All Implemented Interfaces:
Flippable,Orientable,Rotatable
- Direct Known Subclasses:
Label
A pane for items that should be outlined
- 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.PriorityNested classes/interfaces inherited from interface me.despical.inventoryframework.pane.Orientable
Orientable.Orientation -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionOutlinePane(int length, int height) OutlinePane(int x, int y, int length, int height) OutlinePane(int x, int y, int length, int height, @NotNull Pane.Priority priority) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a gui item at the specific spot in the panevoidApplies a custom mask to this pane.voidclear()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 inventorybooleanGets whether this outline pane repeats itselfvoidflipHorizontally(boolean flipHorizontally) Sets whether this pane should flip its items horizontallyvoidflipVertically(boolean flipVertically) Sets whether this pane should flip its items verticallyintgetGap()Gets the gap of the panegetItems()Gets all the items in this pane and all underlying panes.@NotNull Orientable.OrientationGets the orientation of this outline pane@NotNull Collection<Pane> getPanes()Gets all the panes in this panes, including any child panes from other panes.intGets the rotation specified to this pane.voidinsertItem(@NotNull GuiItem item, int index) Adds a gui item in the specified indexbooleanGets whether this pane's items are flipped horizontallybooleanGets whether this pane's items are flipped verticallystatic @NotNull OutlinePaneLoads an outline pane from a given elementvoidremoveItem(@NotNull GuiItem item) Removes the specified item from the panevoidsetGap(int gap) Sets the gap of the panevoidsetOrientation(@NotNull Orientable.Orientation orientation) Sets the orientation of this outline panevoidsetRepeat(boolean repeat) Sets whether this pane should repeat itselfvoidsetRotation(int rotation) Sets the rotation of this pane.Methods 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
-
OutlinePane
-
OutlinePane
public OutlinePane(int x, int y, int length, int height) -
OutlinePane
public OutlinePane(int length, int height)
-
-
Method Details
-
load
@NotNull public static @NotNull OutlinePane load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element) Loads an outline pane from a given element- Parameters:
instance- the instance classelement- the element- Returns:
- the outline pane
-
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
-
insertItem
Adds a gui item in the specified index- Parameters:
item- the item to addindex- the item's index
-
addItem
Adds a gui item at the specific spot in the pane- Parameters:
item- the item to set
-
removeItem
Removes the specified item from the pane- Parameters:
item- the item to remove- 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. -
applyMask
Applies a custom mask to this pane. This will throw anIllegalArgumentExceptionwhen the mask's dimension differs from this pane's dimension.- Parameters:
mask- the mask to apply to this pane- Throws:
IllegalArgumentException- when the mask's dimension is incorrect- Since:
- 1.0.1
-
flipHorizontally
public void flipHorizontally(boolean flipHorizontally) Description copied from interface:FlippableSets whether this pane should flip its items horizontally- Specified by:
flipHorizontallyin interfaceFlippable- Parameters:
flipHorizontally- whether the pane should flip items horizontally
-
flipVertically
public void flipVertically(boolean flipVertically) Description copied from interface:FlippableSets whether this pane should flip its items vertically- Specified by:
flipVerticallyin interfaceFlippable- Parameters:
flipVertically- whether the pane should flip items vertically
-
setRepeat
public void setRepeat(boolean repeat) Sets whether this pane should repeat itself- Parameters:
repeat- whether the pane should repeat
-
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.) -
doesRepeat
@Contract(pure=true) public boolean doesRepeat()Gets whether this outline pane repeats itself- Returns:
- true if this pane repeats, false otherwise
-
getGap
@Contract(pure=true) public int getGap()Gets the gap of the pane- Returns:
- the gap
-
setGap
public void setGap(int gap) Sets the gap of the pane- Parameters:
gap- the new gap
-
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.) -
getOrientation
Gets the orientation of this outline pane- Specified by:
getOrientationin interfaceOrientable- Returns:
- the orientation
-
setOrientation
Description copied from interface:OrientableSets the orientation of this outline pane- Specified by:
setOrientationin interfaceOrientable- Parameters:
orientation- the new orientation
-
getRotation
@Contract(pure=true) public int getRotation()Description copied from interface:RotatableGets the rotation specified to this pane. If no rotation has been set, or if this pane is not capable of having a rotation, 0 is returned.- Specified by:
getRotationin interfaceRotatable- Returns:
- the rotation for this pane
-
setRotation
public void setRotation(int rotation) Description copied from interface:RotatableSets the rotation of this pane. The rotation is in degrees and can only be in increments of 90. Anything higher than 360, will be lowered to a value in between [0, 360) while maintaining the same rotational value. E.g. 450 degrees becomes 90 degrees, 1080 degrees becomes 0, etc.This method fails for any pane that has a length and height which are unequal.
- Specified by:
setRotationin interfaceRotatable- Parameters:
rotation- the rotation of this pane, must be divisible by 90.
-
isFlippedHorizontally
@Contract(pure=true) public boolean isFlippedHorizontally()Description copied from interface:FlippableGets whether this pane's items are flipped horizontally- Specified by:
isFlippedHorizontallyin interfaceFlippable- Returns:
- true if the items are flipped horizontally, false otherwise
-
isFlippedVertically
@Contract(pure=true) public boolean isFlippedVertically()Description copied from interface:FlippableGets whether this pane's items are flipped vertically- Specified by:
isFlippedVerticallyin interfaceFlippable- Returns:
- true if the items are flipped vertically, false otherwise
-