Magic Items - TheComputerGeek2/MagicSpells GitHub Wiki

Description:

  • Predefined 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 configuration in multiple places throughout the plugin without having to write the same full item multiple times.
  • You can pre-define them under the magic-items configuration section:
magic-items:
    <internal name>: . . .
        . . .
  • Aside from spells like ConjureSpell, you can give yourself predefined magic items using the /ms magicitem command.
  • You can define them with:
magic-items:
    golden_stick: 'stick{name: "<gold>Golden Stick"}'
magic-items:
    golden_stick:
        type: stick
        name: "<gold>Golden Stick"
        # . . .

Attributes:

Ignored Attributes:

Magic items can sometimes be used as item filters, such as in modifier conditions and passive triggers. Options that have been explicitly defined (and in the case of lists, not empty) are used when comparing an item matches a magic item. If the item has an attribute that differs from what is defined in an option, the item does not match the magic item. Options listed in ignored-attributes are ignored in this comparison. For example, the following item would match any stone sword with 20 durability damage, ignoring any other attribute.

magic-items:
    broken-sword:
        type: "stone_sword"
        durability: 20

However, the following would match any sword, regardless of durability.

magic-items:
    broken-sword:
        type: "stone_sword"
        durability: 20
        ignored-attributes:
            - durability

Blacklisted Attributes:

Similar to ignored-attributes, except that any option defined in blacklisted-attributes is not allowed to exist on an item when it is compared to a magic item. For example, the following would match any redstone item, regardless of name, lore or enchantments.

magic-items:
    redstone-cost:
        type: "redstone"

However, the following would only match redstone items that do not have a custom name, lore or enchantments.

magic-items:
    redstone-cost:
        type: "redstone"
        blacklisted-attributes:
            - name
            - lore
            - enchants

Uses:

In most cases where magic items can be specified, usage of the inline Magic Item String format is also supported. Some major uses of magic items are shown below.

Reagent Costs:

magic-items:
    mana-crystal:
        type: "redstone"
        name: "&bMana Crystal"
        lore:
            - "&7Required when casting magic."

heal:
    spell-class: ".targeted.PotionEffectSpell"
    name: "Heal"
    target-self: true
    strength: 1
    duration: 1
    type: "instant_health"
    cost:
        - "mana-crystal 1"

Modifiers:

Certain modifiers conditions take magic items as arguments.

magic-items:
    essense-stick:
        type: "stick"
        name: "&aEssense Stick"

lift:
    spell-class: ".targeted.PotionEffectSpell"
    name: "Lift"
    modifiers:
        - "holdingprecise essense-stick required"
    target-self: true
    duration: 200
    strength: 1
    type: "jump_boost"

Passive Triggers:

Certain passive triggers take magic items as arguments.

magic-items:
    heavy-sword:
        type: "wooden_sword"
        name: "&#99876b&lHeavy &#99876bSword"

heavy_damage:
    spell-class: ".PassiveSpell"
    triggers:
        - givedamage heavy-sword
    spells:
        - heavy_pain(mode=full)

heavy_pain:
    spell-class: ".targeted.PainSpell"
    damage: 10
    str-cast-target: "&cYou've been heavily damaged!"

Cast Items:

magic-items:
    booster-wand:
        type: "stick"
        name: "&eBooster &6Wand"
        lore:
            - "&7Grants the user the ability to boost."

boost:
    spell-class: ".targeted.PotionEffectSpell"
    name: "Boost"
    cast-item: "booster-wand"
    target-self: true
    duration: 200
    strength: 1
    type: "speed"
magic-items:
    magic-wand:
        type: "stick"
        name: "&cMagical &6Wand"
        lore:
          - "&7Right click to cast magic."

regen_magic:
    spell-class: ".targeted.PotionEffectSpell"
    right-click-cast-item: "magic-wand"
    target-self: true
    duration: 200
    strength: 1
    type: "regeneration"
⚠️ **GitHub.com Fallback** ⚠️