Skip to content

Commit

Permalink
Merge pull request #858 from JOO200/feat/tagstyle
Browse files Browse the repository at this point in the history
text-minimessage: Add a shortcut for styling tags
  • Loading branch information
kashike authored Jan 13, 2023
2 parents 529d407 + a730ee7 commit 5318556
Showing 1 changed file with 15 additions and 0 deletions.
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 styling(final @NotNull String key, final @NotNull StyleBuilderApplicable@NotNull... style) {
return TagResolver.resolver(key, Tag.styling(style));
}
}

0 comments on commit 5318556

Please sign in to comment.