Package net.swofty.gui.inventory
Class SkyBlockInventoryGUI
java.lang.Object
net.swofty.gui.inventory.SkyBlockInventoryGUI
- Direct Known Subclasses:
GUIBanker,GUICrafting,GUIEnchantmentTable,GUIReforge,GUISkyBlockMenu,SkyBlockPaginatedGUI
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic final record -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSkyBlockInventoryGUI(String title, net.minestom.server.inventory.InventoryType size) -
Method Summary
Modifier and TypeMethodDescriptionvoidRuns after the GUI opens to the playerabstract booleanMethod to allow people to hotkey items into the GUI or notvoidborder(net.minestom.server.item.ItemStack.Builder stack) Fills the border between two corners of your GUI with the item stack of your choicevoidborder(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2) Fills the border in a rectangle between two slots\ Overwrite is set to true by default in this method Pickup is set to false by default in this methodvoidborder(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2, boolean pickup) Fills the border in a rectangle between two slots\ Overwrite is set to true by default in this methodvoidborder(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2, boolean overwrite, boolean pickup) Fills the border of a rectangle between two slotsvoidfill(net.minestom.server.item.ItemStack.Builder stack) Fills the whole inventory with the item stack of your choicevoidfill(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2) Fill a rectangle between two corners of the GUI Overwrite is set to true by default in this method Pickup is set to false by default in this methodvoidfill(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2, boolean pickup) Fill a rectangle between two corners of the GUI Overwrite is set to true by default in this methodvoidfill(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2, boolean overwrite, boolean pickup) Fill a rectangle between two corners of the GUIvoidFills the whole inventory with the Material of your choiceintIterates through all the slots and finds the first empty oneget(int slot) Get a GUI item that is in a slotabstract voidonBottomClick(net.minestom.server.event.inventory.InventoryPreClickEvent e) Runs when the player clicks on their own inventory whole this GUI is openabstract voidonClose(net.minestom.server.event.inventory.InventoryCloseEvent e, SkyBlockInventoryGUI.CloseReason reason) Runs when the player closes the guivoidRuns when the player opens the guivoidopen(SkyBlockPlayer player) Opens the GUI for a playervoidset(int slot, net.minestom.server.item.ItemStack.Builder stack) Set an item inside the gui In this method pickup is set to false by defaultvoidset(int slot, net.minestom.server.item.ItemStack.Builder stack, boolean pickup) Set an item inside the guivoidSet an item inside the GUIvoidRuns before the GUI opens, in order to set the items inabstract voidsuddenlyQuit(net.minestom.server.inventory.Inventory inventory, SkyBlockPlayer player) voidupdateItemStacks(net.minestom.server.inventory.Inventory inventory, SkyBlockPlayer player) re-set all the GUIItems inside of the inventory
-
Field Details
-
GUI_MAP
-
title
-
size
protected net.minestom.server.inventory.InventoryType size -
items
-
-
Constructor Details
-
SkyBlockInventoryGUI
-
-
Method Details
-
set
Set an item inside the GUI- Parameters:
a- the item you want to set
-
set
public void set(int slot, net.minestom.server.item.ItemStack.Builder stack, boolean pickup) Set an item inside the gui- Parameters:
slot- the slot the item should be in (any number between 0-53 depending on your GUI size)stack- theItemStackthat should be in the slotpickup- can the player pick up the item by clicking on it or no
-
set
public void set(int slot, net.minestom.server.item.ItemStack.Builder stack) Set an item inside the gui In this method pickup is set to false by default- Parameters:
slot- the slot the item should be in (any number between 0-53 depending on your GUI size)stack- theItemStackthat should be in the slot
-
get
Get a GUI item that is in a slot- Parameters:
slot- which slot the GUI item is in- Returns:
- the GUIItem in that slot, if there is none, null
-
fill
public void fill(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2, boolean overwrite, boolean pickup) Fill a rectangle between two corners of the GUI- Parameters:
stack- whatItemStackare we filling our rectangle withcornerSlot- the top left corner of our rectanglecornerSlot2- the bottom right corner of our rectangleoverwrite- if this is set to true, the method will ignore any items in the rectangle and replace them with 'stack'pickup- is the player able to pick up the items in the rectangle?
-
fill
public void fill(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2, boolean pickup) Fill a rectangle between two corners of the GUI Overwrite is set to true by default in this method- Parameters:
stack- whatItemStackare we filling our rectangle withcornerSlot- the top left corner of our rectanglecornerSlot2- the bottom right corner of our rectanglepickup- is the player able to pick up the items in the rectangle?
-
fill
public void fill(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2) Fill a rectangle between two corners of the GUI Overwrite is set to true by default in this method Pickup is set to false by default in this method- Parameters:
stack- whatItemStackare we filling our rectangle withcornerSlot- the top left corner of our rectanglecornerSlot2- the bottom right corner of our rectangle
-
fill
public void fill(net.minestom.server.item.ItemStack.Builder stack) Fills the whole inventory with the item stack of your choice- Parameters:
stack- theItemStackof your choice
-
fill
Fills the whole inventory with the Material of your choice- Parameters:
material- theMaterialof your choice
-
border
public void border(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2, boolean overwrite, boolean pickup) Fills the border of a rectangle between two slots- Parameters:
stack- theItemStackof your choicecornerSlot- the top left corner of your rectanglecornerSlot2- the bottom right corner of your rectangleoverwrite- if this is set to true, the method will ignore any items in between the lines and replace thempickup- if this is set to true, players will be able to pick up the items in your border
-
border
public void border(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2, boolean pickup) Fills the border in a rectangle between two slots\ Overwrite is set to true by default in this method- Parameters:
stack- theItemStackof your choicecornerSlot- the top left corner of your rectanglecornerSlot2- the bottom right corner of your rectanglepickup- if this is set to true, players will be able to pick up the items in your border
-
border
public void border(net.minestom.server.item.ItemStack.Builder stack, int cornerSlot, int cornerSlot2) Fills the border in a rectangle between two slots\ Overwrite is set to true by default in this method Pickup is set to false by default in this method- Parameters:
stack- theItemStackof your choicecornerSlot- the top left corner of your rectanglecornerSlot2- the bottom right corner of your rectangle
-
border
public void border(net.minestom.server.item.ItemStack.Builder stack) Fills the border between two corners of your GUI with the item stack of your choice- Parameters:
stack- theItemStackof your choice
-
firstEmpty
public int firstEmpty()Iterates through all the slots and finds the first empty one- Returns:
- an empty slot index
-
open
Opens the GUI for a player- Parameters:
player- the player the gui is being opened for
-
allowHotkeying
public abstract boolean allowHotkeying()Method to allow people to hotkey items into the GUI or not- Returns:
- a boolean
-
onOpen
Runs when the player opens the gui- Parameters:
e- the event of the gui opening
-
onClose
public abstract void onClose(net.minestom.server.event.inventory.InventoryCloseEvent e, SkyBlockInventoryGUI.CloseReason reason) Runs when the player closes the gui- Parameters:
e- the event of the gui closing
-
suddenlyQuit
public abstract void suddenlyQuit(net.minestom.server.inventory.Inventory inventory, SkyBlockPlayer player) -
onBottomClick
public abstract void onBottomClick(net.minestom.server.event.inventory.InventoryPreClickEvent e) Runs when the player clicks on their own inventory whole this GUI is open- Parameters:
e- the event of the click
-
afterOpen
Runs after the GUI opens to the player- Parameters:
e- the event of the gui opening
-
setItems
Runs before the GUI opens, in order to set the items in- Parameters:
e- the event of the GUI opening
-
updateItemStacks
public void updateItemStacks(net.minestom.server.inventory.Inventory inventory, SkyBlockPlayer player) re-set all the GUIItems inside of the inventory- Parameters:
inventory- an inventory object to set the items in
-