Skip to content
ChronoKeeper edited this page Aug 4, 2020 · 30 revisions

Magic Items

Description:

Magic Items can be defined in any spell file, but they can also be defined in general.yml. This lets you use the same item in multiple places throughout the plugin's configuration without having to define the full Item Type string every time. Besides that magic items have a few extra options for items that the Item Type string doesn't support, and they support Spigot's ItemStack Serialization.

If you want to use ItemStack then the list of options can be found here. You can also generate magic items as ItemStack objects from hand held items using the Item Serialize Spell.

The configuration will go like this:

magic-items:
   # Magic Item name
   item:
       type: external::spigot
       data:
           # This is where the options go.

Otherwise, if you want to define general magic items the options for it can be found here and the configuration would look like this instead:

magic-items:
   # Magic Item name
   item:
       # Options

You can give yourself magic items using the command: /c magicitem (magic item) (quantity)

General Configuration:

Option Description Variable Type
type Item name as defined by Bukkit. You can also use a colon to specify a durability taken from items that have durability. As mentioned above, type can also be the string "external::spigot" to serialise the item from an ItemStack yaml object defined in data. This option is neccessary either way if you want the magic item to be created. String
name The display name for the item. Supports color codes. You can't parse variables using the %var parameters on the item directly, but if this item is an item option on a Menu Spell, they will be parsed. String
lore This is item lore defined as a string list. Its capabilities are the same as above. String List
enchants A string list of enchangments using the format: <ench> <lvl>. If this is defined empty, the item's enchants will be set to a fake one (just the glow). String List
custom-model-data Sets the item's custom model data Integer
hide-tooltip Defines whether all of the item's flags should be hidden. Boolean
attributes A configuration section where any key name can be defined. Format: (attribute name) (value) (operation) (slot). Operation is optional and if it's not one of the valid ones it will assume the operation of add_number, but the valid operations are: add_number, add_scalar and multiply_scalar. (as mentioned, if it's anything else, it will assume add_number) Slot is also optional and can be of the following options: hand, off_hand, feet, legs, chest, head. Configuration Section

Firework Star

Option Description Variable Type
firework-type Type of the firework (ball, ball_large, star, burst, creeper) String
trail Should the firework have a trail? Boolean
flicker Should the firework flicker? Boolean
colors Colors of the firework (hexColors) separated by a comma String
fade-colors Fade colors of the firework (hexColors) separated by a comma String

Fireworks

Option Description Variable Type
firework-effects Firework effects of the rocket. (type) (trail) (flicker) (colors)(,) (fadeColors)(,) String List
power Power of the firework rocket Integer

Suspicious Stew

Option Description Variable Type
potion-effects Potion effects of the stew. (potionEffectType) (duration) String List

Leather Armor

Option Description Variable Type
color Hex color of the leather armor. String

Potion

Option Description Variable Type
potion-effects A string list of status effects from format: (type) (potency) (duration). Add "ambient" or "true" to the string if you want the status effect to be ambient. String List
potion-color Hex color of the potion. String

Skull

Option Description Variable Type
skull-owner This specifies the skull owner. (UUID) String
uuid This specifies the UUID of the skull owner. String
texture This specifies the skull texture. String
signature This specifies the skull signature. String

Items with durability

Option Description Variable Type
repair-cost This specifies the item's repair cost. Integer
unbreakable The item will be unbreakable if this is true. Boolean
durability Sets the item's durability. Integer

Books

Option Description Variable Type
title Book title. It supports color codes. String
author Book author. It supports color codes. String
pages A list of strings that would become the pages of the book. This supports color codes. Next line can be specified with "\n" or you can use the yaml literal style where you start the string with the character "` Any indented text will be considered a string and it preserves line breaks. (Example below)

Banner

Option Description Variable Type
patterns A string list of the banner patterns. Format: (banner pattern) (dye color). Click here for valid dye types, and here for valid banner patterns. String List

Example:

magic-items:
    sun_sword:
        type: "gold_sword"
        name: "&6Sun Sword"
        lore:
          - "&eIt &6glows &ewith the"
          - "&epower of the sun."
    sun_helm:
        type: "leather_helmet"
        name: "&6Sun Helm"
        enchants:
          - "fire_protection 1"
        lore:
          - "&eThe power of the &6sun"
          - "&eprotects you from &cfire&e."
        color: "FFFF55"
    sun_chestplate:
        type: "gold_chestplate"
        name: "&6Sun Chestplate"
        lore:
          - "&eThe power of the &6sun"
          - "&egives you extra &chealth&e."
        attributes:
            - generic.maxhealth 10 add_number
    sun_potion:
        type: "potion"
        name: "&6Sun Potion"
        lore:
          - "&eThe sun's power gives you"
          - "&eprotection from &cfire"
          - "&eand vision during the &8night&e."
        potion-effects:
          - "fire_resistance 0 600"
          - "night_vision 0 600"
    rule_book:
        type: "written_book"
        title: "&4Rule Book"
        author: "&cAdmin"
        pages:
          - Read the rules, they are important.
          - This is page two. It has more rules on it.
          - |
            This is page three.
            It has multiple lines.            
            
            Here's another line.

Magic items can also be used as costs for certain spells and cast items as well. Do note that this will not work if the durability of the item is changed from what its original definition.

magic-items:
    ManaCrystal:
        type: "redstone"
        name: "&bMana Crystal"
        lore:
          - "&7Required when casting magic"
    MagicWand:
        type: "stick"
        name: "&cMagical &6Wand"
        lore:
          - "&7right click to cast magic"

SpeedMagic:
    spell-class: ".targeted.PotionEffectSpell"
    right-click-cast-item: MagicWand
    type: 1
    strength: 1
    duration: 200
    targeted: false
    cost:
        - ManaCrystal 1
Clone this wiki locally