Package dev.piglin.piglinworldapi.gui
Class ListGui<T>
java.lang.Object
dev.piglin.piglinworldapi.gui.CustomGui
dev.piglin.piglinworldapi.gui.ListGui<T>
- Type Parameters:
T- List element type
List gui with prev/next buttons and clickable elements
-
Nested Class Summary
Nested classes/interfaces inherited from class dev.piglin.piglinworldapi.gui.CustomGui
CustomGui.ClickResult, CustomGui.ClickResultAnotherGui, CustomGui.ClickResultNone -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected org.bukkit.inventory.ItemStackprotected intprotected org.bukkit.inventory.ItemStackprotected org.bukkit.inventory.ItemStackprotected org.bukkit.inventory.ItemStackprotected intprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.bukkit.inventory.ItemStackMakes an ItemStack representation of an item for the playergetItems(org.bukkit.entity.Player player)Get all available itemsabstract CustomGui.ClickResultonClick(T t, org.bukkit.entity.Player player, org.bukkit.inventory.Inventory inventory, org.bukkit.event.inventory.ClickType type)Handle item clickvoidonClose(org.bukkit.event.inventory.InventoryCloseEvent event)Handle inventory closeonItemClick(org.bukkit.event.inventory.InventoryClickEvent event)Handle clicksonItemClickInInventory(org.bukkit.event.inventory.InventoryClickEvent event)Handle clicks in player's inventory but when your inventory is openvoidonItemDrag(org.bukkit.event.inventory.InventoryDragEvent event)Handle item dragorg.bukkit.inventory.Inventoryopen(org.bukkit.entity.Player player)Create an inventory and open it.
-
Field Details
-
rows
protected final int rows -
name
-
listSlots
-
prevSlot
protected final int prevSlot -
nextSlot
protected final int nextSlot -
prevItem
protected final org.bukkit.inventory.ItemStack prevItem -
nextItem
protected final org.bukkit.inventory.ItemStack nextItem -
noPrevItem
protected final org.bukkit.inventory.ItemStack noPrevItem -
noNextItem
protected final org.bukkit.inventory.ItemStack noNextItem -
lists
-
pages
-
-
Constructor Details
-
ListGui
public ListGui(List<Integer> listSlots, int prev, int next, org.bukkit.inventory.ItemStack prevItem, org.bukkit.inventory.ItemStack nextItem, org.bukkit.inventory.ItemStack noPrevItem, org.bukkit.inventory.ItemStack noNextItem, String name, org.bukkit.plugin.Plugin plugin)- Parameters:
listSlots- Slots for the itemsprev- Slot for "previous page" buttonnext- Slot for "next page" buttonprevItem- ItemStack for "previous page" buttonnextItem- ItemStack for "next page" buttonnoPrevItem- ItemStack for "previous page" button when it's first pagenoNextItem- ItemStack for "next page" button when it's last pagename- Gui titleplugin- Your plugin
-
-
Method Details
-
onItemClick
Description copied from class:CustomGuiHandle clicks- Specified by:
onItemClickin classCustomGui- Parameters:
event- The event- Returns:
- Result of this interaction
-
onItemClickInInventory
public CustomGui.ClickResult onItemClickInInventory(org.bukkit.event.inventory.InventoryClickEvent event)Description copied from class:CustomGuiHandle clicks in player's inventory but when your inventory is open- Specified by:
onItemClickInInventoryin classCustomGui- Parameters:
event- The event- Returns:
- Result of this interaction
-
onItemDrag
public void onItemDrag(org.bukkit.event.inventory.InventoryDragEvent event)Description copied from class:CustomGuiHandle item drag- Specified by:
onItemDragin classCustomGui- Parameters:
event- The event
-
open
public org.bukkit.inventory.Inventory open(org.bukkit.entity.Player player)Description copied from class:CustomGuiCreate an inventory and open it. Usually this method's implementation looks like this:var inventory = Bukkit.createInventory(null, inventorySize, "Name"); // Some Inventory#setItem calls // Maybe GuiUtils.fillWithBarriers(plugin, inventory); player.openInventory(inventory); return inventory; -
onClose
public void onClose(org.bukkit.event.inventory.InventoryCloseEvent event)Description copied from class:CustomGuiHandle inventory close -
getItems
Get all available items- Parameters:
player- The player- Returns:
- List of all available items
-
display
Makes an ItemStack representation of an item for the player- Parameters:
player- The playert- The item- Returns:
- ItemStack representation of the item
-
onClick
public abstract CustomGui.ClickResult onClick(T t, org.bukkit.entity.Player player, org.bukkit.inventory.Inventory inventory, org.bukkit.event.inventory.ClickType type)Handle item click- Parameters:
t- The itemplayer- The player who clickedinventory- The inventorytype- Click type- Returns:
- Result of this interaction
-