Class GUIButton
java.lang.Object
de.placeblock.betterinventories.content.GUISection
de.placeblock.betterinventories.content.item.GUIItem
de.placeblock.betterinventories.content.item.GUIButton
- All Implemented Interfaces:
Sizeable
- Direct Known Subclasses:
CommandGUIButton,CycleGUIButton,PaginatorGUIButton,SubmitGUIButton,SwitchGUIButton,TeleportGUIButton,ToggleGUIButton
A
Builder:
GUIItem with the ability to get clicked.
Various onclick methods can be implemented and overridden.
The cooldown is being set for the whole material of the ItemStack.
Builder:
GUIButtonBuilder-
Field Summary
Fields inherited from class de.placeblock.betterinventories.content.item.GUIItem
BUTTON_SIZE, itemStackFields inherited from class de.placeblock.betterinventories.content.GUISection
maxSize, minSize -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new GUIButtonCreates a new GUIButtonCreates a new GUIButtonCreates a new GUIButtonGUIButton(GUI gui, org.bukkit.inventory.ItemStack item, int cooldown, org.bukkit.Sound clickSound, String permission) Creates a new GUIButtonCreates a new GUIButtonCreates a new GUIButton -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies the cooldown to the Buttonvoidclick(org.bukkit.entity.Player player) Is called when a player clicks on the ButtonbooleanhasPermission(org.bukkit.entity.Player player) Checks if the player has the permission to click this buttonabstract voidIs called when the player clicks on the Button no matter how.voidonLeftClick(ClickData data) Is called when the player left-clicks the Button without sneakingvoidonRightClick(ClickData data) Is called when the player right-clicks the Button without sneakingvoidonShiftClick(ClickData data) Is called when the player clicks the Button while sneakingvoidonShiftLeftClick(ClickData data) Is called when the player left-clicks the Button while sneakingvoidonShiftRightClick(ClickData data) Is called when the player right-clicks the Button while sneakingvoidsetCooldown(int cooldown) Sets the cooldown after which the Button can be clicked againMethods inherited from class de.placeblock.betterinventories.content.item.GUIItem
getSectionAt, getSectionAt, renderMethods inherited from class de.placeblock.betterinventories.content.GUISection
getEmptyContentList, getHeight, getSlots, getWidth, setSize, slotToVector, vectorToSlotMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.placeblock.betterinventories.Sizeable
clampSize, getMaxSize, getMinSize, getSize
-
Constructor Details
-
GUIButton
Creates a new GUIButton- Parameters:
gui- The GUIitem- The ItemStack of the GUIButton
-
GUIButton
Creates a new GUIButton- Parameters:
gui- The GUIitem- The ItemStack of the GUIButtonpermission- The permission required to click the button
-
GUIButton
Creates a new GUIButton- Parameters:
gui- The GUIitem- The ItemStack of the GUIButtonclickSound- The sound the button should make on click. null if silent.
-
GUIButton
Creates a new GUIButton- Parameters:
gui- The GUIitem- The ItemStack of the GUIButtoncooldown- The cooldown after which the button can be clicked again in ticks
-
GUIButton
Creates a new GUIButton- Parameters:
gui- The GUIitem- The ItemStack of the GUIButtoncooldown- The cooldown after which the button can be clicked again in tickspermission- The permission required to click the button
-
GUIButton
public GUIButton(GUI gui, org.bukkit.inventory.ItemStack item, int cooldown, org.bukkit.Sound clickSound) Creates a new GUIButton- Parameters:
gui- The GUIitem- The ItemStack of the GUIButtoncooldown- The cooldown after which the button can be clicked again in ticksclickSound- The sound the button should make on click. null if silent.
-
GUIButton
public GUIButton(GUI gui, org.bukkit.inventory.ItemStack item, int cooldown, org.bukkit.Sound clickSound, String permission) Creates a new GUIButton- Parameters:
gui- The GUIitem- The ItemStack of the GUIButtoncooldown- The cooldown after which the button can be clicked again in ticksclickSound- The sound the button should make on click. null if silent.permission- The permission required to click the button
-
-
Method Details
-
hasPermission
public boolean hasPermission(org.bukkit.entity.Player player) Checks if the player has the permission to click this button- Parameters:
player- The player- Returns:
- true if the player has the permission or the permission is null, false otherwise
-
click
public void click(org.bukkit.entity.Player player) Is called when a player clicks on the Button- Parameters:
player- The Player
-
applyCooldown
public void applyCooldown()Applies the cooldown to the Button -
setCooldown
public void setCooldown(int cooldown) Sets the cooldown after which the Button can be clicked again- Parameters:
cooldown- The cooldown in ticks
-
onClick
Is called when the player clicks on the Button no matter how.- Parameters:
data- The ClickData
-
onLeftClick
Is called when the player left-clicks the Button without sneaking- Parameters:
data- The ClickData
-
onRightClick
Is called when the player right-clicks the Button without sneaking- Parameters:
data- The ClickData
-
onShiftClick
Is called when the player clicks the Button while sneaking- Parameters:
data- The ClickData
-
onShiftLeftClick
Is called when the player left-clicks the Button while sneaking- Parameters:
data- The ClickData
-
onShiftRightClick
Is called when the player right-clicks the Button while sneaking- Parameters:
data- The ClickData
-