-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Improve ExprElement #5478
Improve ExprElement #5478
Conversation
Everything looks nice to me might be a good to add a few extra examples to it for the most part it's common but stuff like |
Could we please add ElementTypes specific to these new patterns instead of merging them together? When I added ElementType, the idea was that it would explain which element is being requested. For example, |
I merged them because I feel like instead of having an enum for each mode + last variant, I just made it so the way we do "last" is with a boolean variable
The Do you think I should just scrap the |
That's what I would prefer personally! |
# Conflicts: # src/main/java/ch/njol/skript/expressions/ExprElement.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice.
Adding bug tag as you currently CANNOT run debug mode with this class prior to this pull request. |
We need this pull request as it fixes this error. I keep coming back to this pull as it needs to be addressed, literally cannot run debug right now.
|
- Change patterns to use %integer% rather than %number% - Make use of generics to reduce the amount of castings needed - Create a util method for getting a sub-array of an array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything else seems great!
Co-authored-by: Ayham Al Ali <[email protected]>
Description
This PR improves the ExprElement class and adds 2 new patterns to it:
The first pattern is
[the] (first|:last) %number% elements [out] of %objects%
which allows you to get the first or last x elements of a list.Example:
The second pattern is
[the] elements (from|between) %number% (to|and) %number% [out] of %objects%
which allows you to get elements between to different indices.Example:
Target Minecraft Versions: any
Requirements: none
Related Issues: #5208