Class ItemUtils

java.lang.Object
nl.mtvehicles.core.infrastructure.utils.ItemUtils

public class ItemUtils extends Object
Methods for creating items in plugin's menus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    HashMap containing information of what is being edited by players
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.inventory.ItemStack
    createVoucher​(String carUUID)
    Create a new voucher.
    static org.bukkit.Material
    getMaterial​(String string)
    Get material from string (e.g.
    static org.bukkit.inventory.ItemStack
    getMenuCustomItem​(@NotNull org.bukkit.Material material, String name, int durability, String... lore)
    Get a custom menu item which has a custom texture (e.g.
    static org.bukkit.inventory.ItemStack
    getMenuCustomItem​(@NotNull org.bukkit.Material material, String name, int durability, List<String> lore)
    Get a custom menu item which has a custom texture (e.g.
    static org.bukkit.inventory.ItemStack
    getMenuCustomItem​(@NotNull org.bukkit.Material material, String nbtKey, @Nullable Object nbtValue, String name, int durability, String... lore)
    Get a custom menu item which has a custom texture (e.g.
    static org.bukkit.inventory.ItemStack
    getMenuCustomItem​(@NotNull org.bukkit.Material material, String nbtKey, @Nullable Object nbtValue, String name, int durability, List<String> lore)
    Get a custom menu item which has a custom texture (e.g.
    static org.bukkit.inventory.ItemStack
    getMenuGlowingItem​(@NotNull org.bukkit.Material material, int amount, String name, String... lores)
    Get a glowing menu item by material, amount, name and lore (as multiple Strings).
    static org.bukkit.inventory.ItemStack
    getMenuGlowingItem​(@NotNull org.bukkit.Material material, int amount, String name, List<String> lores)
    Get a glowing menu item by material, amount, name and lore (as List).
    static org.bukkit.inventory.ItemStack
    getMenuItem​(@NotNull org.bukkit.Material material, int amount, int durability, boolean unbreakable, String name, List<String> lores)
    Get a menu item by material, amount, durability, unbreakability (boolean), name and lore (as List)
    static org.bukkit.inventory.ItemStack
    getMenuItem​(@NotNull org.bukkit.Material material, int amount, int durability, String name, String... lores)
    Get a menu item by material, amount, durability, name and lore (as multiple Strings).
    static org.bukkit.inventory.ItemStack
    getMenuItem​(@NotNull org.bukkit.Material material, int amount, int durability, String name, List<String> lores)
    Get a menu item by material, amount, durability, unbreakability (boolean), name and lore (as multiple Strings)
    static org.bukkit.inventory.ItemStack
    getMenuItem​(@NotNull org.bukkit.Material material, int amount, String name, String... lores)
    Get a menu item by material, amount, name and lore (as multiple Strings)
    static org.bukkit.inventory.ItemStack
    getMenuItem​(@NotNull org.bukkit.Material material, int amount, String name, List<String> lores)
    Get a menu item by material, amount, name and lore (as List)
    static org.bukkit.inventory.ItemStack
    getMenuItem​(String materialName, String materialLegacyName, short legacyData, int amount, String name, String... lores)
     
    static org.bukkit.inventory.ItemStack
    getMenuItem​(String materialName, String materialLegacyName, short legacyData, int amount, String name, List<String> lores)
    Get a menu item by material, amount, name and lore (as List).
    static org.bukkit.inventory.ItemStack
    getMenuMembersItem​(String licensePlate)
    Get menu item about members/passengers.
    static org.bukkit.inventory.ItemStack
    getMenuRidersItem​(String licensePlate)
    Get menu item about riders/drivers.
    static org.bukkit.inventory.ItemStack
    getMenuVehicle​(@NotNull org.bukkit.Material material, int durability, String name)
    Get item used in vehicle menu.
    static org.bukkit.Material
    Get the stained glass pane material
    static org.bukkit.inventory.ItemStack
    getVehicleItem​(@NotNull org.bukkit.Material material, int durability, @Nullable Boolean glowing, String name, String licensePlate)
    Restore a vehicle item with a known license plate (used in /vehicle restore and #spawnVehicle(...)).
    static org.bukkit.inventory.ItemStack
    getVehicleItem​(@NotNull org.bukkit.Material material, int durability, Boolean glowing, String name, String licensePlate, String nbtKey, @Nullable Object nbtValue)
    Restore a vehicle item with a known license plate and a custom NBT (used in /vehicle restore).
    static org.bukkit.inventory.ItemStack
    getVehicleItem​(@NotNull org.bukkit.Material material, int durability, String name)
    Create a new vehicle item (used in "Choose vehicle menu" and #getCarItem(...)).
    static org.bukkit.inventory.ItemStack
    getVehicleItem​(@NotNull org.bukkit.Material material, int durability, String name, String nbtKey, @Nullable Object nbtValue)
    Create a new vehicle item with a custom NBT (used in "Choose vehicle menu" and #getCarItem(...)).
    static org.bukkit.inventory.ItemStack
    getVehicleItem​(String licensePlate)
    Restore a vehicle item with a known license plate (will use data from VehicleData.yml).
    static org.bukkit.inventory.ItemStack
    getVehicleItem​(String licensePlate, boolean nbt)
    Restore a vehicle item with a known license plate (will use data from VehicleData.yml).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • edit

      public static HashMap<String,​Boolean> edit
      HashMap containing information of what is being edited by players
  • Constructor Details

    • ItemUtils

      public ItemUtils()
  • Method Details

    • getMaterial

      public static org.bukkit.Material getMaterial(String string)
      Get material from string (e.g. 'DIAMOND_HOE'). Accepts legacy names.
      Parameters:
      string - Material as a String
      Returns:
      Material
    • getMenuVehicle

      public static org.bukkit.inventory.ItemStack getMenuVehicle(@NotNull @NotNull org.bukkit.Material material, int durability, String name)
      Get item used in vehicle menu. Updated method (used to be #carItem(...)).
    • getVehicleItem

      public static org.bukkit.inventory.ItemStack getVehicleItem(@NotNull @NotNull org.bukkit.Material material, int durability, String name)
      Create a new vehicle item (used in "Choose vehicle menu" and #getCarItem(...)). Updated method (used to be #carItem2(...)).
    • getVehicleItem

      public static org.bukkit.inventory.ItemStack getVehicleItem(@NotNull @NotNull org.bukkit.Material material, int durability, String name, String nbtKey, @Nullable @Nullable Object nbtValue)
      Create a new vehicle item with a custom NBT (used in "Choose vehicle menu" and #getCarItem(...)). Updated method (used to be #carItem3(...)).
    • getVehicleItem

      public static org.bukkit.inventory.ItemStack getVehicleItem(@NotNull @NotNull org.bukkit.Material material, int durability, @Nullable @Nullable Boolean glowing, String name, String licensePlate)
      Restore a vehicle item with a known license plate (used in /vehicle restore and #spawnVehicle(...)). Updated method (used to be #carItem5(...)).
    • getVehicleItem

      public static org.bukkit.inventory.ItemStack getVehicleItem(String licensePlate)
      Restore a vehicle item with a known license plate (will use data from VehicleData.yml).
      Since:
      2.5.1
      See Also:
      getVehicleItem(String, boolean), getVehicleItem(Material, int, Boolean, String, String)
    • getVehicleItem

      public static org.bukkit.inventory.ItemStack getVehicleItem(String licensePlate, boolean nbt)
      Restore a vehicle item with a known license plate (will use data from VehicleData.yml).
      Parameters:
      licensePlate - Vehicle's license plate
      nbt - Whether the item has an NBT
      Since:
      2.5.1
      See Also:
      getVehicleItem(String)
    • getVehicleItem

      public static org.bukkit.inventory.ItemStack getVehicleItem(@NotNull @NotNull org.bukkit.Material material, int durability, Boolean glowing, String name, String licensePlate, String nbtKey, @Nullable @Nullable Object nbtValue)
      Restore a vehicle item with a known license plate and a custom NBT (used in /vehicle restore). Updated method (used to be #carItem4(...)).
    • getMenuItem

      public static org.bukkit.inventory.ItemStack getMenuItem(String materialName, String materialLegacyName, short legacyData, int amount, String name, List<String> lores)
      Get a menu item by material, amount, name and lore (as List). Used for items whose Material name has been changed between versions. An updated method (used to be #woolItem(...)).
    • getMenuItem

      public static org.bukkit.inventory.ItemStack getMenuItem(String materialName, String materialLegacyName, short legacyData, int amount, String name, String... lores)
    • getMenuItem

      public static org.bukkit.inventory.ItemStack getMenuItem(@NotNull @NotNull org.bukkit.Material material, int amount, String name, List<String> lores)
      Get a menu item by material, amount, name and lore (as List)
    • getMenuItem

      public static org.bukkit.inventory.ItemStack getMenuItem(@NotNull @NotNull org.bukkit.Material material, int amount, String name, String... lores)
      Get a menu item by material, amount, name and lore (as multiple Strings)
    • getMenuGlowingItem

      public static org.bukkit.inventory.ItemStack getMenuGlowingItem(@NotNull @NotNull org.bukkit.Material material, int amount, String name, List<String> lores)
      Get a glowing menu item by material, amount, name and lore (as List). (Used to be #glowItem(). Updated.)
    • getMenuGlowingItem

      public static org.bukkit.inventory.ItemStack getMenuGlowingItem(@NotNull @NotNull org.bukkit.Material material, int amount, String name, String... lores)
      Get a glowing menu item by material, amount, name and lore (as multiple Strings). (Used to be #glowItem(). Updated.)
    • getMenuItem

      public static org.bukkit.inventory.ItemStack getMenuItem(@NotNull @NotNull org.bukkit.Material material, int amount, int durability, boolean unbreakable, String name, List<String> lores)
      Get a menu item by material, amount, durability, unbreakability (boolean), name and lore (as List)
    • getMenuItem

      public static org.bukkit.inventory.ItemStack getMenuItem(@NotNull @NotNull org.bukkit.Material material, int amount, int durability, String name, List<String> lores)
      Get a menu item by material, amount, durability, unbreakability (boolean), name and lore (as multiple Strings)
    • getMenuItem

      public static org.bukkit.inventory.ItemStack getMenuItem(@NotNull @NotNull org.bukkit.Material material, int amount, int durability, String name, String... lores)
      Get a menu item by material, amount, durability, name and lore (as multiple Strings). (Unbreakable is set to false.)
    • getStainedGlassPane

      public static org.bukkit.Material getStainedGlassPane()
      Get the stained glass pane material
    • getMenuRidersItem

      public static org.bukkit.inventory.ItemStack getMenuRidersItem(String licensePlate)
      Get menu item about riders/drivers. An updated method (used to be #mItemRiders(...)).
    • getMenuMembersItem

      public static org.bukkit.inventory.ItemStack getMenuMembersItem(String licensePlate)
      Get menu item about members/passengers. An updated method (used to be #mItemMembers(...)).
    • getMenuCustomItem

      public static org.bukkit.inventory.ItemStack getMenuCustomItem(@NotNull @NotNull org.bukkit.Material material, String name, int durability, List<String> lore)
      Get a custom menu item which has a custom texture (e.g. vehicle or a jerry can). Get lore from a List of Strings. An updated method (used to be #mItem2(...)).
    • getMenuCustomItem

      public static org.bukkit.inventory.ItemStack getMenuCustomItem(@NotNull @NotNull org.bukkit.Material material, String name, int durability, String... lore)
      Get a custom menu item which has a custom texture (e.g. vehicle or a jerry can). Get lore from multiple Strings. An updated method (used to be #mItem2(...)).
    • getMenuCustomItem

      public static org.bukkit.inventory.ItemStack getMenuCustomItem(@NotNull @NotNull org.bukkit.Material material, String nbtKey, @Nullable @Nullable Object nbtValue, String name, int durability, List<String> lore)
      Get a custom menu item which has a custom texture (e.g. vehicle or a jerry can) with a custom NBT. Get lore from a List of Strings. An updated method (used to be #mItem3(...)).
    • getMenuCustomItem

      public static org.bukkit.inventory.ItemStack getMenuCustomItem(@NotNull @NotNull org.bukkit.Material material, String nbtKey, @Nullable @Nullable Object nbtValue, String name, int durability, String... lore)
      Get a custom menu item which has a custom texture (e.g. vehicle or a jerry can) with a custom NBT. Get lore from multiple Strings. An updated method (used to be #mItem3(...)).
    • createVoucher

      public static org.bukkit.inventory.ItemStack createVoucher(String carUUID)
      Create a new voucher. An updated method.
      Parameters:
      carUUID - UUID of the car (to be found in vehicles.yml)