Sueta

ItemSaver

1.2.3

Serialize and Deserialize ItemStacks

·Plugin

Description:

This plugin allows the serialization and deserialization of ItemStacks with simple commands. In other words, you can save an ItemStack to a file and retrieve it later with a custom give command.

Permissions:

  • itemsaver.use default op - Allows use of plugin commands

Commands:

  • /save-item <path> - path is the unique id for that item in the data file
  • /give-item <path> [amount] - path is the unique id for the item, amount will override the set amount and use a custom amount instead
  • /itemsaver reload config - reloads the config file
  • /itemsaver reload items - reloads the items file

Creating Custom Items:
You can create custom items by adding them directly to items.yml if you don't want to use /save-item in game. Just follow the example below:

NOTE: Only material and amount fields are required

Example Item Serialization:

Example
# Item name
example:
  # Material for item. A list of Materials can be found here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html
  material: PAPER
  # Just the amount of items in the stack (can be overwritten with the /give-item command)
  amount: 1
  # Display Name (use '&' for color codes)
  displayname: '&6Example'
  # Lore List (use '&' for color codes)
  lore:
   - &bLore Line 1
  - &cLore Line 2
  # Enchantments ("minecraft id": level)
  enchants:
    looting: 3
    fire_aspect: 2
    sharpness: 5


Config:

Config
#Whether or not to add example item to items.yml on enable
example: true

messages:
  prefix: "&7[&bItemSaver&7] &e"

  no-permission: "&cYou do not have permission to use that command."
  console: "You cannot use this command from the console."
  save-item:
    invalid:
      no-args: "Invalid Command. Usage: /save-item <path>"
      to-many-args: "Invalid Command because of excess arguments. Usage: /save-item <path>"
    overwriting: "&cOverwriting Previous Entry For: %PATH%"
    added-to-file: "Added %PATH% to items.yml"
  give-item:
    invalid:
      no-args: "Invalid Command. Usage: /give-item <path> [amount]"
      to-many-args: "Invalid Command because of excess arguments. Usage: /give-item <path> [amount]"
    deserial-error: "&cAn error occurred deserializing %PATH%. Make sure that you spelled it correctly and that it is a valid entry in items.yml"
    number-format-exception: "&cThe second argument could not be parsed to an integer. Make sure you spelled it correctly and try again."
    add-to-inv: "Added %PATH% to inventory"
  reload:
    config: "Reloaded Config"
    items: "Reloaded Items"
    no-args: "Invalid Command. Usage: /itemsaver reload <config | items>"
    to-many-args: "Invalid Command because of excess arguments. Usage: /itemsaver reload <config | items>"
    unknown-arg: "Invalid Command. Unknown argument %ARG%. Usage: /itemsaver reload <config | items>"


Dev Notes:

Some features that I would like to add in the future include:

  • Storing Item Flags
  • Storing Unbreakable status
  • Storing durability value
  • Storing Custom Model Data

Similar projects

Plugin →