> For the complete documentation index, see [llms.txt](https://kap35.gitbook.io/kap-easy-menu-plugin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kap35.gitbook.io/kap-easy-menu-plugin/dev-manual/create-a-menu/items/add-an-action.md).

# Add an action

## First of all

You should see how create a new item if you do not have read it.

## Types of Actions

There is 3 types of actions :&#x20;

* LEFT\_CLICK
* RIGHT\_CLICK
* MIDDLE\_CLICK

These actions allow you to add an effect when one of these action is used on your items.

## Create a new action

{% code overflow="wrap" lineNumbers="true" %}

```java
GuiItem myItem() {
    GuiItem item = new GuiItem(Material.MATERIAL)
        .setAction(ItemActions.LEFT_CLICK,
            (player, plugin) {
                //here the plugin == null because we didn't set it in constructor
                Bukkit.getConsoleSender().sendMessage("Player " +
                player.getDisplayName() +
                " clicked on my item !");
            }
        );
    
    return item;
}
```

{% endcode %}

{% hint style="warning" %}
Pay attention, when you use your plugin in an action, you have to cast it because plugin argument is a JavaPlugin and not your plugin directly.
{% endhint %}
