Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Dropping an item also calls the on click event

Open friyes opened this issue 1 year ago • 6 comments

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

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

friyes avatar Jun 06 '24 17:06 friyes

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

Moderocky avatar Jun 06 '24 17:06 Moderocky

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"

friyes avatar Jun 06 '24 18:06 friyes

depends on all your tested events, skript uses a bunch for single events at times https://github.com/SkriptLang/Skript/blob/0355df1a07c027ca2fb5355eeaa57378d524f813/src/main/java/ch/njol/skript/events/EvtClick.java#L60-L64

Fusezion avatar Jun 06 '24 18:06 Fusezion

So this is intended behavior?

friyes avatar Jun 06 '24 19:06 friyes

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.

Fusezion avatar Jun 06 '24 19:06 Fusezion

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.

Moderocky avatar Jun 06 '24 20:06 Moderocky