On Click (Event) — Skript

Addon: Skript · Category: Event · Since: 1.0, 2.10 (blockdata)

Syntax

[on] [(1:right|2:left)(| |-)][mouse(| |-)]click[ing] [on %entitytypes/blocks%] [(with|using|holding) %items%]

Description

Called when a user clicks on a block, an entity or air with or without an item in their hand. Please note that rightclick events with an empty hand while not looking at a block are not sent to the server, so there's no way to detect them. Also note that a leftclick on an entity is an attack and thus not covered by the 'click' event, but the 'damage' event.

Event Values

  • event-block
  • event-blockvector
  • event-clicked-entity
  • event-cursor-position
  • event-direction
  • event-entity
  • event-instance
  • event-item
  • event-player
  • event-playerhand
  • event-slot
  • event-use-time

Examples

on click:
on rightclick holding fishing rod:
on leftclick on stone or obsidian:
on rightclick on creeper:
on click with a sword:
on click on chest[facing=north]:
on click on campfire[lit=true]:

View source