Class BInventoryButton
java.lang.Object
com.bencodez.advancedcore.api.inventory.BInventoryButton
- Direct Known Subclasses:
EditGUIButton,UpdatingBInventoryButton
The Class BInventoryButton.
-
Constructor Summary
ConstructorsConstructorDescriptionBInventoryButton(BInventoryButton button) Instantiates a new BInventory button from an existing button.BInventoryButton(ItemBuilder item) Instantiates a new BInventory button from an item builder.BInventoryButton(String name, String[] lore, org.bukkit.inventory.ItemStack item) Instantiates a new b inventory button.BInventoryButton(org.bukkit.inventory.ItemStack item) Instantiates a new BInventory button from an item stack. -
Method Summary
Modifier and TypeMethodDescriptionAdd data to this button.Set this button to not close the inventory after click.Get this button.getData()Get data by key.Get data by key with default value.org.bukkit.inventory.ItemStackgetItem()Deprecated.Use getItem(Player player)org.bukkit.inventory.ItemStackgetItem(org.bukkit.entity.Player player) Gets the item.org.bukkit.inventory.ItemStackGets the item with placeholders.getLastRewardsPath(org.bukkit.entity.Player player) Get the last rewards path for a player.Get meta from player.intgetSlot()Gets the slot.voidload(org.bukkit.entity.Player p) Load this button for a player.abstract voidonClick(BInventory.ClickEvent clickEvent) On click.voidonClick(BInventory.ClickEvent event, BInventory inv) On click with inventory.voidsendMessage(org.bukkit.entity.Player player, String msg) Send a message to a player.voidsetBuilder(ItemBuilder builder) setCloseInv(boolean value) Set whether the inventory should close after interaction.voidsetItem(ItemBuilder builder) Sets the item.voidsetItem(org.bukkit.inventory.ItemStack item) Sets the item.voidSet meta for a player.setSlot(int slot) Sets the slot.
-
Constructor Details
-
BInventoryButton
Instantiates a new BInventory button from an existing button.- Parameters:
button- the button to copy
-
BInventoryButton
Instantiates a new BInventory button from an item builder.- Parameters:
item- the item builder
-
BInventoryButton
public BInventoryButton(org.bukkit.inventory.ItemStack item) Instantiates a new BInventory button from an item stack.- Parameters:
item- the item stack
-
BInventoryButton
Instantiates a new b inventory button.- Parameters:
name- the namelore- the loreitem- the item
-
-
Method Details
-
addData
Add data to this button.- Parameters:
key- the keyobject- the value- Returns:
- this button
-
dontClose
Set this button to not close the inventory after click.- Returns:
- this button
-
getBuilder
- Returns:
- the builder
-
getButton
Get this button.- Returns:
- this button
-
getData
- Returns:
- the data
-
getData
Get data by key.- Parameters:
key- the key- Returns:
- the data value
-
getData
Get data by key with default value.- Parameters:
key- the keydefaultValue- the default value if key is not found- Returns:
- the data value or default value
-
getItem
Deprecated.Use getItem(Player player)Gets the item.- Returns:
- the item
-
getItem
public org.bukkit.inventory.ItemStack getItem(org.bukkit.entity.Player player) Gets the item.- Parameters:
player- the player- Returns:
- the item
-
getItem
public org.bukkit.inventory.ItemStack getItem(org.bukkit.entity.Player player, HashMap<String, String> placeholders) Gets the item with placeholders.- Parameters:
player- the playerplaceholders- the placeholders- Returns:
- the item
-
getLastRewardsPath
Get the last rewards path for a player.- Parameters:
player- the player- Returns:
- the rewards path
-
getMeta
Get meta from player.- Parameters:
player- the playerstr- the meta key- Returns:
- the meta value
-
getSlot
public int getSlot()Gets the slot.- Returns:
- the slot
-
load
public void load(org.bukkit.entity.Player p) Load this button for a player.- Parameters:
p- the player
-
onClick
On click.- Parameters:
clickEvent- the click event
-
onClick
On click with inventory.- Parameters:
event- the click eventinv- the inventory
-
sendMessage
Send a message to a player.- Parameters:
player- the playermsg- the message
-
setBuilder
- Parameters:
builder- the builder to set
-
setCloseInv
Set whether the inventory should close after interaction.- Parameters:
value- whether to close- Returns:
- this button
-
setItem
Sets the item.- Parameters:
builder- the builder
-
setItem
public void setItem(org.bukkit.inventory.ItemStack item) Sets the item.- Parameters:
item- the new item
-
setMeta
Set meta for a player.- Parameters:
player- the playerstr- the meta keyob- the meta value
-
setSlot
Sets the slot.- Parameters:
slot- the new slot- Returns:
- Return button
-