- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 114
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 decorations(Map) to component/style builders #444
Add decorations(Map) to component/style builders #444
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.
While you're at it, could probably do with this method in Style.Builder
as well.
api/src/main/java/net/kyori/adventure/text/ComponentBuilder.java
Outdated
Show resolved
Hide resolved
e96f5e6
to
fc5d0a4
Compare
Got you, thanks for the suggestions 👍 |
This commit introduces a new decorations method to the component and style builderthat takes in a map of text decorations and their state. This methodalready exists on the Component interface but was previously missing on the respective builders. As the style builder stores the decorations in individual fields and hence cannot natively work with the map layout, the method was implemented as a default method on the interface and simply delegates the map entriess to the normal decorate methods. The main motivation for the addition of this method is the easy application of a preset map of decorations.
fc5d0a4
to
db91520
Compare
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.
Thanks for the PR :)
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.
Nice!
This commit introduces a new decorations method to the component and
style builderthat takes in a map of text decorations and their state.
This methodalready exists on the Component interface but was
previously missing on the respective builders.
As the style builder stores the decorations in individual fields and
hence cannot natively work with the map layout, the method was
implemented as a default method on the interface and simply delegates
the map entriess to the normal decorate methods.
The main motivation for the addition of this method is the easy
application of a preset map of decorations.
I followed the current precedence of stating that the mutation modifies the "component" instead of the builder as that seems to be the current practice in all other decoration related methods on the interface.