Repository navigation
Fix legacy event registrations not getting the correct origin class for shared event classes (SimpleEvent) - #8971
Open
eyesniper2 wants to merge 1 commit into
Conversation
eyesniper2
requested review from
APickledWalrus and
erenkarakal
and removed request for
a team
November 14, 2026 10:44
This comment has been minimized.
This comment has been minimized.
1 task
APickledWalrus
approved these changes
Nov 14, 2026
| @@ -249,8 +249,13 @@ public static final class ModernSkriptEventInfo<E extends SkriptEvent> | |||
| private final Origin origin; | |||
|
|
|||
| public ModernSkriptEventInfo(String name, String[] patterns, Class<E> eventClass, String originClassPath, Class<? extends Event>[] events) { | |||
Member
There was a problem hiding this comment.
Could probably remove this old constructor if it's now unused since this is an internal class
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Third party documentation generation addons like the SkriptHubDocsTool have been unable to tell the origin of events that use the old event registration API and use shared event classes like SimpleEvent. Currently these events either get excluded or get grouped under Skript which isn't accurate. This change fixes this by trying to get the registering class via the stack walker and uses that as the origin instead of passing in a blank string and the shared class which almost always resolves to Skript. This means that tools like the SkriptHubDocsTool, will be able to properly group events that use the legacy event registration API and SimpleEvent to the right addon.
Solution
Within
Skript.registerEventinstead of just using thegetSyntaxOriginon theeventClass, this change tries to get the registering class viagetRegisteringClassand then uses that class ingetSyntaxOrigin. If that fails and returns unknown, we then fallback to the originalgetSyntaxOrigin(eventClass)call.getRegisteringClasstries to find the first class that isn'tSkript.classsince that is the registering class. If we are unable to find anything, we just use the class that was passed in as the fallback.This calculated origin is then passed into an updated ModernSkriptEventInfo constructor that takes a defined Origin which is how this updated origin makes it to the SkriptHubDocsTool.
Testing Completed
Testing by build this change locally and then running on a local dev server alongside an updated SkriptHubDocsTool to validate that when running "gendocs", Skript's SimpleEvents showed up in the output. I also checked that addons like skRayFall had their SimpleEvent like "On store" not show up in Skript's events. Today with the current SkriptHubDocsTool (1.17), SimpleEvents events are dropped, but with these changes and some changes I have coming for the SkriptHubDocsTool in 1.18 these events all get attributed to the right addons.
All tests passed when running "gradlew clean quickTest"
Supporting Information
N/A
Completes: none
Related: none
AI assistance: Claude Code (Opus 5.5) was used to trace the issue and author this fix. All code was reviewed and validated by hand.