> For the complete documentation index, see [llms.txt](https://plugins-1.gitbook.io/plugins/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://plugins-1.gitbook.io/plugins/apis/lib/general/action-manager.md).

# Action Manager

We've created an easy yet modular action management system allowing server owners to configure certain actions easily via code - useful when players are redeeming 'rewards' and would rather broadcast a message directly than require another plugin to do so.

### 1. Configuring your manager.

You'll first want to create your manager object like so.

```java
ActionManager actionManager = new ActionManager();
```

### 2. Adding the default actions.

Then you can optionally add the default actions if you so desire.

```java
actionManager.addDefaults();
```

These will add the following actions:

* **\[CONSOLE]** \<console command>.
* **\[PLAYER]** \<player command>.
* **\[BROADCAST]** \<message to everyone>.
* **\[MESSAGE]** \<message to target player>.
* **\[CHAT]** \<make the player send a message>.
* **\[CLOSE]** \<close the players inventory>.

You may use **%player%** to get the players username for these.

### 3. Creating custom actions.

You can create actions by specifing its ID, alongside the code you wish to execute for this particular action. In our example, "sendmessage" will correlate to **\[SENDMESSAGE]** for our player actions.

```java
actionManager.addAction("sendmessage", (player, data) -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), data));
```

### 4. Executing your actions.

In the below example, we've created a list of various actions we wish to execute and then ran our action manager on them.

```java
 List<String> someActions = Arrays.asList(
 "[console] tell %player% You clicked a " + swordType + " sword!",
 "[chat] I love my new sword! :o"
 );
actionManager.runActions(player, someActions);
```

It's THAT easy!&#x20;
