Package me.bimmr.bimmcore.gui.inventory
Class Menu
- java.lang.Object
-
- me.bimmr.bimmcore.gui.inventory.Menu
-
public class Menu extends java.lang.Object
A Utilities class for creating a Inventory GUI
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAXITEMSPERPAGE
The constant MAXITEMSPERPAGE.static int
MAXITEMSPERPAGEBORDERED
The constant MAXITEMSPERPAGEBORDERED.static org.bukkit.inventory.ItemStack
NEXTPAGEITEM
The constant NEXTPAGEITEM.static org.bukkit.inventory.ItemStack
PREVIOUSPAGEITEM
The constant PREVIOUSPAGEITEM.
-
Constructor Summary
Constructors Constructor Description Menu(java.lang.String name)
Create a MenuGUI Size is automatic, ClickEvent is null, No borders, No cornersMenu(java.lang.String name, int size)
Create a MenuGUI ClickEvent is null, No borders, No cornersMenu(java.lang.String name, int size, ClickEvent clickEvent)
Create a MenuGUI No borders, No cornersMenu(java.lang.String name, int size, ClickEvent clickEvent, org.bukkit.inventory.ItemStack borderCorners, org.bukkit.inventory.ItemStack borderSides)
Create a MenuGUIMenu(java.lang.String name, int size, org.bukkit.inventory.ItemStack borderCorners, org.bukkit.inventory.ItemStack borderSides)
Create a MenuGUI ClickEvent is nullMenu(java.lang.String name, ClickEvent clickEvent)
Create a MenuGUI Size is automatic, No borders, No cornersMenu(java.lang.String name, ClickEvent clickEvent, org.bukkit.inventory.ItemStack borderCorners, org.bukkit.inventory.ItemStack borderSides)
Create a MenuGUI Size is automaticMenu(java.lang.String name, org.bukkit.inventory.ItemStack borderCorners, org.bukkit.inventory.ItemStack borderSides)
Create a MenuGUI Size is automatic, ClickEvent is null
-
Method Summary
Modifier and Type Method Description Menu
addItem(int page, Items items)
Add a formatted Item ClickEvent is null CalladdItem(int, ItemStack, ClickEvent)
Menu
addItem(int page, Items items, ClickEvent clickEvent)
Add a formatted Item CalladdItem(int, ItemStack, ClickEvent)
Menu
addItem(int page, org.bukkit.inventory.ItemStack itemStack)
Add an Item to the MenuGUI CallsaddItem(int, ItemStack, ClickEvent)
Menu
addItem(int page, org.bukkit.inventory.ItemStack itemStack, ClickEvent clickEvent)
Add an Item to the MenuGUIMenu
addItem(Items items)
Add a formatted Item Page is 0, ClickEvent is null CalladdItem(int, ItemStack, ClickEvent)
=Menu
addItem(Items items, ClickEvent clickEvent)
Add a formatted Item Page is 0 CalladdItem(int, ItemStack, ClickEvent)
Menu
addItem(org.bukkit.inventory.ItemStack itemStack)
Add an ItemStack ClickEvent is null CalladdItem(int, ItemStack, ClickEvent)
Menu
addItem(org.bukkit.inventory.ItemStack itemStack, ClickEvent clickEvent)
Add an ItemStack CalladdItem(int, ItemStack, ClickEvent)
Menu
border(org.bukkit.inventory.ItemStack borderCorners, org.bukkit.inventory.ItemStack borderSides)
Border the MenuGUIMenu
build()
Build the MenuGUIMenu
center()
Center the MenuGUI's Items CallssetCentered(boolean)
void
clear()
void
destroy()
Destroy the MenuGUIorg.bukkit.inventory.ItemStack
getBorderCorners()
Gets border corners.org.bukkit.inventory.ItemStack
getBorderSides()
Gets border sides.ClickEvent
getClickEvent()
Gets click event.ClickEvent
getClickEvent(org.bukkit.inventory.ItemStack itemStack)
Gets click event.int
getCurrentPage(org.bukkit.entity.Player player)
Gets current page.java.util.ArrayList<org.bukkit.inventory.Inventory>
getInventories()
Gets inventories.java.lang.String
getName()
Gets name.java.util.ArrayList<java.util.ArrayList<org.bukkit.inventory.ItemStack>>
getPages()
Gets pages.java.util.HashMap<java.lang.String,java.lang.Integer>
getPlayerPage()
Gets player page.int
getRows(int numberOfItems, double itemsPerRow)
Get the Rows based on the number of items with a specific number of items per rowint
getSize()
Gets size.boolean
isBordered()
void
open(int page, org.bukkit.entity.Player player)
Open the inventory for the player Willbuild()
if not ranvoid
open(org.bukkit.entity.Player player)
Open the inventory for the player Page is 0 Callsopen(int, Player)
void
openNextPage(org.bukkit.entity.Player player)
Open the next page of the MenuGUI Callsopen(int, Player)
void
openPreviousPage(org.bukkit.entity.Player player)
Open the previous page of the MenuGUI Callsopen(int, Player)
Menu
setBorderCorners(org.bukkit.inventory.ItemStack borderCorners)
Set the border corner's ItemStackMenu
setBordered(boolean bordered)
Set the MenuGUI being bordered - includes cornersMenu
setBorderSides(org.bukkit.inventory.ItemStack borderSides)
Set the border's ItemStackMenu
setCentered(boolean centered)
Set the MenuGUI's centered valuevoid
setClickEvent(ClickEvent clickEvent)
Set the ClickEventMenu
setClose(boolean close)
void
setCloseOnClick(boolean close)
Deprecated.Menu
setDestroy(boolean destroy)
void
setDestroyOnClick(boolean destroy)
Deprecated.Menu
setItem(int page, int slot, Items items)
Set an Item in the Menu CallssetItem(int, int, ItemStack, ClickEvent)
Menu
setItem(int page, int slot, Items items, ClickEvent clickEvent)
Set an Item in the Menu CallssetItem(int, int, ItemStack, ClickEvent)
Menu
setItem(int page, int slot, org.bukkit.inventory.ItemStack item)
Set an Item in the Menu ClickEvent is null CallssetItem(int, int, ItemStack, ClickEvent)
Menu
setItem(int page, int slot, org.bukkit.inventory.ItemStack item, ClickEvent clickEvent)
Set an Item in the MenuMenu
setItem(int slot, Items items)
Set an Item in the Menu Page is 0, ClickEvent is null CallssetItem(int, int, ItemStack, ClickEvent)
Menu
setItem(int slot, Items items, ClickEvent clickEvent)
Set an Item in the Menu Page is 0 CallssetItem(int, int, ItemStack, ClickEvent)
Menu
setItem(int slot, org.bukkit.inventory.ItemStack item)
Set an Item in the Menu Page is 0, ClickEvent is null CallssetItem(int, int, ItemStack, ClickEvent)
Menu
setItem(int slot, org.bukkit.inventory.ItemStack item, ClickEvent clickEvent)
Set an Item in the Menu Page is 0 CallssetItem(int, int, ItemStack, ClickEvent)
Menu
setName(java.lang.String name)
Set the MenuGUI's namevoid
setSize(int size)
Set the MenuGUI's sizeboolean
willClose()
boolean
willDestroy()
-
-
-
Field Detail
-
MAXITEMSPERPAGE
public static final int MAXITEMSPERPAGE
The constant MAXITEMSPERPAGE.- See Also:
- Constant Field Values
-
MAXITEMSPERPAGEBORDERED
public static final int MAXITEMSPERPAGEBORDERED
The constant MAXITEMSPERPAGEBORDERED.- See Also:
- Constant Field Values
-
PREVIOUSPAGEITEM
public static org.bukkit.inventory.ItemStack PREVIOUSPAGEITEM
The constant PREVIOUSPAGEITEM.
-
NEXTPAGEITEM
public static org.bukkit.inventory.ItemStack NEXTPAGEITEM
The constant NEXTPAGEITEM.
-
-
Constructor Detail
-
Menu
public Menu(java.lang.String name)
Create a MenuGUI Size is automatic, ClickEvent is null, No borders, No corners- Parameters:
name
- The menu's name
-
Menu
public Menu(java.lang.String name, int size)
Create a MenuGUI ClickEvent is null, No borders, No corners- Parameters:
name
- The menu's namesize
- The menu's size (-1 will make it automatic)
-
Menu
public Menu(java.lang.String name, ClickEvent clickEvent)
Create a MenuGUI Size is automatic, No borders, No corners- Parameters:
name
- The menu's nameclickEvent
- The ClickEvent
-
Menu
public Menu(java.lang.String name, int size, ClickEvent clickEvent)
Create a MenuGUI No borders, No corners- Parameters:
name
- The menu's namesize
- The SizeclickEvent
- The ClickEvent
-
Menu
public Menu(java.lang.String name, org.bukkit.inventory.ItemStack borderCorners, org.bukkit.inventory.ItemStack borderSides)
Create a MenuGUI Size is automatic, ClickEvent is null- Parameters:
name
- The menu's nameborderCorners
- The ItemStack for the cornersborderSides
- The ItemStack for the borders
-
Menu
public Menu(java.lang.String name, int size, org.bukkit.inventory.ItemStack borderCorners, org.bukkit.inventory.ItemStack borderSides)
Create a MenuGUI ClickEvent is null- Parameters:
name
- The menu's namesize
- The menu's size (-1 will make it automatic)borderCorners
- The ItemStack for the cornersborderSides
- The ItemStack for the borders
-
Menu
public Menu(java.lang.String name, ClickEvent clickEvent, org.bukkit.inventory.ItemStack borderCorners, org.bukkit.inventory.ItemStack borderSides)
Create a MenuGUI Size is automatic- Parameters:
name
- The menu's nameclickEvent
- The ClickEventborderCorners
- The ItemStack for the cornersborderSides
- The ItemStack for the borders
-
Menu
public Menu(java.lang.String name, int size, ClickEvent clickEvent, org.bukkit.inventory.ItemStack borderCorners, org.bukkit.inventory.ItemStack borderSides)
Create a MenuGUI- Parameters:
name
- The menu's namesize
- The menu's size (-1 will make it automatic)clickEvent
- The ClickEventborderCorners
- The ItemStack for the cornersborderSides
- The ItemStack for the borders
-
-
Method Detail
-
willClose
public boolean willClose()
-
setCloseOnClick
@Deprecated public void setCloseOnClick(boolean close)
Deprecated.
-
setClose
public Menu setClose(boolean close)
-
willDestroy
public boolean willDestroy()
-
setDestroyOnClick
@Deprecated public void setDestroyOnClick(boolean destroy)
Deprecated.
-
setDestroy
public Menu setDestroy(boolean destroy)
-
getName
public java.lang.String getName()
Gets name.- Returns:
- Get The MenuGUI's name
-
setName
public Menu setName(java.lang.String name)
Set the MenuGUI's name- Parameters:
name
- The Menu's name- Returns:
- The MenuGUI
-
getBorderCorners
public org.bukkit.inventory.ItemStack getBorderCorners()
Gets border corners.- Returns:
- Get the border corner ItemStack
-
setBorderCorners
public Menu setBorderCorners(org.bukkit.inventory.ItemStack borderCorners)
Set the border corner's ItemStack- Parameters:
borderCorners
- The ItemStack for the border corners- Returns:
- The MenuGUI
-
clear
public void clear()
-
getPlayerPage
public java.util.HashMap<java.lang.String,java.lang.Integer> getPlayerPage()
Gets player page.- Returns:
- Get the HashMap of page's each player is on
-
getPages
public java.util.ArrayList<java.util.ArrayList<org.bukkit.inventory.ItemStack>> getPages()
Gets pages.- Returns:
- Get the Pages for the MenuGUI
-
getInventories
public java.util.ArrayList<org.bukkit.inventory.Inventory> getInventories()
Gets inventories.- Returns:
- Get The Inventory's in the MenuGUI
-
getBorderSides
public org.bukkit.inventory.ItemStack getBorderSides()
Gets border sides.- Returns:
- Get the border's ItemStack
-
setBorderSides
public Menu setBorderSides(org.bukkit.inventory.ItemStack borderSides)
Set the border's ItemStack- Parameters:
borderSides
- The ItemStack to set as the border- Returns:
- The MenuGUI
-
border
public Menu border(org.bukkit.inventory.ItemStack borderCorners, org.bukkit.inventory.ItemStack borderSides)
Border the MenuGUI- Parameters:
borderCorners
- The corner's ItemStackborderSides
- The side's ItemStack- Returns:
- The MenuGUI
-
center
public Menu center()
Center the MenuGUI's Items CallssetCentered(boolean)
- Returns:
- The MenuGUI
-
setCentered
public Menu setCentered(boolean centered)
Set the MenuGUI's centered value- Parameters:
centered
- If the MenuGUI is centered- Returns:
- The MenuGUI
-
addItem
public Menu addItem(int page, org.bukkit.inventory.ItemStack itemStack)
Add an Item to the MenuGUI CallsaddItem(int, ItemStack, ClickEvent)
- Parameters:
page
- The page to add the Item toitemStack
- The ItemStack to add- Returns:
- The MenuGUI
-
addItem
public Menu addItem(int page, org.bukkit.inventory.ItemStack itemStack, ClickEvent clickEvent)
Add an Item to the MenuGUI- Parameters:
page
- The page to add the item toitemStack
- The ItemStack to addclickEvent
- The ClickEvent- Returns:
- The MenuGUI
-
addItem
public Menu addItem(int page, Items items)
Add a formatted Item ClickEvent is null CalladdItem(int, ItemStack, ClickEvent)
- Parameters:
page
- The page to add the item toitems
- The ItemStack- Returns:
- The MenuGUI
-
addItem
public Menu addItem(Items items)
Add a formatted Item Page is 0, ClickEvent is null CalladdItem(int, ItemStack, ClickEvent)
=- Parameters:
items
- The ItemStack- Returns:
- The MenuGUI
-
addItem
public Menu addItem(Items items, ClickEvent clickEvent)
Add a formatted Item Page is 0 CalladdItem(int, ItemStack, ClickEvent)
- Parameters:
items
- The ItemStackclickEvent
- The ClickEvent- Returns:
- The MenuGUI
-
addItem
public Menu addItem(int page, Items items, ClickEvent clickEvent)
Add a formatted Item CalladdItem(int, ItemStack, ClickEvent)
- Parameters:
page
- The page to add the item toitems
- The ItemStackclickEvent
- The ClickEvent- Returns:
- The MenuGUI
-
addItem
public Menu addItem(org.bukkit.inventory.ItemStack itemStack)
Add an ItemStack ClickEvent is null CalladdItem(int, ItemStack, ClickEvent)
- Parameters:
itemStack
- The ItemStack- Returns:
- The MenuGUI
-
addItem
public Menu addItem(org.bukkit.inventory.ItemStack itemStack, ClickEvent clickEvent)
Add an ItemStack CalladdItem(int, ItemStack, ClickEvent)
- Parameters:
itemStack
- The ItemStackclickEvent
- The ClickEvent- Returns:
- The MenuGUI
-
setItem
public Menu setItem(int page, int slot, org.bukkit.inventory.ItemStack item, ClickEvent clickEvent)
Set an Item in the Menu- Parameters:
page
- The pageslot
- The slot numberitem
- The ItemStackclickEvent
- The ClickEvent- Returns:
- The MenuGUI
-
setItem
public Menu setItem(int page, int slot, org.bukkit.inventory.ItemStack item)
Set an Item in the Menu ClickEvent is null CallssetItem(int, int, ItemStack, ClickEvent)
- Parameters:
page
- The pageslot
- The slot numberitem
- The ItemStack- Returns:
- The MenuGUI
-
setItem
public Menu setItem(int page, int slot, Items items)
Set an Item in the Menu CallssetItem(int, int, ItemStack, ClickEvent)
- Parameters:
page
- The pageslot
- The slot numberitems
- The ItemStack- Returns:
- The MenuGUI
-
setItem
public Menu setItem(int page, int slot, Items items, ClickEvent clickEvent)
Set an Item in the Menu CallssetItem(int, int, ItemStack, ClickEvent)
- Parameters:
page
- The pageslot
- The slot numberitems
- The ItemStackclickEvent
- The ClickEvent- Returns:
- The MenuGUI
-
setItem
public Menu setItem(int slot, org.bukkit.inventory.ItemStack item)
Set an Item in the Menu Page is 0, ClickEvent is null CallssetItem(int, int, ItemStack, ClickEvent)
- Parameters:
slot
- The slot numberitem
- The ItemStack- Returns:
- The MenuGUI
-
setItem
public Menu setItem(int slot, org.bukkit.inventory.ItemStack item, ClickEvent clickEvent)
Set an Item in the Menu Page is 0 CallssetItem(int, int, ItemStack, ClickEvent)
- Parameters:
slot
- The slot numberitem
- The ItemStackclickEvent
- The ClickEvent- Returns:
- The MenuGUI
-
setItem
public Menu setItem(int slot, Items items)
Set an Item in the Menu Page is 0, ClickEvent is null CallssetItem(int, int, ItemStack, ClickEvent)
- Parameters:
slot
- The slot numberitems
- The ItemStack- Returns:
- The MenuGUI
-
setItem
public Menu setItem(int slot, Items items, ClickEvent clickEvent)
Set an Item in the Menu Page is 0 CallssetItem(int, int, ItemStack, ClickEvent)
- Parameters:
slot
- The slot numberitems
- The ItemStackclickEvent
- The ClickEvent- Returns:
- The MenuGUI
-
build
public Menu build()
Build the MenuGUI- Returns:
- The MenuGUI
-
open
public void open(org.bukkit.entity.Player player)
Open the inventory for the player Page is 0 Callsopen(int, Player)
- Parameters:
player
- The player
-
open
public void open(int page, org.bukkit.entity.Player player)
Open the inventory for the player Willbuild()
if not ran- Parameters:
page
- The page to openplayer
- The player
-
openNextPage
public void openNextPage(org.bukkit.entity.Player player)
Open the next page of the MenuGUI Callsopen(int, Player)
- Parameters:
player
- The player
-
openPreviousPage
public void openPreviousPage(org.bukkit.entity.Player player)
Open the previous page of the MenuGUI Callsopen(int, Player)
- Parameters:
player
- The player
-
getCurrentPage
public int getCurrentPage(org.bukkit.entity.Player player)
Gets current page.- Parameters:
player
- The player- Returns:
- The current page
-
destroy
public void destroy()
Destroy the MenuGUI
-
getRows
public int getRows(int numberOfItems, double itemsPerRow)
Get the Rows based on the number of items with a specific number of items per row- Parameters:
numberOfItems
- The total number of itemsitemsPerRow
- the amount of items per row- Returns:
- The total Rows
-
getClickEvent
public ClickEvent getClickEvent()
Gets click event.- Returns:
- Get the ClickEvent
-
setClickEvent
public void setClickEvent(ClickEvent clickEvent)
Set the ClickEvent- Parameters:
clickEvent
- the click event
-
getClickEvent
public ClickEvent getClickEvent(org.bukkit.inventory.ItemStack itemStack)
Gets click event.- Parameters:
itemStack
- The ItemStack- Returns:
- Get the ClickEvent for an item
-
getSize
public int getSize()
Gets size.- Returns:
- Get the MenuGUI's size
-
setSize
public void setSize(int size)
Set the MenuGUI's size- Parameters:
size
- The size
-
isBordered
public boolean isBordered()
-
setBordered
public Menu setBordered(boolean bordered)
Set the MenuGUI being bordered - includes corners- Parameters:
bordered
- If being bordered- Returns:
- The MenuGUI
-
-