-
-
Notifications
You must be signed in to change notification settings - Fork 120
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 FormattedComponentArgument for /cwe #464
base: fabric
Are you sure you want to change the base?
Conversation
Hmm, could we leave in some of the old syntax as an alternative to the new syntax, so that those of us who haven't memorized formatting codes can still use it? |
I think that will get a bit confusing. What about making this into a separate class? Something like |
…gument-rewrite # Conflicts: # src/main/resources/assets/clientcommands/lang/en_us.json
…gument-rewrite # Conflicts: # src/main/java/net/earthcomputer/clientcommands/command/NoteCommand.java # src/main/java/net/earthcomputer/clientcommands/command/arguments/FormattedTextArgumentType.java # src/main/resources/assets/clientcommands/lang/en_us.json
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.
#464 (comment) you still haven't addressed this comment, but I want to look into rewriting the formatted component argument type to look more like markdown
Well I addressed that by creating a separate one as opposed to rewriting the current one. And to be honest most clientcommands users will already be familiar with this Markdown is also an option, but I do not think a great one. For one it has no notion of colouring and we would only be able to support a perhaps arbitrary to the user subset of it, unless of course we implement our own client formatting, which I find to be beyond the scope of clientcommands c.q. this PR. I do know of the existence of certain Markdown specs that do support coloured text, but they are not standard at all, so the user would have to learn a new syntax which we probably do not want to introduce. Lastly, as with all choices, it could be made configurable. |
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.
Wrote a new argument type in #673 which is now merged, so this needs to be modified to use that
I rewrote
FormattedTextArgumentType
. The previous implementation was too verbose and moreover not working as one might have expected it to. This new syntax is less error prone and probably more intuitive to work with. The availability of some text styles have been dropped, as firstly the previous implementation was incomplete and secondly because this argument type is meant to provideFormatting
ed text, notStyle
d text. Aside from what's available in theFormatting
class, I did decide to add hex colour support through the#
prefix with lenient hex parsing. Do note thatStyle
d text is still available using the/ctellraw
command.