PassiveSpell - TheComputerGeek2/MagicSpells GitHub Wiki
This spell extends its options from Spell.
spell-class: ".PassiveSpell"
Passive spells are different from the rest of the spells in a way that they cannot be cast by the cast command, by cast items (clicking) or as sub-spells (by another spell like the Multi spell). Instead, Passive spells are considered as main spells, and they are only cast successfully when the listener listed in triggers
happens. Only then will the Passive spell process its sub-spells listed in spells
.
Based on the trigger specified the sub-spells cast can target entities that have caused them. For instance, a takedamage
trigger fires whenever the caster is attacked. Attaching a pain spell with this trigger will hurt the attacker.
Since 4.0 Beta 13 some of these options support dynamic values through numeric or string expressions.
Option | Description | Type | Default | Supports expression |
---|---|---|---|---|
chance |
The likelihood that the passive spell will cast its sub-spells. | Float | 100 |
true |
delay |
The amount of time in ticks the passive spell will wait before casting spells. | Integer | -1 |
true |
can-trigger |
Target list | String List | players |
false |
ignore-cancelled |
Even if the trigger was cancelled, for instance through other plugins, the passive spell's sub-spells will still be cast when enabled. | Boolean | true |
false |
send-failure-messages |
If the casting failed due to the passive's cooldown or reagents (cost) missing, this controls whether the str-on-cooldown , str-missing-reagents & str-cost should be sent. |
Boolean | false |
false |
cancel-default-action |
Cancel the event that activated this passive spell. For example, cancelling a takedamage trigger would negate the damage. Note that only triggers with the Cancellable property can be cancelled. |
Boolean | false |
false |
require-cancelled-event |
If enabled the trigger must be cancelled for the passive spell to cast its sub-spells. | Boolean | false |
false |
cancel-default-action-when-cast-fails |
Cancels the event if the spells failed to cast. |
Boolean | false |
false |
triggers |
A list of triggers that the passive spell will attach itself to. | String List | false |
|
spells |
A list of sub-spells to cast. Some triggers pass a targeted entity or location involved in the trigger event the spell, if targeted, would be cast on. Note that before 4.0 Beta 14 Buff spells with targeted: false (default) and ExternalCommandSpell with require-player-target: false (default) on targeted triggers were cast on the caster instead of the target, which is no longer the case. |
String List | false |
|
cast-without-target |
When true , any targeted spells cast by the passive are cast without a targeted entity or location, even if one is available. |
Boolean | false |
false |
-
str-on-cooldown
:-
%c
: Returns rounded cooldown.
-
String Format Trigger references the string after the listener is separated by a space. Some listeners have extra data which can be configured there (e.g. ticks 1
).
triggers:
# With string parameters:
- <Listener Name> [String Parameters...]
# Without string parameters:
- <Listener Name>
An event priority can be appended to your listener's name, separated by an _
(e.g. dismount_highestpriority
). This will let your server know in which order of priority to handle all event listeners (not just Passive spells, but events from other sources too).
Priority | Description |
---|---|
highpriority |
Event call is of high importance. |
highestpriority |
Event call is critical and must have the final say in what happens to the event. |
lowpriority |
Event call is of low importance. |
lowestpriority |
Event call is of very low importance and should be run first, to allow other plugins to customise the outcome further. |
monitorpriority |
Event is listened to purely for monitoring the outcome of an event. |
normalpriority |
Event call is neither important nor unimportant and may run normally. |
anvil
blockbreak
blockplace
buff
craft
death
dismount
dropitem
enchant
entitytarget
enterbed
equip
fataldamage
fish
foodlevelchange
gamemodechange
givedamage
grindstone
hitarrow
hotbardeselect
hotbarselect
insideblock
inventoryaction
inventoryclick
inventoryclose
inventoryopen
join
jump
kill
leavebed
leftclickblockcoord
leftclickblocktype
leftclickitem
magicspellsloaded
manachange
missarrow
mount
offhandswap
pickupitem
playeranimate
playermove
playermovetoblock
portalenter
portaleave
Listener Name | Description | TriggerArg | Cancellable | Has Entity Target | Has Location Target |
---|---|---|---|---|---|
potioneffect |
Fires whenever the state of an entity's potion effect status changes. |
(type) (action) (cause) . Each option is a comma separated list. type is a list of potion effect types, action is a list of actions that caused the change in status of the potion effect and cause is the cause of why the potion effect status changed. Each option can be replaced with a wildcard (* ), which matches all types/actions/causes. |
true |
false |
false |
prepareenchant |
Fires whenever a player puts an item in an enchantment table slot. |
item1|item2|... where item follows the Magic Item String format. |
true |
false |
false |
quit |
Fires whenever a player logs off the server. | false |
false |
false |
|
regainhealth |
Fires whenever an entity regenerates health. | Comma-separated list of health regain reasons | true |
false |
false |
resourcepack |
Fires whenever a player's resource pack status changes. | Comma-separated list of resource pack statuses | false |
false |
false |
respawn |
Fires whenever a player respawns. | false |
false |
false |
|
rightclickblockcoord |
Fires whenever a player right-clicks a block at a specified location. | Semi-colon-separated list of locations to listen to, with the format worldname,x,y,z . |
true |
false |
true |
rightclickblocktype |
Fires whenever a player right-clicks a block. | Comma-separated list of block materials to listen to. | true |
false |
true |
rightclickentity |
Fires whenever a player right-clicks an entity. | Comma-separated list of entity types to listen to. | true |
true |
true |
rightclickitem |
Fires whenever a player right-clicks. |
item1|item2|... where item follows the Magic Item String format. |
true |
false |
false |
sheepshear |
Fires whenever a player shears a sheep. | Comma-separated list of dye colors. | true |
true |
false |
shoot |
Fires whenever an entity shoots a bow. | true |
false |
false |
|
signbook |
Fires whenever a player edits a book. | Comma-separated list of pages. If specified, the trigger will only activate if the edited book contains a page specified. | true |
false |
false |
smith |
Fires whenever a player puts an item in a smithing table slot. |
(firstItems) (secondItems) (resultItems) where arguments can be any or items following the Magic Item String format separated by a | . |
true |
false |
false |
spellcast |
Fires whenever an entity has started casting a spell. | String-based Spell Filter. | true |
false |
false |
spellcasted |
Fires whenever an entity has finished casting a spell. | String-based Spell Filter. | false |
false |
false |
spellselect |
Fires whenever a player has selected a spell on a cast item or bound item. | String-based Spell Filter. | false |
false |
false |
spelltarget |
Fires whenever an entity has targeted another entity with a spell. | String-based Spell Filter. | true |
true |
false |
spelltargeted |
Fires whenever an entity has been targeted by another entity with a spell. | String-based Spell Filter. | true |
true |
false |
startfly |
Fires whenever a player starts flying. | true |
false |
false |
|
startglide |
Fires whenever an entity starts gliding. | true |
false |
false |
|
startpose |
Since 4.0 Beta 14. Fires whenever an entity starts posing with a specific pose. |
pose_1,pose_2,... (list of Poses) |
false |
false |
false |
startsneak |
Fires whenever a player starts sneaking. | true |
false |
false |
|
startsprint |
Fires whenever a player starts sprinting. | true |
false |
false |
|
startswim |
Fires whenever an entity starts swimming. | Bugged. Removed since 4.0 Beta 14. | false |
false |
|
stopfly |
Fires whenever a player stops flying. | true |
false |
false |
|
stopglide |
Fires whenever an entity stops gliding. | true |
false |
false |
|
stoppose |
Since 4.0 Beta 14. Fires whenever an entity stops posing with a specific pose. |
pose_1,pose_2,... (list of Poses) |
false |
false |
false |
stopsneak |
Fires whenever a player stops sneaking. | true |
false |
false |
|
stopsprint |
Fires whenever a player stops sprinting. | true |
false |
false |
|
stopswim |
Fires whenever an entity stops swimming. | Bugged. Removed since 4.0 Beta 14. | false |
false |
|
takedamage |
Fires whenever an entity takes damage from another entity. |
item1|item2|... (where item follows the Magic Item String format). Among items you can put damage causes. |
true |
true |
false |
teleport |
Fires whenever a player teleports. | Comma separated list of teleport causes. | true |
false |
false |
ticks |
Fires on a tick interval defined. | Server ticks | false |
false |
false |
unequip |
Fires whenever a player removes their armor. |
item1|item2|... where item follows the Magic Item String format. |
false |
false |
false |
worldchange |
Fires whenever a player teleports to another world. | Comma-separated list of world names. | true |
false |
false |
darkcloak:
spell-class: ".PassiveSpell"
triggers:
- ticks 20
spells:
- darkcloak_invis
modifiers:
- lightlevel <7 required