Update Triggers

Ka0rX 2022-08-17 14:59:55 +00:00
parent e89b9b2a22
commit 49548bae88

@ -2,20 +2,36 @@
Triggers are used by MMOCore to execute actions when certain conditions are met. They are used for both quests and professions, and each has a set of actions or objectives that can "trigger" them.
### Trigger Tables (Since 1.9.5)
Since 1.9.5, you can define trigger tables in `triggers.yml`. You can reference each trigger list with its id which will fire all the corresponding triggers.
```
#Example
test-trigger:
- 'command{format="broadcast Triggered!"}'
#Will fire the 2 commands in test-trigger-2
- 'from{source="test-trigger-2"}'
test-trigger-2:
- 'command{format="mmocore admin skill-points give %player% 1"}'
- 'command{format="mmocore admin atr-realloc-points give %player% 3"}'
```
## Available Trigger Types
| Trigger | Description | Format/Example |
|------------|--------------------------------------|-----------------------------------------------------------|
| message | Sends a message to the player. | `message{format="&aYour message here... "}` |
| command | Makes the console perform a command. | `command{format="tellraw @a {"text":"Hello!"}"}` |
| experience | Gives experience in a profession. | `exp{profession=<PROFESSION>;amount=<AMOUNT>}` |
| experience | Gives main class experience. | `exp{amount=<AMOUNT>}` |
| sound | Broadcasts a sound to the player. | `sound{sound=<SOUND_NAME>;volume=<VOLUME>;pitch=<PITCH>}` |
| item | Gives an item to the player. | `item{type=DIAMOND;amount=3}` |
| mmoitem | Gives an mmoitem to the player. | `mmoitem{type=SWORD;id=FALCON_BLADE;amount=2}` |
| mana | Give/take/set player mana. | `mana{operation=<GIVE/SET/TAKE>;amount=2-3}` |
| stamina | Give/take/set player stamina. | `stamina{operation=<GIVE/SET/TAKE>;amount=2-3}` |
| stellium | Give/take set player stellium. | `stellium{operation=<GIVE/SET/TAKE>;amount=2-3}` |
| mmskill | Cast a MythicMobs skill. | `mmskill{id=MythicMobsSkillInternalName}` |
| money | Give/take/set player balance. | `money{operation=<GIVE/SET/TAKE>;amount=2-3}` |
| Trigger | Description | Format/Example |
|---------|-------------|----------------|
| from | Fires all the triggers defined in the corresponding section of `triggers.yml`. | `from{source=trigger-id}` |
| message | Sends a message to the player. | `message{format="&aYour message here... "}` |
| command | Makes the console perform a command. | `command{format="tellraw @a {"text":"Hello!"}"}` |
| experience | Gives experience in a profession. | `exp{profession=<PROFESSION>;amount=<AMOUNT>}` |
| experience | Gives main class experience. | `exp{amount=<AMOUNT>}` |
| sound | Broadcasts a sound to the player. | `sound{sound=<SOUND_NAME>;volume=<VOLUME>;pitch=<PITCH>}` |
| item | Gives an item to the player. | `item{type=DIAMOND;amount=3}` |
| mmoitem | Gives an mmoitem to the player. | `mmoitem{type=SWORD;id=FALCON_BLADE;amount=2}` |
| mana | Give/take/set player mana. | `mana{operation=<GIVE/SET/TAKE>;amount=2-3}` |
| stamina | Give/take/set player stamina. | `stamina{operation=<GIVE/SET/TAKE>;amount=2-3}` |
| stellium | Give/take set player stellium. | `stellium{operation=<GIVE/SET/TAKE>;amount=2-3}` |
| mmskill | Cast a MythicMobs skill. | `mmskill{id=MythicMobsSkillInternalName}` |
| money | Give/take/set player balance. | `money{operation=<GIVE/SET/TAKE>;amount=2-3}` |
All of these types and triggers are shown in the default config with how to properly use them. The message and command triggers support placeholders from [PlaceholderAPI](https://www.spigotmc.org/resources/placeholderapi.6245/).