Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rightclick event not being called for villagers #290

Closed
ArVdC opened this issue Dec 9, 2016 · 16 comments
Closed

Rightclick event not being called for villagers #290

ArVdC opened this issue Dec 9, 2016 · 16 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).

Comments

@ArVdC
Copy link

ArVdC commented Dec 9, 2016

Thanks for the #273 fix.
But I just noticed that some rightclik events can't be cancelled anymore by the "cancel event" command.
Actually, it fails for villagers (I need to hide their shops GUI) and item frames (I need to avoid the items rotation)

@ArVdC ArVdC changed the title Can't cancel some rightclick events Can't cancel some rightclick events [Bug] Dec 9, 2016
@ArVdC ArVdC changed the title Can't cancel some rightclick events [Bug] Can't cancel some rightclick events [bug] Dec 9, 2016
@bensku
Copy link
Member

bensku commented Dec 10, 2016

It is known that right click events are very occasionally not working correctly. Click events are handled by hand-written lookup table (what was clicked? what player had in both hands?), and that is far from perfect solution.

@ArVdC
Copy link
Author

ArVdC commented Dec 10, 2016

I didn't know that. Thank you for clarification.
But my following lines of code still work fine, so it's look like the rightclick events are correctly detected.
Only the event cancelling doesn't work ... however it was working fine with the dev20b, just before I update to the dev22f.

on rightclick on a villager:
    cancel the event
    send "Here is a few dirt" to event-player
    give 5 of dirt to event-player

In this example, the player always receives the message and the five dirts.
However the cancelling doesn't fail occasionally but on each try ...

@bensku bensku added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Dec 10, 2016
@bensku
Copy link
Member

bensku commented Dec 10, 2016

Oh, then it is something new. If you can catch the event, you should be able to cancel it... I hope Spigot 1.11 didn't change anything significant here.

@ArVdC ArVdC changed the title Can't cancel some rightclick events [bug] Can't cancel some rightclick events Dec 10, 2016
@ArVdC
Copy link
Author

ArVdC commented Dec 10, 2016

I hope so too. Thank you for your concern.
I'm trying to check if the issue can be due to an addon incompatibility.
I'll keep you informed.

@JeepSmash
Copy link
Contributor

code:

on right click on item frame:
    player's tool is map
    send "Maps in item frames are not allowed here." to event-player
    cancel event

This code stopped working properly when i updated to dev22f however now the event is no longer canceled and the map is placed in the item frame after the player gets sent the message.

@ghost
Copy link

ghost commented Jan 31, 2017

I also confirm it.

on rightclick on item frame:
	cancel the event
	message "hey" to player

When I have an item and right click on an empty item frame, the item will be put in the item frame and the message will be given to player.
I assume this event is detected correctly, but cancel doesn't work.
I hope it will be fixed. Thanks.

@YellowZaki
Copy link

Bump?

@zmolahah
Copy link

@JeepSmash Just so you guys know I encountered this problem a bit ago as well but I just used Skellet as a hacky workaround to fix the problem

rightclick on item frame:
	set {_rotation} to clicked entity's item frame rotation
	wait 2 ticks
	set clicked entity's item frame rotation to {_rotation}

This will put the rotation back to it's previous state when someone attempts to rotate the only problem is you can see people attempting to rotate but I don't find that to be a major issue

@melinstagibson
Copy link

Just tried cancelling "on right click on villager", sadly isnt working either. dev25. Any chance to fix this? anything else works i just cant cancel it

so bump i guess

@bensku
Copy link
Member

bensku commented Apr 6, 2017

Literally calling event.setCancelled(true) doesn't work, so I have no more ideas...

@ChimpGamer
Copy link

"on left click on villager" doesn't work for me :(

@TheBentoBox
Copy link
Member

TheBentoBox commented May 16, 2017

@ChimpGamer You shouldn't use "left click" on entities since that's a damage event, use on damage of villager. That's also not relevant to this issue since this is for right click events.

@ChimpGamer
Copy link

Ow, sorry. But I have to use "left click". Because a Shop is on that Villager (plugin) and it uses left click to open the shop. (Can't change button). And with Skript I'm trying to set a permission on that.

@TheBentoBox
Copy link
Member

TheBentoBox commented May 16, 2017

Left clicking a villager IS a damage event, that's what I'm saying. There's no difference between the two aside from the fact that the damage event is the correct one to use. If you want to detect players left clicking a villager, use the damage event. If canceling that doesn't work, then that's the fault of your shop plugin, and not something Skript can do anything about.

And again, this isn't the place to talk about this, as it's not relevant to this issue. If you want more help trying to figure out a way around that, go ask on the skUnity forums, not here.

@bensku bensku added this to the 2.3 milestone Sep 20, 2017
@Snow-Pyon Snow-Pyon added the priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). label Jan 31, 2018
@Snow-Pyon Snow-Pyon changed the title Can't cancel some rightclick events Rightclick event not being called for villagers Apr 20, 2018
@Snow-Pyon
Copy link

Can someone confirm this is still an issue?

@HYPExMon5ter
Copy link
Contributor

HYPExMon5ter commented Apr 22, 2018

It's still an issue in dev35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).
Projects
None yet
Development

No branches or pull requests

10 participants