crwdns138863:0crwdne138863:0
crwdns138865:0:javadoc:crwdne138865:0
crwdns138867:0crwdne138867:0
crwdns138869:0crwdne138869:0
crwdns138871:0crwdne138871:0
import net.kyori.adventure.text.Component;
Component unformattedText = Component.text("Hey! This is unformatted text!");
crwdns138873:0:ref:crwdne138873:0
crwdns138875:0crwdne138875:0
crwdns138877:0crwdne138877:0
Tip
crwdns138879:0crwdne138879:0
crwdns138881:0crwdne138881:0
crwdns138883:0crwdne138883:0
crwdns138885:0crwdne138885:0
import net.kyori.adventure.text.format.NamedTextColor;
Component coloredText = Component.text("Woot! Golden text is golden.", NamedTextColor.GOLD);
crwdns138887:0:javadoc:crwdnd138887:0:javadoc:crwdne138887:0
crwdns138889:0crwdne138889:0
import net.kyori.adventure.text.format.TextColor;
Component multiColoredText = Component.text("Sponges are ", NamedTextColor.YELLOW).append(
Component.text("invincible!", TextColor.color(0x5fb0ff)));
crwdns138891:0crwdne138891:0
crwdns138893:0crwdne138893:0
crwdns138895:0crwdne138895:0
import net.kyori.adventure.text.format.TextDecoration;
Component styledText = Component.text("Yay! Styled text!").decorate(TextDecoration.ITALIC);
Component shortcutText = Component.text("Shortcut for both!", NamedTextColor.GRAY, TextDecoration.UNDERLINE);
crwdns138897:0crwdne138897:0
crwdns138899:0crwdne138899:0
Component multiStyledText = Component.text("I'm italicized! ").decorate(TextDecoration.ITALIC)
.append(Component.text("I'm bold!").decorate(TextDecoration.BOLD));
crwdns138901:0crwdne138901:0
crwdns138903:0:javadoc:crwdnd138903:0:javadoc:crwdnd138903:0:javadoc:crwdne138903:0
crwdns138905:0crwdne138905:0
import net.kyori.adventure.text.event.ClickEvent;
Component clickableText = Component.text("Click here!")
.clickEvent(ClickEvent.runCommand("tell Spongesquad I'm ready!"));
Component callbackText = Component.text("Click here too!")
.clickEvent(SpongeComponents.executeCallback(
cause -> cause.audience().sendMessage(Component.text("You clicked!"))));
crwdns138907:0crwdne138907:0
Note
crwdns138909:0:javadoc:crwdne138909:0
Tip
crwdns138911:0crwdne138911:0
crwdns138913:0crwdne138913:0
crwdns138915:0crwdne138915:0
Tip
crwdns156926:0crwdne156926:0
crwdns138919:0crwdne138919:0
crwdns138921:0crwdne138921:0
Component adventurers = Component.text("These players are in adventure mode: ")
.append(Component.selector("@a[m=2]"));
crwdns138923:0crwdne138923:0
crwdns138925:0crwdne138925:0
crwdns138927:0crwdne138927:0
crwdns138929:0crwdne138929:0
Component weBuiltThisText = Component.text()
.content("with Sponge and Flard")
.color(NamedTextColor.YELLOW)
.decorate(TextDecoration.ITALIC, TextDecoration.BOLD)
.build()
crwdns138931:0crwdne138931:0
Component limitedEdition = weBuiltThisText.style(
styleBuilder -> styleBuilder.decorate(TextDecoration.UNDERLINE));