Package dev.esophose.playerparticles.gui
Class GuiActionButton
java.lang.Object
dev.esophose.playerparticles.gui.GuiActionButton
public class GuiActionButton
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
GuiActionButton.GuiActionButtonClickCallback
Allows button click callbacks as parameters -
Constructor Summary
Constructors Constructor Description GuiActionButton(int slot, GuiInventoryEditData.ColorData[] iconColors, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)
Constructor for creating animated icons using dyesGuiActionButton(int slot, GuiInventoryEditData.ColorData iconColor, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)
Constructor for creating non-animated icons using dyesGuiActionButton(int slot, org.bukkit.inventory.ItemStack itemStack, GuiActionButton.GuiActionButtonClickCallback onClick)
Constructor for creating a non-animated item from an already created ItemStackGuiActionButton(int slot, org.bukkit.Material[] icons, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)
Constructor for creating animated iconsGuiActionButton(int slot, org.bukkit.Material icon, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)
Constructor for creating non-animated icons -
Method Summary
Modifier and Type Method Description org.bukkit.inventory.ItemStack
getIcon(PPlayer pplayer)
Gets the ItemStack icon that goes into the GUIint
getSlot()
Gets the slot this GuiActionButton occupies in the GuiInventoryvoid
handleClick(boolean isShiftClick)
Executes the onClick callback passed in the constructorboolean
isTickable()
Checks if this GuiActionButton has more than one icon/name that it can cycle throughvoid
onTick()
Ticked at an interval to allow the icon/name to updatestatic java.util.List<java.lang.String>
parseLore(PPlayer pplayer, java.lang.String... lore)
Builds lore from a list of Strings Parses \n as a new lore line Ignores empty lore lines
-
Constructor Details
-
GuiActionButton
public GuiActionButton(int slot, org.bukkit.inventory.ItemStack itemStack, GuiActionButton.GuiActionButtonClickCallback onClick)Constructor for creating a non-animated item from an already created ItemStack- Parameters:
slot
- The slot ID of the inventoryitemStack
- The ItemStack to displayonClick
- The callback to execute when this button is clicked
-
GuiActionButton
public GuiActionButton(int slot, org.bukkit.Material[] icons, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)Constructor for creating animated icons- Parameters:
slot
- The slot ID of the inventoryicons
- The Materials that this icon will cycle throughname
- The name that this icon will uselore
- The lore of this icononClick
- The callback to execute when this button is clicked
-
GuiActionButton
public GuiActionButton(int slot, org.bukkit.Material icon, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)Constructor for creating non-animated icons- Parameters:
slot
- The slot ID of the inventoryicon
- The Material that this icon will usename
- The name that this icon will uselore
- The lore of this icononClick
- The callback to execute when this button is clicked
-
GuiActionButton
public GuiActionButton(int slot, GuiInventoryEditData.ColorData[] iconColors, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)Constructor for creating animated icons using dyes- Parameters:
slot
- The slot ID of the inventoryiconColors
- The ColorData that this icon will cycle throughname
- The name that this icon will uselore
- The lore of this icononClick
- The callback to execute when this button is clicked
-
GuiActionButton
public GuiActionButton(int slot, GuiInventoryEditData.ColorData iconColor, java.lang.String name, java.lang.String[] lore, GuiActionButton.GuiActionButtonClickCallback onClick)Constructor for creating non-animated icons using dyes- Parameters:
slot
- The slot ID of the inventoryiconColor
- The ColorData that this icon will usename
- The name that this icon will uselore
- The lore of this icononClick
- The callback to execute when this button is clicked
-
-
Method Details
-
getSlot
public int getSlot()Gets the slot this GuiActionButton occupies in the GuiInventory- Returns:
- The slot this GuiActionButton occupies in the GuiInventory
-
getIcon
Gets the ItemStack icon that goes into the GUI- Parameters:
pplayer
- The PPlayer that is viewing the icon- Returns:
- The icon ItemStack for the GUI
-
handleClick
public void handleClick(boolean isShiftClick)Executes the onClick callback passed in the constructor- Parameters:
isShiftClick
- If the player was holding shift when they clicked
-
onTick
public void onTick()Ticked at an interval to allow the icon/name to update -
isTickable
public boolean isTickable()Checks if this GuiActionButton has more than one icon/name that it can cycle through- Returns:
- If this GuiActionButton has more than one icon/name
-
parseLore
public static java.util.List<java.lang.String> parseLore(PPlayer pplayer, java.lang.String... lore)Builds lore from a list of Strings Parses \n as a new lore line Ignores empty lore lines- Parameters:
pplayer
- The PPlayer viewing the lorelore
- The lines of lore- Returns:
- A parsed list of lore text
-