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
Event values are a mess. The main method to get an event value using the
EventValuesclass is almost 100 lines long and super hard to follow along.Event values don't support any changers apart from
SET, which is fine most of the time, but if you want your event value to support other changers you'd have to register an entire expression for it.Additionally, there is no way to register an event value with a custom identifier (i.e.
event-<identifier>) without making it its own expression.Solution
EventValueRegistryserves as a full replacement to theEventValuesclass with a more modern API similar to Skript's new registration API with the ability to register and unregister event values at runtime as well as cache resolved event values to avoid computing it again in the future.A new
EventValueclass that represents an event value, which now supports custom identifiers, event validation and any combination of changers. AnEventValueobject can be constructed throughEventValue.builder.Testing Completed
A lot of the present tests utilize event-values in some way or another, and the
EventValues.sktest covers a lot of cases.Supporting Information
I tried my best to keep parity between the old
EventValuesand the newEventValueRegistryclasses, so there shouldn't be any breaking changes, unless I missed some obscure cases.Completes: none
Related: none
AI assistance: Junie was used to generate most of the javadocs for
EventValueandEventValueRegistrywith some minor tweaks