-
Notifications
You must be signed in to change notification settings - Fork 148
Passive and Triggered Spells
Magic supports triggered passive spells.
A passive spell is one that can not be directly cast by the player. These spells will show up in the player's spell inventory, but selecting or casting it will toggle the spell on/off.
Spells are made passive via a top-level property, such as:
savior:
passive: true
toggleable: false
The ability to toggle a passive spell on/off can be disabled via the toggleable
property.
Passive spells can be obtained via the spell shop like any other spell.
Passive spells will not do anything unless given triggers.
Spells can be triggered by a number of builtin events, or by other spells.
Triggers are set up as top-level properties, and generally go along with the passive
property. A spell can have multiple triggers, and some triggers can have criteria that must be met. For example:
passive: true
triggers:
# This triggers when the player takes fall damage
- trigger: damage
damage_type: fall
The following triggers will fire automatically:
- join : When the player joins the server
-
interval : Every
interval
milliseconds - death : When the player dies
- damage : When the player is damaged
- launch : When the player launches a projectile
- deal_damage : When the player deals damage
- kill : When the player kills a player or mob
Triggers can have requirements, some of these only apply to specific trigger types:
- interval : For the interval trigger, how often it should fire
- max_health : Will not fire if the player has more health than this
- min_health : Will not fire if the player has less health than this
- max_damage : Will not fire if more than this amount of damage was dealt
- min_damage : Will not fire if less than this amount of damage was dealt
- max_bowpull : Will not fire if the player pulled the bow back farther than this (0 - 1)
- min_bowpull : Will not fire if the player did not pull the bow back far enough (0 - 1)
- damage_type : Only fires for one specific damage type
- damage_types : Only fires for a set of damage types
Additionally, the launch
trigger can specify whether or not it should cancel the projectile launch (for instance if you want to swap out an arrow for a magic spell)
Launch is canceled by default, but you can trigger a spell and still fire the arrow by adding this:
cancel_launch: false
A list of vanilla damage types can be found here: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageEvent.DamageCause.html
Custom damage types can also be dealt via the Damage action.
Magic mobs work with a similar set of triggers, but using a slightly different format since the triggers are attached to the mob rather than attached to spells.
See for more information.
See the passives folder for some working examples of passive spells.
- Home
- FAQ
- Support
- Progression
- Spell Points
- Crafting
- Basic Setup
- Customization
- Resource Pack
- Examples
- Messages and Languages
- Vanity Items
- NPCs
- Magic Blocks
- Magic Mobs
- Putting Images on Maps
- Using MySQL or SQLite
- Placeholders
- Skript
- Regions