Add abilities to a class
Give a class right-click abilities, choose who they reach and what they cost, and add effects that run while an item is held.
At the end of this page a class has an item players right-click to get an effect, on themselves, their clan or the enemies around them, with a cooldown and optionally an energy cost. You can also add an effect that runs while the item sits in the main hand.
Before you start#
You need a class file to edit: see Edit or add a class. If the ability should cost energy, give the class an energy block first: see Energy.
Steps#
Open the class file
Open plugins/ExyliaClasses/lang/<language>/classes/<Class>.yml, for example Archer.yml.
Add the item under abilities
The key is the material players right-click. Add a name, who it reaches (type), the effects and a cooldown:
abilities:
SUGAR:
display-name: "<#ffd82b><bold>SPEED"
type: TO_CLAN
radius: 20
effects:
- SPEED|3|5
cooldown: 7
energy-cost: 35
particles:
enabled: true
type: "CRIT|60|1|1|1|1"
sound:
enabled: true
type: "BLOCK_NOTE_BLOCK_GUITAR|1|2"Effects are written NAME|LEVEL|SECONDS; see the notation.
Reload
Run /classesadmin reload.
Get the item and use it
Put on the class armour, give yourself the item (/give @s minecraft:sugar) and right-click with it.
Check that it works#
Chat says you used the ability, the effect appears in your status icons, one item is used up and the item goes on cooldown. Using it again early tells you how many seconds remain. If the class has energy and the bar is too low, you are told what you need and what you have. An ability that does nothing is usually an ability on a class with no energy and an energy-cost above zero; see Common problems.
Going further#
Choose who it reaches#
type decides who is hit, and radius is the reach for the types that leave the caster.
| Type | Who it reaches |
|---|---|
SELF | The caster. radius is ignored. |
TO_CLAN | The caster, plus every online clan member inside radius, in the same world. |
TO_CLAN_AND_ALLY | Identical to TO_CLAN today. |
TO_ENEMY | Every player inside radius in the same world who is not in the caster's clan. The caster is excluded. |
TO_ALLY | Nobody. |
An unrecognised type falls back to SELF.
It resolves to an empty target list, so an ability declared TO_ALLY still costs energy, still starts its cooldown and still consumes the item, and applies nothing. Use TO_CLAN until that changes.
Clan membership is answered by ExyliaLib, which detects FactionsUUID, HuskTowns, ZelTeams, RunithClans, UltimateClans, Kingdoms, SimpleClans or ExyliaClans. With none of them installed, TO_CLAN reaches only the caster and TO_ENEMY reaches everyone in range, because nobody shares a clan with anybody. On a server without clans, a 25-block Sorcerer debuff hits allies too.
Tell the people it hit#
Everyone but the caster is told what landed on them. TO_CLAN, TO_CLAN_AND_ALLY and TO_ALLY use the abilities.clan message; TO_ENEMY uses abilities.enemy. SELF sends nothing, because there is nobody else. Both are in messages.yml; see also Messages and languages.
Add an effect while an item is held#
A hold effect has the same targeting, with no cost, no cooldown and no consumption: the price is holding the item instead of a weapon.
hold-effects:
SUGAR:
type: TO_CLAN
radius: 20
effects:
- SPEED|2|5Every half second the plugin looks at the main hand of each player in a class with hold effects, and applies the matching entry's effects.
The refresh is every ten ticks, so an effect written |5 is re-applied with four and a half seconds still on it and never blinks. A one-second duration would flicker, and the moment the player swaps items the effect runs out on its own, which is how a hold effect ends. Nothing removes it early.
The Bard ships with the same seven materials in both blocks: holding sugar gives the clan Speed II continuously, right-clicking it spends 35 energy for Speed III. That is the intended shape: a weak aura for free, a strong burst for a cost.
Ability keys
| Key | Default | What it does |
|---|---|---|
display-name | the material | The name used in messages. Colours work. |
type | SELF | Who the effects land on. |
effects | none | Effect lines, `NAME |
cooldown | 30 | Seconds. 0 disables the cooldown entirely. |
energy-cost | 0 | Energy spent. Requires an energy block on the class. |
radius | 0 | Blocks, for the types that need one. |
particles | off | Shown on every target, at their own location. |
sound | off | Played to the caster only. |
The map key is the material a player right-clicks. An unknown material is logged and skipped.
Hold effect keys
| Key | Default | What it does |
|---|---|---|
type | SELF | The same five values as an ability. |
radius | 0 | Blocks. |
effects | none | Effect lines. |
What happens on a right-click
- The item is checked. The player must be in a class, and the item in hand must be one of that class's ability materials. Otherwise the click is left alone.
- The interaction is cancelled. As soon as the item matches, the vanilla right-click is cancelled, so an ability on a bow or a food item will not also shoot or eat.
- Cooldown, then energy. Still on cooldown, or not enough energy, and the player is told and nothing else happens. The item is not spent.
- Effects, particles, sound. The effects are applied to every target, particles are shown at each of them, the sound plays for the caster, and everyone hit other than the caster gets a message.
- One item is consumed, only after all of that. A stack loses one; a single item disappears from the main hand.
Cooldowns are per material, per player. Two abilities on the same material in different classes share the same cooldown slot. A cooldown runs out on its own: leaving the class, swapping armour, dying, relogging or /classesadmin reload does not reset it, and the client-side timer is drawn again on join and respawn.
Something missing on this page? Tell us on Discord