crwdns149229:0crwdne149229:0
crwdns149231:0crwdne149231:0
crwdns149233:0crwdne149233:0
crwdns149235:0crwdne149235:0
crwdns149237:0crwdne149237:0
import org.spongepowered.api.text.Text;
Text unformattedText = Text.of("Hey! This is unformatted text!");
crwdns149239:0:ref:crwdne149239:0
crwdns149241:0crwdne149241:0
crwdns149243:0crwdne149243:0
Tip
crwdns149245:0crwdne149245:0
crwdns149247:0crwdne149247:0
crwdns149249:0crwdne149249:0
crwdns149251:0crwdne149251:0
import org.spongepowered.api.text.format.TextColors;
Text coloredText = Text.builder("Woot! Golden text is golden.").color(TextColors.GOLD).build();
crwdns149253:0:javadoc:crwdne149253:0
crwdns149255:0crwdne149255:0
Text multiColoredText = Text.builder("Sponges are ").color(TextColors.YELLOW).append(
Text.builder("invincible!").color(TextColors.RED).build()).build();
crwdns149257:0crwdne149257:0
crwdns149259:0crwdne149259:0
crwdns149261:0crwdne149261:0
import org.spongepowered.api.text.format.TextStyles;
Text styledText = Text.builder("Yay! Styled text!").style(TextStyles.ITALIC).build();
crwdns149263:0crwdne149263:0
crwdns149265:0crwdne149265:0
Text multiStyledText = Text.builder("I'm italicized! ").style(TextStyles.ITALIC)
.append(Text.builder("I'm bold!").style(TextStyles.BOLD).build()).build();
crwdns149267:0crwdne149267:0
crwdns149269:0:javadoc:crwdne149269:0
crwdns149271:0crwdne149271:0
Text colorAndStyleText = Text.of(TextColors.RED, TextStyles.ITALIC, "Shortcuts for the win!");
crwdns149273:0crwdne149273:0
crwdns149275:0:javadoc:crwdne149275:0
crwdns149277:0crwdne149277:0
import org.spongepowered.api.text.action.TextActions;
Text clickableText = Text.builder("Click here!").onClick(TextActions.runCommand("tell Spongesquad I'm ready!")).build();
crwdns149279:0crwdne149279:0
Note
crwdns149281:0:javadoc:crwdne149281:0
Tip
crwdns149283:0crwdne149283:0
crwdns149285:0crwdne149285:0
crwdns149287:0crwdne149287:0
Tip
crwdns149289:0crwdne149289:0
crwdns149291:0:javadoc:crwdne149291:0
crwdns149293:0crwdne149293:0
import org.spongepowered.api.text.selector.Selector;
Text adventurers = Text.builder("These players are in adventure mode: ").append(
Text.of(Selector.parse("@a[m=2]"))
).build();
crwdns149295:0crwdne149295:0