# Actions

Actions allow players to interact with tooltips. When any type of tooltip is currently being shown using presets conditions, you are able to listen to actions and execute commands.

## Action configuration

```yaml
preset-id:
    content:
        text:
        - 'Looking at bedrock'
    display:
        theme: default-one-line
    conditions:
      conditions:
      - lookingatblock{type=bedrock} true
      # Actions are specified optionally here
      actions:
        # Action name and list of commands
        right-click-block:
        # A single "say hi" command that will be executed by the console
        - say hi
```

<figure><img src="https://2056457066-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FO0fJVi4OrBJoOYrP9n9t%2Fuploads%2FZZblQ8QgK3NLmZWlgxtZ%2Fimage.png?alt=media&#x26;token=048c7208-e239-46f6-9342-25259c3d5829" alt=""><figcaption><p>right-click-block action executes the "say hi" command in console</p></figcaption></figure>

### Supported actions

<table><thead><tr><th width="261">Action</th><th>Description</th></tr></thead><tbody><tr><td>left-click</td><td>Any type of left click</td></tr><tr><td>left-click-air</td><td>Left click air</td></tr><tr><td>left-click-block</td><td>Left click a block </td></tr><tr><td>left-click-entity</td><td>Left click an entity</td></tr><tr><td>right-click</td><td>Any type of right click</td></tr><tr><td>right-click-air</td><td>Right click air <br>(only works with an item in hand, blame Spigot)</td></tr><tr><td>right-click-block</td><td>Right click a block</td></tr><tr><td>right-click-entity</td><td>Right click an entity</td></tr><tr><td>on-show</td><td>Triggered when a tooltip is first triggered</td></tr><tr><td>on-stop-showing</td><td>Triggered when a tooltip stops being shown</td></tr><tr><td>animation-finished</td><td>Triggered when all animations are done</td></tr></tbody></table>

### Commands

All commands support both PAPI and local placeholders, as well as a backup built-in %player% placeholder for the players username.

This plugin provides some custom commands for convenience. Read more about them here:

{% content-ref url="actions/commands" %}
[commands](https://tooltips.gitbook.io/tooltips/configuration/preset/actions/commands)
{% endcontent-ref %}

### Examples

```yaml
actions:
  # All right and left clicks will make the console say hi
  left-click:
  - say hi
  right-click:
  - say hi
```
