Class XItemStack

java.lang.Object
com.cryptomorin.xseries.XItemStack

public class XItemStack
extends Object
XItemStack - YAML Item Serializer
Using ConfigurationSection Example:
     ConfigurationSection section = plugin.getConfig().getConfigurationSection("staffs.dragon-staff");
     ItemStack item = XItemStack.deserialize(section);
 
ItemStack: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ItemStack.html
Version:
3.1.1
Author:
Crypto Morin
See Also:
XMaterial, XPotion, SkullUtils, XEnchantment, ItemStack
  • Constructor Summary

    Constructors 
    Constructor Description
    XItemStack()  
  • Method Summary

    Modifier and Type Method Description
    static org.bukkit.inventory.ItemStack deserialize​(org.bukkit.configuration.ConfigurationSection config)
    Deserialize an ItemStack from the config.
    static Map<Integer,​org.bukkit.inventory.ItemStack> giveOrDrop​(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack... items)
    Adds a list of items to the player's inventory and drop the items that did not fit.
    static org.bukkit.Color parseColor​(String str)
    Parses RGB color codes from a string.
    static void serialize​(org.bukkit.inventory.ItemStack item, org.bukkit.configuration.ConfigurationSection config)
    Writes an ItemStack object into a config.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • serialize

      public static void serialize​(org.bukkit.inventory.ItemStack item, org.bukkit.configuration.ConfigurationSection config)
      Writes an ItemStack object into a config. The config file will not save after the object is written.
      Parameters:
      item - the ItemStack to serialize.
      config - the config section to write this item to.
      Since:
      1.0.0
    • deserialize

      public static org.bukkit.inventory.ItemStack deserialize​(org.bukkit.configuration.ConfigurationSection config)
      Deserialize an ItemStack from the config.
      Parameters:
      config - the config section to deserialize the ItemStack object from.
      Returns:
      a deserialized ItemStack.
      Since:
      1.0.0
    • parseColor

      public static org.bukkit.Color parseColor​(String str)
      Parses RGB color codes from a string. This only works for 1.13 and above.
      Parameters:
      str - the RGB string.
      Returns:
      a color based on the RGB.
      Since:
      1.1.0
    • giveOrDrop

      public static Map<Integer,​org.bukkit.inventory.ItemStack> giveOrDrop​(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack... items)
      Adds a list of items to the player's inventory and drop the items that did not fit.
      Parameters:
      player - the player to give the items to.
      items - the items to give.
      Returns:
      the items that did not fit and were dropped.
      Since:
      2.0.1