# Block Events

## BLOCK INTERACT

Event called when a player clicks on a block.

```yaml
example:
  type: block_interact
  conditions:
  - '%block_x% == 20'
  - '%block_y% == 60'
  - '%block_z% == 20'
  - '%block_world% == lobby'
  - '%block% == STONE_BUTTON'
  - '%action_type% == RIGHT_CLICK'
  actions:
    default:
    - "message: &aYou''ve received $500!"
    - "console_command: eco give %player% 500"
```

{% hint style="success" %}
**Variables:**

* <mark style="color:green;">%action\_type%</mark> (RIGHT\_CLICK, LEFT\_CLICK, SHIFT\_RIGHT\_CLICK, SHIFT\_LEFT\_CLICK

  &#x20;or PHYSICAL. Use PHYSICAL when you want to check players on pressure plates)
* <mark style="color:green;">%face%</mark> (Clicked face. All values here: <https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/BlockFace.html>)
* ConditionalEvents <mark style="color:green;">block variables</mark>
* ConditionalEvents <mark style="color:green;">item variables</mark> (for item in hand)
  {% endhint %}

## BLOCK BREAK

Event called when a player breaks a block.

```yaml
example:
  type: block_break
  conditions:
  - '%block_head_texture% != %empty%'
  actions:
    default:
    - 'cancel_event: true'
    - "message: &cYou can''t break heads with texture!"
    - 'playsound: BLOCK_NOTE_BLOCK_PLING;10;0.1'
```

{% hint style="success" %}
**Variables:**

* ConditionalEvents <mark style="color:green;">block variables</mark>
* ConditionalEvents <mark style="color:green;">item variables</mark> (for item in hand)
  {% endhint %}

## BLOCK PLACE

Event called when a player places a block.

```yaml
example:
  type: block_place
  conditions:
  - '%block_world% == spawn'
  actions:
    default:
    - 'cancel_event: true'
    - "message: &cYou can''t place blocks on this world."
    - 'playsound: BLOCK_NOTE_BLOCK_PLING;10;0.1'
```

{% hint style="success" %}
**Variables:**

* ConditionalEvents <mark style="color:green;">block variables</mark>
* ConditionalEvents <mark style="color:green;">item variables</mark> (for item in hand)
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ajneb97.gitbook.io/conditionalevents/event-types/block-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
