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

🚀 Add Change Modes to expressions in docs #5687

Closed

Conversation

AyhamAl-Ali
Copy link
Member

@AyhamAl-Ali AyhamAl-Ali commented May 10, 2023

Description

Currently this only implements getting the ChangeMode but not the accepted data type until a good way for implementing that in annotation is suggested/found.

  • Enhancements: Pre-Compile some regex patterns
  • Enhancement: Removed some duplicated null checks
  • Ignore Skript errors in getAcceptedChangeModes method

Preview
image


Target Minecraft Versions:
Requirements:
Related Issues:

- Enhancements: Pre-Compile some regex patterns
- Enhancement: Removed some duplicated null checks
- Ignore Skript errors in getAcceptedChangeModes method
@AyhamAl-Ali AyhamAl-Ali added feature Pull request adding a new feature. documentation Related to Skript's official documentation. labels May 10, 2023
src/main/java/ch/njol/skript/lang/Expression.java Outdated Show resolved Hide resolved
acceptedChangeModes = Arrays.stream(annotation.value()).toList();
} else {
try {
acceptedChangeModes = ((SimpleExpression<?>) info.getElementClass().newInstance()).getAcceptedChangeModes().keySet().stream().toList();
Copy link
Member

Choose a reason for hiding this comment

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

i am a little weary of this given that expressions really should be initialized before having anything done on them - this may very well lead to inaccurate results

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface AcceptedChangeModes {
Copy link
Member

Choose a reason for hiding this comment

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

what do you think about just taking in a string - might give developers more freedom for more complicated cases

for example, let's say we're annotating ExprName
@AcceptedChangeModes("set (only for display/tablist names)")

Copy link
Member Author

Choose a reason for hiding this comment

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

I would prefer this approach over current solution for freedom and ease of implementation however, this means we have to add this annotation to all current expressions manually which I am okay with but just to keep in mind.

@AyhamAl-Ali AyhamAl-Ali marked this pull request as draft September 21, 2023 22:48
@sovdeeth
Copy link
Member

closing due to inactivity

@sovdeeth sovdeeth closed this Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Related to Skript's official documentation. feature Pull request adding a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💡 Accepted changes for expressions in docs
3 participants