Item Data Config Format Before v2.24.0 - Shopkeepers/Shopkeepers-Wiki GitHub Wiki

In the past, before Shopkeepers v2.24.0, the format used to specify items inside the config was derived from Bukkit's item serialization, i.e. the default YAML format Bukkit/Spigot uses when a plugin saves or loads items to and from YAML files. Since Shopkeepers v2.24.0, we use a format that more closely matches how Minecraft represents item data and that can be automatically migrated to newer server versions. See Configuration: Item Data.

The following adaptations were made to make it slightly easier to use the format by hand inside the config:

  • The meta data of the item (anything that is located inside the meta section of Bukkit's item serialization) is placed at the same level / the same section as the item's type. For example:
    • Display name, lore, enchantments, etc.
  • Any (common) data that is not required for our purpose or can easily be restored by the plugin is omitted. For example:
    • The item's amount
    • The item's version v
    • The data type ids ==: org.bukkit.inventory.ItemStack and ==: ItemMeta.
      Note that for all other, lower-level item data with these data type ids, they are still required (eg. ==: org.bukkit.attribute.AttributeModifier for attribute modifiers, or ==: Pattern for banner patterns, etc.).
    • The item's meta-type id
  • For specifying an item without any special data, a more compact representation is used. For example:
    shop-creation-item: VILLAGER_SPAWN_EGG
    
    instead of
    shop-creation-item:
      type: VILLAGER_SPAWN_EGG
    

Note: In the past, for the display name and lore, we supported the use of color and formatting codes starting with & instead of Minecraft's legacy color codes starting with §. Example &a for the color green. However, this color code conversion has been removed in recent plugin versions. There have been various occasions in which the Minecraft server made changes to how it converts these legacy formatting codes to the newer internal Json-based text representation. This has caused issues with items created in one version of Minecraft not matching items created in another version. We therefore recommend that instead of using these legacy color codes, you use the newer Json-based text format inside the config directly. See https://minecraft.wiki/w/Raw_JSON_text_format.
Example: Instead of display-name: '§aShopkeeper', use
display-name: '{"text":"Shopkeeper","italic":false,"color":"green"}'.

Note that the YAML format is indention sensitive. If you run into issues with your config not getting loaded correctly, make sure that you are using spaces instead of tabs and check your config with some YAML syntax checker available online, such as for example https://yamlchecker.com/.
Also make sure that you haven't misspelled any of the item's attributes.

Common mistakes:

  • enchantments instead of enchants
  • display name instead of display-name
  • damage instead of Damage

Example:

currency-item:
  type: EMERALD
  display-name: '{"text":"A fancy looking crystal","italic":false,"color":"green"}'
  lore:
  - '{"text":"It looks precious."}'
  - '{"text":"I might be able to sell it."}'
  enchants:
    DURABILITY: 1
  ItemFlags:
  - HIDE_ENCHANTS