Skip to content

API for "caching" MiniMessage strings (or other serializer specific data) for ease of sending

Description

Related to #848, there seems to be some desire to remove the common usage of audience.sendMessage(MiniMessage.miniMessage().deserialize("my string")) in favour of a shorthand method for this. The MiniMessageAudience proposed in that PR is nice, but fails to be generic enough to be useful.

I think providing a wrapper for ComponentLike that accepts a serializer and the data to be serialized (open for extensions such as additional MiniMessage tag resolvers or context objects) would be quite nice, allowing for a replacement of the common pattern above:

// Stored centrally somewhere.
public static MiniMessageString myMiniMessageString = MiniMessage.miniMessage().createString("my string", tagResolvers);

// Sent at a later date (optionally adding additional context).
player.sendMessage(myMiniMessageString);
player.sendMessage(myMiniMessageString.withContext(player).withExtraTags(additionalTags));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions