> For the complete documentation index, see [llms.txt](https://phantom-development.gitbook.io/phantom-development-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://phantom-development.gitbook.io/phantom-development-docs/phantom-series/phantom-armor-usd17.99/actions-system/action-implementation.md).

# Action Implementation

Below is an example on how to add your own custom action, however you must also do the logic for the said action. Your possibilities are infinite.

{% hint style="warning" %}
For the **Key** value, the plugin will automatically wrap it in brackets. If you do GIVE\_ITEM, in the actions it will be **\[GIVE\_ITEM]**.
{% endhint %}

```java
public class MyOwnAction {
    /**
     * Injects the action into the script executor, this will allow the action to be used in scripts
     * <p> 
     * Also beware that it wraps brackets around the action name, so if you want to use the action in a script, you would use it like this:
     * [GIVE_ITEM]
     */
    public void injectAction() {
        ScriptExecutor.registerAction("GIVE_ITEM", (executor, data) -> {
            String[] parts = data.split(" ");
            Material material = Material.valueOf(parts[0].toUpperCase());
            int amount = Integer.parseInt(parts[1]);

            ItemStack item = new ItemStack(material, amount);
            executor.player.getInventory().addItem(item);

            executor.player.sendMessage(Color.hex("&aYou have been given " + amount + " " + material.name() + "."));
        });
    }
}
```
