-
-
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
String literal. #6718
String literal. #6718
Conversation
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.
wonderful thank you kenzie
if (!aClass.getC().isAssignableFrom(String.class)) | ||
continue; |
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.
Literals can only be converted to other literals, so we don't really want to return a literal unless the input actually wants a string (otherwise a lot of places might break because they can't be converted)
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.
some non-critical suggestions
|
||
import java.util.Optional; | ||
|
||
public class LiteralString extends VariableString implements Literal<String> { |
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.
Might be worth adding some javadoc for the class itself
Co-authored-by: Patrick Miller <[email protected]>
Description
Adds a
LiteralString
.During string parsing, if the string is 'simple' (has no interpolation inputs or weird parsy bits and bobs) then rather than returning a 'simple'
VariableString
, it will return aLiteralString
. This is aLiteral<String>
.Incidentally, this is also a
VariableString
, so nothing existing will break.You can now specify
%*string%
to accept (literal) strings obtainable during init, and use strings in places where only literals are allowed.Obviously, strings with expressions inside (like
"hello %player%"
) aren't literal and so won't be matched.Target Minecraft Versions: any
Requirements: none
Related Issues: none