-
-
Notifications
You must be signed in to change notification settings - Fork 107
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 standard join configurations #482
Add standard join configurations #482
Conversation
api/src/main/java/net/kyori/adventure/text/JoinConfiguration.java
Outdated
Show resolved
Hide resolved
edd71d8
to
ee77198
Compare
ee77198
to
4e565d4
Compare
I wonder what would be more expected; |
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.
I like these changes overall. I agree with Emilia, might be worth thinking about if a space would be more expected. Not sure if I'm convinced either way tbh..
api/src/main/java/net/kyori/adventure/text/JoinConfiguration.java
Outdated
Show resolved
Hide resolved
Maybe providing both options is the best way to go ? E.g. instead of |
4e565d4
to
8e2042e
Compare
Added the |
Hmmm.. Maybe just the one method with a boolean parameter for a space? |
Yea would have been my second guess 👍 I'll stick to that then :) |
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 minor nitpicks
api/src/main/java/net/kyori/adventure/text/JoinConfiguration.java
Outdated
Show resolved
Hide resolved
api/src/main/java/net/kyori/adventure/text/JoinConfiguration.java
Outdated
Show resolved
Hide resolved
8e2042e
to
2987ef9
Compare
Updated the additions to a |
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.
LGTM! Thanks for the PR :)
2987ef9
to
4368f68
Compare
While using join configurations is already rather simple, they tend to clutter up already rather verbose source code. While the initial creation of the JoinConfiguration already included a null configuration, accessible through 'JoinConfiguration#noSeparators', other standards or often used layouts were not added. This commit adds three more defaults/standards to the join configuration implementation that are exposed through static accessors in the join configuration interface. Specifically: newLines: A straight forward instance of the join configuraiton that uses the new line component to join together components. commas: Another straight forward instance of the join configuration that uses a single comma (or potentially a comma and a space) to join together components. arrayLike: A more complex join configuration that recreates the layout used by the java.util.Arrays#toString method. Resolves: KyoriPowered#466
4368f68
to
5d4384a
Compare
While using join configurations is already rather simple, they tend to
clutter up already rather verbose source code. While the initial
creation of the JoinConfiguration already included a null configuration,
accessible through 'JoinConfiguration#noSeparators', other standards or
often used layouts were not added.
This commit adds three more defaults/standards to the join configuration
implementation that are exposed through static accessors in the join
configuration interface.
Specifically:
newLines:
A straight forward instance of the join configuraiton that uses the
new line component to join together components.
commas:
Another straight forward instance of the join configuration that uses
a single comma to join together components, creating a CSV like
layout.
arrayLike:
A more complex join configuration that recreates the layout used by
the java.util.Arrays#toString method.
Resolves: #466
Pretty open about suggestions for the
arrayLike
method name.If others have more suggestions for often used standard styling (tho
arrayLike
andnewLines
are by far my most used ones) I'd be happy to implement them in the context of this PR as well.