On Click (Event) — Skript

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

Syntax

[on] [(right|left)(| |-)][mouse(| |-)]click[ing] [on %-entitydata/itemtype/blockdata%] [(with|using|holding) %-itemtype%]

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-direction
  • event-entity
  • event-itemstack
  • event-player
  • event-world

Examples

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

View source