Skript

Skript

743k Downloads

Dropping an item also calls the on click event

friyes opened this issue ยท 6 comments

commented

Skript/Server Version

[19:08:42 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[19:08:42 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[19:08:42 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[19:08:42 INFO]: [Skript] Server Version: 1.20.6-137-bd5867a (MC: 1.20.6)
[19:08:42 INFO]: [Skript] Skript Version: 2.8.6 (skriptlang-github)
[19:08:42 INFO]: [Skript] Installed Skript Addons:
[19:08:42 INFO]: [Skript]  - skript-placeholders v1.6.0 (https://github.com/APickledWalrus/skript-placeholders)
[19:08:42 INFO]: [Skript]  - skript-particle v1.3.1 (https://github.com/sovdeeth/skript-particle)
[19:08:42 INFO]: [Skript]  - DiSky v4.17.2
[19:08:42 INFO]: [Skript]  - skript-reflect v2.4 (https://github.com/SkriptLang/skript-reflect)
[19:08:42 INFO]: [Skript]  - SkBee v3.5.3 (https://github.com/ShaneBeee/SkBee)
[19:08:42 INFO]: [Skript]  - SkJson v3.0.91
[19:08:42 INFO]: [Skript] Installed dependencies:
[19:08:42 INFO]: [Skript]  - Vault v1.7.3-b131
[19:08:42 INFO]: [Skript]  - WorldGuard v7.0.10+d9424b1

Bug Description

Dropping an item also calls the on click event when you aren't looking at any block.

on drop:
  broadcast "dropped"

on click:
  broadcast "interacted"

Expected Behavior

Only the drop event was called.

Steps to Reproduce

  1. Upload and reload the script.
  2. Get an item.
  3. Run /tp ~ 300 ~.
  4. Look up.
  5. Throw the item.
  6. Observe that both "dropped" and "interacted" are sent.

Errors or Screenshots

No response

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
commented

Dropping something is a PHYSICAL (click type) interaction, and click technically listens for interactions.

commented

but the paper interaction event doesn't actually do this

import:
	org.bukkit.event.player.PlayerDropItemEvent
	org.bukkit.event.player.PlayerInteractEvent

on PlayerDropItemEvent:
	broadcast "java dropped"

on PlayerInteractEvent:
	broadcast "java interacted"

on drop:
	broadcast "skript dropped"

on click:
	broadcast "skript interacted"
commented

depends on all your tested events, skript uses a bunch for single events at times

static {
Class<? extends PlayerEvent>[] eventTypes = CollectionUtils.array(
PlayerInteractEvent.class, PlayerInteractEntityEvent.class, PlayerInteractAtEntityEvent.class
);
Skript.registerEvent("Click", EvtClick.class, eventTypes,

commented

So this is intended behavior?

In a way yes, was the something they initially planed? No, I'm sure the person who made this in 2014 didn't know this meant the Minecraft behavior of arm swinging when you drop would cause left click to occure.

commented

So this is intended behavior?

commented

That having been said, it looked like the PHYSICAL click type was (supposed to be) excluded from this, so it might be sneaking back in from one of those other events, somebody can investigate this more.