Class ItemSerializer

java.lang.Object
dev.demeng.pluginbase.serialize.ItemSerializer

public class ItemSerializer extends Object
The YAML serializer for Bukkit ItemStacks.
See Also:
  • XItemStack
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull org.bukkit.inventory.ItemStack
    deserialize(@NotNull org.bukkit.configuration.ConfigurationSection section)
    Deserializes the configuration section into an item stack.
    static @NotNull org.bukkit.inventory.ItemStack
    deserialize(@NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable UnaryOperator<String> transformer)
    Deserializes the configuration section into an item stack.
    static @NotNull org.bukkit.inventory.ItemStack
    deserializeLocalized(@NotNull org.bukkit.configuration.ConfigurationSection section, @NotNull org.bukkit.command.CommandSender sender)
     
    static @NotNull org.bukkit.inventory.ItemStack
    deserializeLocalized(@NotNull org.bukkit.configuration.ConfigurationSection section, @NotNull org.bukkit.command.CommandSender sender, @Nullable UnaryOperator<String> transformer)
     
    static @NotNull org.bukkit.inventory.ItemStack
    deserializeLocalized(@NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable Locale locale)
     
    static @NotNull org.bukkit.inventory.ItemStack
    deserializeLocalized(@NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable Locale locale, @Nullable UnaryOperator<String> transformer)
    Deserializes the configuration section into an item stack with localization.
    static @NotNull org.bukkit.inventory.ItemStack
    deserializeLocalizedDef(@NotNull org.bukkit.configuration.ConfigurationSection section)
     
    static @NotNull org.bukkit.inventory.ItemStack
    deserializeLocalizedDef(@NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable UnaryOperator<String> transformer)
     
    static void
    serialize(@NotNull org.bukkit.inventory.ItemStack stack, @NotNull org.bukkit.configuration.ConfigurationSection section)
    Serializes the item stack into the configuration section.

    Methods inherited from class java.lang.Object

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

    • ItemSerializer

      public ItemSerializer()
  • Method Details

    • serialize

      public static void serialize(@NotNull @NotNull org.bukkit.inventory.ItemStack stack, @NotNull @NotNull org.bukkit.configuration.ConfigurationSection section)
      Serializes the item stack into the configuration section. The configuration file is not saved after serialization.
      Parameters:
      section - The section the item stack will be serialized into
    • deserialize

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack deserialize(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable @Nullable UnaryOperator<String> transformer)
      Deserializes the configuration section into an item stack.
      Parameters:
      section - The configuration section to deserialize
      transformer - The transformer for strings in the item
      Returns:
      The deserialized item stack
    • deserialize

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack deserialize(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section)
      Deserializes the configuration section into an item stack.
      Parameters:
      section - The configuration section to deserialize
      Returns:
      The deserialized item stack
    • deserializeLocalized

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack deserializeLocalized(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable @Nullable Locale locale, @Nullable @Nullable UnaryOperator<String> transformer)
      Deserializes the configuration section into an item stack with localization.
      Parameters:
      section - The configuration section to deserialize
      locale - The locale to use for localization
      transformer - The transformer for strings in the item
      Returns:
      The deserialized item stack
    • deserializeLocalized

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack deserializeLocalized(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable @Nullable Locale locale)
    • deserializeLocalized

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack deserializeLocalized(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section, @NotNull @NotNull org.bukkit.command.CommandSender sender, @Nullable @Nullable UnaryOperator<String> transformer)
    • deserializeLocalized

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack deserializeLocalized(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section, @NotNull @NotNull org.bukkit.command.CommandSender sender)
    • deserializeLocalizedDef

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack deserializeLocalizedDef(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable @Nullable UnaryOperator<String> transformer)
    • deserializeLocalizedDef

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack deserializeLocalizedDef(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section)