-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat(mini-message): #791 add mini-message audience #848
base: main/4
Are you sure you want to change the base?
Conversation
I'm not entirely sure how I feel about this yet so I'm hoping for feedback from more people. I do think |
I agree that |
I agree - it should be an interface that implements |
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.
Overall, I like the idea behind this. I can see it being a useful way to introduce people to MM/adventure for platforms.
However, I do worry about the actual use of this in practice. For example, Paper couldn't really use this as sendMessage(String)
conflicts. I guess they could just do a check if it contains legacy and then forward it on but I wonder if we should have these methods being sendMiniMessage
, sendMiniMessageBook
, etc.
Would be interested in hearing any thoughts anyone else has.
* @return a new MiniMessageAudience | ||
* @since 4.13.0 | ||
*/ | ||
static @NotNull MiniMessageAudience audience(final @NotNull Audience audience) { |
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.
should be miniMessageAudience
so it's nice for static imports
* @return a new MiniMessageAudience | ||
* @since 4.13.0 | ||
*/ | ||
static @NotNull MiniMessageAudience audience(final @NotNull Audience audience, final @NotNull MiniMessage mini) { |
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.
static @NotNull MiniMessageAudience audience(final @NotNull Audience audience, final @NotNull MiniMessage mini) { | |
static @NotNull MiniMessageAudience audience(final @NotNull Audience audience, final @NotNull MiniMessage miniMessage) { |
this.delegate = delegate; | ||
this.mini = mini; |
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.
this.delegate = delegate; | |
this.mini = mini; | |
this.delegate = Objects.requireNotNull(delegate, "delegate"); | |
this.mini = Objects.requireNotNull(mini, "mini"); |
final class MiniMessageAudienceImpl implements MiniMessageAudience { | ||
|
||
private final @NotNull Audience delegate; | ||
private final @NotNull MiniMessage mini; |
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.
should be be miniMessage
Maybe extend the idea a little for more general usage? An audience that is created with a serializer and audience instances, and then uses the serializer to convert and send string messages to the audience. Dunno about the name tho, maybe something like It might be worth to include such audience creation into the |
Hmmm, I'm not really sure I like this idea. I think it is potentially too generic to be useful. I envision this Overall, when you can just |
Well, I dunno why I've mentioned only String. The concept surely can be extended by using java generics. Something
For me, MiniMessage just isn't the serializer I prefer at all, and I don't think I'm alone. It feels it would be a bit too selective to add such audience only for MiniMessage. |
I am on phone, so sorry for any incorrect quotes. Just had my last semester exams and I will get right back on this. Yea I agree with this, I think its a simple approach that will fit well with any audience implementation. |
I have another idea. How about we promote the existing methods or make new methods that accept an interface called something like Would love to hear opinions on this. |
That already exists with I think making this interface more generic (in supporting non-MM serializers) would result in loss of functionality without benefits that outweigh that cost -- things like custom tag resolvers are nice to have in-line. |
I did not know that class :P I am not saying replace But then if |
Does anyone have any opinions on what the unit tests should check? |
I can take a look at it on the weekend if you like. |
Adds shorthand methods to send messages with mini-message strings in them easily. The current approach utilizes the delegation provided by
ForwardingAudience
and allows users to use a customMiniMessage
instance for each audience instead of just the default one.TODO:
Closes #791