Skip to content

Conversation

@UnderscoreTud
Copy link
Member

@UnderscoreTud UnderscoreTud commented Dec 19, 2025

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.

Breaking Changes

This PR removes two register methods in EventValues that use the Getter class as a parameter, which have been deprecated and marked for removal since 2.10.
A check has been added to ensure no duplicate event values are registered.


Completes: none
Related: none
AI assistance: Junie was used to generate most of the javadocs for EventValue and EventValueRegistry with some minor tweaks

@UnderscoreTud UnderscoreTud marked this pull request as ready for review December 24, 2025 00:15
@UnderscoreTud UnderscoreTud requested review from a team as code owners December 24, 2025 00:15
@UnderscoreTud UnderscoreTud requested review from Pesekjak, TheMug06 and sovdeeth and removed request for a team December 24, 2025 00:15
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Dec 24, 2025
@UnderscoreTud UnderscoreTud added breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) enhancement Feature request, an issue about something that could be improved, or a PR improving something. labels Dec 24, 2025
Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking great
wonderful work tud, especially for your 2nd ever contribution

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

Labels

breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) enhancement Feature request, an issue about something that could be improved, or a PR improving something. needs reviews A PR that needs additional reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants