-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
on right click of: does not support offhand, and cancelling events is broken #1808
Comments
Skript needs to rewrite the EvtClick.java as right now its quite a bit messy and buggy. |
|
@dad3 it isn't broken, you can blame Spigot on all those "bugs" when cancelling events, Skript doesn't add any logic when it comes to cancelling events.
Not really, it is ok, not the best thing but it works as people expect it to work, or at least it did. Can someone confirm these bugs? |
Tested the
My skript-mirror code (pretty straightforward):
|
I am not blaming spigot because all the other plugins managed to find a way to cancel event without it leaking somehow. I think this can be fixed in skript by trying a different method or changing the code. As for the items breaking, it is really easy to reproduce but just not clear exactly what causes it. If you cancel event of 2 items and then put 1 in your offhand, spam click both, then they will stop working properly and ignore the trigger. It will cancel event on these items for other irrelevant clicks. I think that's the easiest way to reproduce the second bug, all though I've done it without using offhand and sometimes doing nothing at all. |
I wasn't talking about the bug you mentioned in the issue, I was talking about your other comment. And you can't compare plugins to Skript either way, plugins use the exact events with specific checks and workarounds if needed, in events like the click event, Skript makes 20 lines of code a simple one liner, the fact that this doesn't perform as well as it should is just the fact that Spigot doesn't have proper API implementation. |
Skript merges two Bukkit click events to one for scripts. Since that event must be cancellable, it is not possible to wait until end of tick to see how many events were fired. And to make matters worse, passing the wrong event is not actuallt canceling what user wanted to do. Skript tries to guess which click event is right one - i.e. properly cancels the action - using lookup tables. Said tables have been built using basically reverse engineered information. It is possible that they are not 100% accurate. Event-item, which should be what click events are also filtered against, is the item that (according to lookup tables) was used. Now, I'm afraid that this might not make much sense with some syntaxes of click event - could be a bug. Again, it could also be a bug in lookup tables. I'm not sure... As a side note, entity click events are generally much more simple to deal with. Well, until you need armor stand support. Then it gets ugly. |
I also want to note that you're the only one experiencing this. What you're saying is that your event triggers eventually just "break" and no longer work. I've never heard that reported before and have never experienced it myself, you say it's easy to reproduce but the scenarios you provide aren't breaking anything for anyone else. Skript handles interact events fine, or at least fine enough to not cause the issues you're describing, If you can provide any actual code which, for other people, reproduces the issue, then it's something we can look into. The reason the egg right-click event isn't always firing is due to what @TrademarkTM showed. The Skript click events operate off of player interaction events, which are not always fired by Spigot. If it doesn't fire the event in a certain scenario, then Skript won't fire a click event either. There's no magic plugin that is making Spigot fire click events there either -- if they want to cancel egg shooting, they listen for shoot events, not click (interact) events, as should you. It's not that hard. |
So you are not going to fix this bug that other amateur devs have managed to fix? Blaming it on spigot does not solve the issue, we all know that spigot's api is not so good but there is still a solution on your side. For 1.13.2, the second glitch doesn't seem to happen, however, still on right click doesn't trigger most times for both versions, and the egg can still be right clicked when spammed for 1.12.2 even this wont do the send message, because it doesn't listen to trigger. (Yes its this easy to reproduce just please copy my script and try it.) as for the second bug i originally posted, it is difficult to reproduce on an empty server with only skript. I think it might be other plugins or add ons that might break the event, I am not sure. |
So, please don't come here to tell me "this is something anyone can fix" because you don't know what implications it has.
I am trying to be nice here but if you're going to have that attitude, I may aswell close the issue and stop bothering about it. |
I agree, I came off a little upset and I apologize for that my request is for offhand to be fixed on right click, for the time being, the rest I give up on, so I am leaving it up for you guys if the whole cancel thing has issues or not, that is all. If I find a very easy way to reproduce my experienced issues and it is very clear then I will have to post it under a new issue because this is a messy thread. |
I once again want to note that, on my live server using beta4 (so something could have broken since then), I am NOT having issues detecting or canceling offhand events. There are probably edge case situations which are either not firing click events (like the egg example above, which whether you understand it or not IS a Spigot problem) or which are detecting the wrong event-item, but in those scenarios there's probably always a different, better, more specific event you should be using instead. |
Because it is only on right click event, and it is confirmed a bug. The off hand works fine for the other things I tested (except a few which I forgot, on projectile might be one of them). And there might be a better event to check, however, the bug still exists and we can all agree that the expected behavior does not occur. |
We can't agree because I haven't verified and because our events are generally simple maps to Bukkit events so if Spigot isn't firing one in some situation then neither will Skript nor should it be expected to. |
it is a bug regardless |
To exploit the on right click event: right click whilst breaking blocks whilst left clicking, and the event will not trigger for 1 time. on rightclick holding a empty map: then try to create a map while doing what I said, and u will be able to. |
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/MapInitializeEvent.html There are tons of cases where |
u can't cancel that event. on right click is my only option |
I did find a couple of bugs in offhand/mainhand heuristics on 1.13. They've been fixed. |
Description
There are 2 bugs. For one, "on right click of" does not include offhand. This can cause huge exploits on a lot of servers that are using this trigger and should be fixed.
the second bug is even worse because it completely breaks all cancel events and requires a server restart, just ruins the server completely
2, when cancelling 2 events at the same time that are on the same script, then skript breaks and cancels the event continuously without a trigger.
Steps to Reproduce
on rightclick holding a egg: cancel event
will not cancel event when right clicking on offhand.to reproduce second bug, have these 2 things for example: `on rightclick holding a egg:
if player does not have permission "egg.use":
send "no 1."
cancel event
on rightclick holding a bow:
if player does not have permission "bow.use":
send "no 2"
cancel event`
try rightclicking them both at the same time (or put one item in your offhand and right click twice and it will break immedietly) and then it will stop checking the permission and will not send a message, but will rather just cancel the event forever and u cant use the items in any way, cant even break blocks with them.
Expected Behavior
I expected for right click trigger to include offhand ( there is no other offhand support) and I expected cancelling events to not leak and break the server completely by ruining the items
Errors / Screenshots
will do if necessary, the bugs are clear
Server Information
`[16:03:54 INFO]: This server is running Paper version git-Paper-1593 (MC: 1.12.2) (Implementing API version 1.12.2-R0.1-SNAPSHOT)
[16:03:54 INFO]: You are 2 version(s) behind
Additional Context
The text was updated successfully, but these errors were encountered: