Skript
Skript copied to clipboard
Improve command expressions for command events and script commands
Description
This PR adds support for script commands to ExprCommand. This allows users to determine the alias used in a script command if that script command has aliases. It removes the "arguments" option in ExprCommand, as I have added command event support to ExprArgument, which has been completely reworked.
Target Minecraft Versions: Any Requirements: None Related Issues: I don't think so
this actually already exists: https://github.com/SkriptLang/Skript/blob/e72349ec8dda606a947c3568b3f387fb5007863d/src/main/java/ch/njol/skript/expressions/ExprCommand.java#L54
this actually already exists:
https://github.com/SkriptLang/Skript/blob/e72349ec8dda606a947c3568b3f387fb5007863d/src/main/java/ch/njol/skript/expressions/ExprCommand.java#L54
That expression can only be used in on command events, not custom commands
this actually already exists: https://github.com/SkriptLang/Skript/blob/e72349ec8dda606a947c3568b3f387fb5007863d/src/main/java/ch/njol/skript/expressions/ExprCommand.java#L54
That expression can only be used in on command events, not custom commands
I wonder if I could merge this new expression into that one. I will take a look at it.
EDIT: actually, that might cause conflicts with ExprArgument, and the other two things probably aren't necessary for a user
this actually already exists:
https://github.com/SkriptLang/Skript/blob/e72349ec8dda606a947c3568b3f387fb5007863d/src/main/java/ch/njol/skript/expressions/ExprCommand.java#L54
I honestly think it'd be better to adapt the ExprCommand to support our custom command trigger instead, at least for the label and full command patterns (the arguments as a whole could as well be supported but it's rather useless, but if someone wants to do it for sake of completeness so be it)
this actually already exists: https://github.com/SkriptLang/Skript/blob/e72349ec8dda606a947c3568b3f387fb5007863d/src/main/java/ch/njol/skript/expressions/ExprCommand.java#L54
I honestly think it'd be better to adapt the ExprCommand to support our custom command trigger instead, at least for the label and full command patterns (the arguments as a whole could as well be supported but it's rather useless, but if someone wants to do it for sake of completeness so be it)
I ended up removing the arguments pattern from ExprCommand and just added support for command events to ExprArgument. I also combined this new class with ExprCommand instead. I'll push these changes later today once I am done testing.
There is a related issue
- #1455
There is a related issue
I'm not sure if that issue applies. It's not possible to do loop all arguments
because it doesn't really have a good use case. I don't think that something like %texts%
is multiple arguments - it's just one argument that accepts multiple values. Really, I think you would have to do something like loop text-argument
?