Skript
Skript copied to clipboard
Change Getter to Converter in EventValues
Description
Change Getter to Converter in EventValues.
Getter doesn't allow for Java lambdas, and most Skript classes use Converter directly.
This will allow for
EventValues.registerEventValue(PlayerEggThrowEvent.class, Egg.class, event -> event.getEgg(), EventValues.TIME_NOW);
Also code cleaned my main domain the EventValues. Changed all raw field references to be using the getters that have never been used. Security.
Related Issues: https://github.com/SkriptLang/Skript/issues/5006
Looks fine. Is
Getter
used anywhere else? Maybe we could deprecate the class.
Yes it's used quite a bit, it mainly only exists for grammar correction, get value from event is how the generics are setup. Where converter has the event first then value. They both do the same thing, Converter is the interface.
Rebased at https://github.com/SkriptLang/Skript/pull/5405