Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Fixed only highest event super class getting registered.

Open TFSMads opened this issue 2 years ago • 3 comments

Description

I fixed so that not only highest super class event gets registered.


Target Minecraft Versions: any Requirements: No additional requirements Related Issues: https://github.com/SkriptLang/Skript/issues/4705

TFSMads avatar Jun 09 '22 14:06 TFSMads

I think this approach with HandlerList getting is better 👍

I think it would be even better to check the registered listeners on the HandlerList, using HandlerList#getRegisteredListeners, RegisteredListener#getListener and RegisteredListener#getPriority. With these, you can check if Skript has a registered listener for that event, without needed to keep track of a set for it manually.

I tried doing that before the current solution. But it didn't work for events that Skript already have registered listener for.

TFSMads avatar Jul 19 '22 16:07 TFSMads

I tried doing that before the current solution. But it didn't work for events that Skript already have registered listener for.

If Skript already had a registered listener for it, it shouldn't register it again. Did it register those twice then?

Can you go back to that version, and push the changes? Then I can take a look at it

TPGamesNL avatar Jul 19 '22 18:07 TPGamesNL

I tried doing that before the current solution. But it didn't work for events that Skript already have registered listener for.

If Skript already had a registered listener for it, it shouldn't register it again. Did it register those twice then?

Can you go back to that version, and push the changes? Then I can take a look at it

I figured out what i did wrong before, and it is working now.

Now it checks if Skript has a listener registered for a HandlerList instead of using a list to keep track of which HandlerLists is registred to.

I have done some testing and it seems to work fine.

TFSMads avatar Jul 20 '22 21:07 TFSMads