Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change EventValues class to be using Converter instead of Getter #5006

Closed
TheLimeGlass opened this issue Aug 4, 2022 · 1 comment
Closed
Assignees
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. core task Tasks that may be handled only by the core developer team. enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version.

Comments

@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Aug 4, 2022

Suggestion

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);

Tested this and it works fine with Getter support for older implementations and Getter extends Converter.

Note that the generics are swapped between the Getter and Converter classes, still no issue as Getter handles this for the Converter implementation.

While whoever is inside the EventValues class, ensure that EVERY CALLING OF EventValueInfo fields are using the getter instead of the raw field direct access. Skript has getters in this class, but never actually uses them... Skript needs to stop doing this for security handling.

Why?

Simplifies the code, easier to read, faster to code, added support for those that want to use Java 8 lambdas.

@TheLimeGlass TheLimeGlass added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Aug 4, 2022
@TheLimeGlass TheLimeGlass self-assigned this Aug 4, 2022
@TheLimeGlass TheLimeGlass added the core task Tasks that may be handled only by the core developer team. label Aug 4, 2022
@TheLimeGlass TheLimeGlass added the PR available Issues which have a yet-to-be merged PR resolving it label Aug 6, 2022
@sovdeeth
Copy link
Member

#7269

@Efnilite Efnilite added completed The issue has been fully resolved and the change will be in the next Skript update. feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed PR available Issues which have a yet-to-be merged PR resolving it labels Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. core task Tasks that may be handled only by the core developer team. enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version.
Projects
None yet
Development

No branches or pull requests

3 participants