Skip to content
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

text-minimessage: Add a shortcut for styling tags #858

Merged
merged 3 commits into from
Jan 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.ComponentLike;
import net.kyori.adventure.text.format.StyleBuilderApplicable;
import net.kyori.adventure.text.minimessage.tag.Tag;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -81,4 +82,18 @@ private Placeholder() {
public static TagResolver.@NotNull Single component(final @NotNull String key, final @NotNull ComponentLike value) {
return TagResolver.resolver(key, Tag.selfClosingInserting(value));
}

/**
* Creates a style tag which will modify the style of the component.
*
* <p>This style can be used like other styles.</p>
*
* @param key the key
* @param style the style
* @return the placeholder
* @since 4.13.0
*/
public static TagResolver.@NotNull Single style(final @NotNull String key, final @NotNull StyleBuilderApplicable style) {
Joo200 marked this conversation as resolved.
Show resolved Hide resolved
return TagResolver.resolver(key, Tag.styling(style));
}
}