# 🤖 Action Types

In our system's configuration files, you can utilize various action types to perform different actions. These actions enable you to interact with players, broadcast messages, play sounds, set gamemodes, and much more.

## Action Types

| Action List         | Description                                  |
| ------------------- | -------------------------------------------- |
| \[MESSAGE]          | Display a custom message to the player       |
| \[TITLE]            | Display a custom title message to the player |
| \[ACTION\_BAR]      | This is a custom action bar                  |
| \[CLOSE\_INVENTORY] | Close the player's current inventory         |
| \[COMMAND]          | Execute a command (console or player)        |
| \[GAMEMODE]         | Set the player's gamemode                    |
| \[POTION\_EFFECT]   | Apply a potion effect to the player          |
| \[SOUND]            | Play a sound for the player                  |
| \[DELAY]            | A way to delay some actions                  |
| \[OPEN]             | Opens the crate                              |
| \[GOBACK]           | Return to the previous menu                  |

Explore each action type to learn more about its syntax and usage. Examples are provided to illustrate how to use these actions effectively in your system or application.

### **Send Chat Message**

This action sends a custom message to the player.

* **Syntax:** `[MESSAGE] <message>`
* **Example:** `[MESSAGE] &aThis is a custom message`

Semicolons inside the message are kept, so you do not have to escape them.

### **Send Title Message**

This action displays a custom title message to the player.

* **Syntax:** `[TITLE] <title>; <subtitle>; <fadein>; <stay>; <fadeout>`
* **Example:** `[TITLE] &aCustom title;&7Custom Subtitle; 20; 40; 20`

### **Send Action Bar Message**

This action displays a custom action bar message to the player.

* **Syntax:** `[ACTION_BAR] <message>`
* **Example:** `[ACTION_BAR] This is a custom action bar`

### **Close Inventory**

This action closes the inventory the player has open.

* **Syntax:** `[CLOSE_INVENTORY]`
* **Example:** `[CLOSE_INVENTORY]`

### **Execute Command**

This action executes a command either from the console or as a player.

* **Syntax:** `[COMMAND] <target>; <command>`
* **Example:** `[COMMAND] console; mvtp %player% world`&#x20;
* **Example**: `[COMMAND] player; warp spawn`

The target has to be either `console` or `player`. A leading `/` is optional.

> **Info:**
The action itself only replaces `%player%`. Any other placeholder is passed through untouched, so it will only work if the command you are running resolves it.

### **Change Gamemode**

This action sets the gamemode for the player.

* **Syntax:** `[GAMEMODE] <gamemode>`
* **Example:** `[GAMEMODE] adventure`

### **Give Potion Effect**

This action gives the player a potion effect.

* **Syntax:** `[POTION_EFFECT] <effect>; <duration>; <amplifier>`
* **Example:** `[POTION_EFFECT] speed; 5; 2`

The duration is in **seconds**. Any negative value gives an effect that never runs out, so `[POTION_EFFECT] night_vision; -1; 0` is a permanent one.

### **Play Sound**&#x20;

This action plays a sound for the player.

* **Syntax:** `[SOUND] <sound>; <volume>; <pitch>`
* **Example:** `[SOUND] entity_arrow_hit_player; 1; 1`
* **Example:** `[SOUND] minecraft:block.note_block.pling`

The sound is either a vanilla name or a sound key, and a key also plays resource-pack sounds such as `myserver:crate.legendary`. Volume and pitch are optional and default to `1`.

### **Delay**

This action will make a short pause until it continues executing actions.

* **Syntax:** `[DELAY] <seconds>`
* **Example:** `[DELAY] 3`
* **Example:** `[DELAY] 0.5`

Decimals are accepted, so you can pause for less than a second.

### **Open the Crate**

This action opens the crate whose preview menu the player currently has open. It takes no arguments, and it only works from a rewards preview menu, which makes it the way to add an "open now" button to a preview.

* **Syntax:** `[OPEN]`
* **Example:** `[OPEN]`

### **Go Back**

This action returns the player to the menu they came from. If there is no previous menu, the inventory is closed instead. It takes no arguments.

* **Syntax:** `[GOBACK]`
* **Example:** `[GOBACK]`

Source: https://www.phoenixplugins.com/docs/phoenix-crates/plugin-information/action-types