public class MenuUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.List<org.bukkit.Material> |
staticItems
A list of items to block interactions for, in MMORPG mode.
|
Constructor and Description |
---|
MenuUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addItemLore(org.bukkit.inventory.ItemStack itemStack,
java.lang.String loreLine,
boolean replaceAll)
Adds a lore line to an item stack.
|
static boolean |
checkForStaticItem(org.bukkit.inventory.ItemStack itemStack)
Checks if the given item stack is a static item.
|
static void |
checkForStaticItemDrop(org.bukkit.event.player.PlayerDropItemEvent event)
Prevents the dropping of static and cosmetic items.
|
private static boolean |
isHotbarItemInteractionValid(org.bukkit.event.inventory.InventoryClickEvent event)
Prevents interactions with static and cosmetic items on hotbar number press.
|
static void |
onSpecialItemInventoryClick(org.bukkit.event.inventory.InventoryClickEvent event)
Prevents interactions with static and cosmetic items on click.
|
static int |
roundInventorySize(int inventorySize)
Rounds the given inventory size, to a valid chest size.
|
static void |
setBackpack(org.bukkit.inventory.Inventory menu,
int index)
Sets a backpack to an inventory slot.
|
static void |
setBorders(org.bukkit.inventory.Inventory menu)
Sets borders (unnamed iron bars) to all free slots in an inventory.
|
static void |
setComingSoon(org.bukkit.inventory.Inventory menu,
java.lang.String lore,
int index)
Sets a coming soon sign with an optional label to an inventory slot.
|
static void |
setCurrencyDisplay(org.bukkit.inventory.Inventory menu,
org.bukkit.entity.Player player,
int index)
Sets a currency and reputation display to an inventory slot.
|
static void |
setGlobalCurrencyDisplay(org.bukkit.inventory.Inventory menu,
org.bukkit.entity.Player player,
int index)
Sets a global token display to an inventory slot.
|
static void |
setItemDisplayName(org.bukkit.inventory.ItemStack itemStack,
java.lang.String displayName)
Sets the display name of an item stack.
|
static void |
setMainMenuOpener(org.bukkit.inventory.Inventory menu,
int index) |
static void |
setMaterials(org.bukkit.inventory.Inventory menu,
int index)
Sets a material bag to an inventory slot.
|
static void |
setMenuItem(org.bukkit.inventory.Inventory menu,
int slot,
org.bukkit.inventory.ItemStack itemStack,
java.lang.String displayName,
java.util.List<java.lang.String> lores)
Creates and sets a new menu item in an inventory.
|
static void |
setTrashcan(org.bukkit.inventory.Inventory menu,
int index)
Sets a trashcan to an inventory slot.
|
private static java.util.List<org.bukkit.Material> staticItems
public static void setMainMenuOpener(org.bukkit.inventory.Inventory menu, int index)
public static void setCurrencyDisplay(org.bukkit.inventory.Inventory menu, org.bukkit.entity.Player player, int index)
menu
- The menu inventory.player
- The player whose currencies should be shown.index
- The slot to use in the inventory.public static void setGlobalCurrencyDisplay(org.bukkit.inventory.Inventory menu, org.bukkit.entity.Player player, int index)
menu
- The menu inventory.player
- The player whose currencies should be shown.index
- The slot to use in the inventory.public static void setTrashcan(org.bukkit.inventory.Inventory menu, int index)
menu
- The menu inventory.index
- The slot to use in the inventory.public static void setMaterials(org.bukkit.inventory.Inventory menu, int index)
menu
- The menu inventory.index
- The slot to use in the inventory.public static void setBackpack(org.bukkit.inventory.Inventory menu, int index)
menu
- The menu inventory.index
- The slot to use in the inventory.public static void setComingSoon(org.bukkit.inventory.Inventory menu, java.lang.String lore, int index)
menu
- The menu inventory.lore
- The optional label in the lore of the sign.index
- The slot to use in the inventory.public static void setBorders(org.bukkit.inventory.Inventory menu)
menu
- The menu inventory.public static void setMenuItem(org.bukkit.inventory.Inventory menu, int slot, org.bukkit.inventory.ItemStack itemStack, java.lang.String displayName, java.util.List<java.lang.String> lores)
menu
- The menu inventory.slot
- The slot to place the menu item stack in.itemStack
- The base item stack.displayName
- The display name of the menu item stack.lores
- The lores of the menu item stack.public static void setItemDisplayName(org.bukkit.inventory.ItemStack itemStack, java.lang.String displayName)
itemStack
- The item to set the display name for.displayName
- The new display name.public static void addItemLore(org.bukkit.inventory.ItemStack itemStack, java.lang.String loreLine, boolean replaceAll)
itemStack
- The item stack which receives the lore.loreLine
- The lore line to add to the item stack.replaceAll
- If existing lore should be replaced.public static int roundInventorySize(int inventorySize)
inventorySize
- The raw inventory size.public static void onSpecialItemInventoryClick(org.bukkit.event.inventory.InventoryClickEvent event)
event
- The inventory click event.private static boolean isHotbarItemInteractionValid(org.bukkit.event.inventory.InventoryClickEvent event)
event
- The inventory click event.public static void checkForStaticItemDrop(org.bukkit.event.player.PlayerDropItemEvent event)
event
- The drop event.public static boolean checkForStaticItem(org.bukkit.inventory.ItemStack itemStack)
itemStack
- The item stack to check.