Skip to content

Conversation

@UnderscoreTud
Copy link
Member

Problem

Event values are a mess. The main method to get an event value using the EventValues class 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

EventValueRegistry serves as a full replacement to the EventValues class 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 EventValue class that represents an event value, which now supports custom identifiers, event validation and any combination of changers. An EventValue object can be constructed through EventValue.builder.

Testing Completed

A lot of the present tests utilize event-values in some way or another, and the EventValues.sk test covers a lot of cases.

Supporting Information

I tried my best to keep parity between the old EventValues and the new EventValueRegistry classes, 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 EventValue and EventValueRegistry with some minor tweaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants