本文整理汇总了Java中org.spongepowered.api.text.LiteralText.Builder.append方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.append方法的具体用法?Java Builder.append怎么用?Java Builder.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.api.text.LiteralText.Builder
的用法示例。
在下文中一共展示了Builder.append方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: help
import org.spongepowered.api.text.LiteralText.Builder; //导入方法依赖的package包/类
@Override
public Text help(final CommandSource source) {
Builder build = Text.builder("/" + this.getName() + " <")
.append(Text.builder("give")
.onClick(TextActions.suggestCommand("/xp give "))
.build())
.append(Text.of("|"))
.append(Text.builder("set")
.onClick(TextActions.suggestCommand("/xp set "))
.build())
.append(Text.of("> <lvl|exp> <" + EAMessages.ARGS_AMOUNT.getString() + ">"));
if (source.hasPermission(EEPermissions.EXP_OTHERS.get())) {
build = build.append(Text.of(" [" + EAMessages.ARGS_USER.getString() + "]"));
}
return build.onClick(TextActions.suggestCommand("/" + this.getName() + " "))
.color(TextColors.RED)
.build();
}
示例2: help
import org.spongepowered.api.text.LiteralText.Builder; //导入方法依赖的package包/类
@Override
public Text help(final CommandSource source) {
boolean walk = source.hasPermission(EEPermissions.SPEED_WALK.get());
boolean fly = source.hasPermission(EEPermissions.SPEED_FLY.get());
Builder build = Text.builder("/" + this.getName());
if (walk || fly) {
if (walk && fly) {
build.append(Text.of(" [" + EAMessages.ARGS_SPEED.getString() + "] [walk|fly]"));
} else if (fly) {
build.append(Text.of(" [" + EAMessages.ARGS_SPEED.getString() + "] [fly]"));
} else if (walk) {
build.append(Text.of(" [" + EAMessages.ARGS_SPEED.getString() + "] [walk]"));
}
if(source.hasPermission(EEPermissions.SPEED_OTHERS.get())) {
build.append(Text.of(" [" + EAMessages.ARGS_USER.getString() + "]"));
}
}
return build.onClick(TextActions.suggestCommand("/" + this.getName() + " "))
.color(TextColors.RED)
.build();
}
示例3: help
import org.spongepowered.api.text.LiteralText.Builder; //导入方法依赖的package包/类
@Override
public Text help(final CommandSource source) {
Builder build = Text.builder("/" + this.getName() + " <");
List<Text> populator = new ArrayList<Text>();
for (CatalogType type : this.plugin.getGame().getRegistry().getAllOf(PopulatorObject.class)){
populator.add(Text.builder(type.getId().replaceAll("minecraft:", ""))
.onClick(TextActions.suggestCommand("/" + this.getName() + " " + type.getId().replaceAll("minecraft:", "").toUpperCase()))
.build());
}
build.append(Text.joinWith(Text.of("|"), populator));
return build.append(Text.of(">"))
.onClick(TextActions.suggestCommand("/" + this.getName() + " "))
.color(TextColors.RED)
.build();
}
示例4: help
import org.spongepowered.api.text.LiteralText.Builder; //导入方法依赖的package包/类
@Override
public Text help(final CommandSource source) {
Builder build = Text.builder("/" + this.getName() + " <")
.append(Text.builder("survival").onClick(TextActions.suggestCommand("/" + this.getName() + " survival ")).build())
.append(Text.of("|"))
.append(Text.builder("creative").onClick(TextActions.suggestCommand("/" + this.getName() + " creative ")).build())
.append(Text.of("|"))
.append(Text.builder("adventure").onClick(TextActions.suggestCommand("/" + this.getName() + " adventure ")).build())
.append(Text.of("|"))
.append(Text.builder("spectator").onClick(TextActions.suggestCommand("/" + this.getName() + " spectator ")).build())
.append(Text.of("|"))
.append(Text.builder("empty").onClick(TextActions.suggestCommand("/" + this.getName() + " empty ")).build())
.append(Text.of(">"));
if (source.hasPermission(EEPermissions.GAMEMODE_OTHERS.get())){
build = build.append(Text.of(" [" + EAMessages.ARGS_PLAYER.getString() + "]"));
}
return build.color(TextColors.RED)
.build();
}
示例5: help
import org.spongepowered.api.text.LiteralText.Builder; //导入方法依赖的package包/类
public Text help(final CommandSource source) {
TreeMap<String, String> commands = new TreeMap<String, String>();
commands.put(this.getName() + " help", "help");
for (ISubCommand subcommand : this.subcommands) {
if (subcommand.testPermission(source)) {
commands.put(subcommand.getName(), subcommand.getSubName());
}
}
Builder build;
if (!commands.isEmpty()) {
build = Text.builder("/" + this.getName() + " <");
int cpt = 0;
for (Entry<String, String> command : commands.entrySet()) {
build = build.append(Text.builder(command.getValue()).onClick(TextActions.suggestCommand("/" + command.getKey())).build());
cpt++;
if (cpt < commands.size()){
build = build.append(Text.builder("|").build());
}
}
build = build.append(Text.builder(">").build());
} else {
build = Text.builder(this.getName()).onClick(TextActions.suggestCommand(this.getName()));
}
return build.color(TextColors.RED).build();
}
示例6: help
import org.spongepowered.api.text.LiteralText.Builder; //导入方法依赖的package包/类
@Override
public Text help(final CommandSource source) {
Builder build = Text.builder("/" + this.getName() + " <" + EAMessages.ARGS_ENTITY.getString() + "> <" + EAMessages.ARGS_RADIUS.getString());
if (source.hasPermission(EEPermissions.BUTCHER_WORLD.get())) {
build.append(Text.of("|" + EAMessages.ARGS_ALL.getString()));
}
return build.append(Text.of(">"))
.onClick(TextActions.suggestCommand("/" + this.getName() + " "))
.color(TextColors.RED)
.build();
}
示例7: formatCitizenDescription
import org.spongepowered.api.text.LiteralText.Builder; //导入方法依赖的package包/类
public static Text formatCitizenDescription(String name)
{
UUID uuid = DataHandler.getPlayerUUID(name);
if (uuid == null)
{
return Text.of(TextColors.RED, LanguageHandler.FORMAT_UNKNOWN);
}
Builder builder = Text.builder("");
builder.append(
Text.of(TextColors.GOLD, "----------{ "),
Text.of(TextColors.YELLOW,
DataHandler.getCitizenTitle(uuid) + " - " + name),
Text.of(TextColors.GOLD, " }----------")
);
BigDecimal balance = null;
EconomyService service = NationsPlugin.getEcoService();
if (service != null)
{
Optional<UniqueAccount> optAccount = NationsPlugin.getEcoService().getOrCreateAccount(uuid);
if (optAccount.isPresent())
{
balance = optAccount.get().getBalance(NationsPlugin.getEcoService().getDefaultCurrency());
}
}
builder.append(
Text.of(TextColors.GOLD, "\n" + LanguageHandler.FORMAT_MONEY + ": "),
((balance == null) ? Text.of(TextColors.GRAY, LanguageHandler.FORMAT_UNKNOWN) : Text.builder()
.append(Text.of(TextColors.YELLOW, NationsPlugin.getEcoService().getDefaultCurrency().format(balance)))
.append(Text.of(TextColors.YELLOW, NationsPlugin.getEcoService().getDefaultCurrency().getSymbol()))
.build())
);
builder.append(Text.of(TextColors.GOLD, "\n" + LanguageHandler.FORMAT_NATION + ": "));
Nation nation = DataHandler.getNationOfPlayer(uuid);
if (nation != null)
{
builder.append(nationClickable(TextColors.YELLOW, nation.getRealName()));
if (nation.isPresident(uuid))
{
builder.append(Text.of(TextColors.YELLOW, " (" + LanguageHandler.FORMAT_PRESIDENT + ")"));
}
else if (nation.isMinister(uuid))
{
builder.append(Text.of(TextColors.YELLOW, " (" + LanguageHandler.FORMAT_MINISTERS + ")"));
}
builder.append(Text.of(TextColors.GOLD, "\n" + LanguageHandler.FORMAT_ZONES + ": "));
boolean ownNothing = true;
for (Zone zone : nation.getZones().values())
{
if (uuid.equals(zone.getOwner()) && zone.isNamed())
{
if (ownNothing)
{
ownNothing = false;
}
else
{
builder.append(Text.of(TextColors.YELLOW, ", "));
}
builder.append(zoneClickable(TextColors.YELLOW, zone.getRealName()));
}
}
if (ownNothing)
{
builder.append(Text.of(TextColors.GRAY, LanguageHandler.FORMAT_NONE));
}
}
else
{
builder.append(Text.of(TextColors.GRAY, LanguageHandler.FORMAT_NONE));
}
return builder.build();
}
示例8: formatWorldDescription
import org.spongepowered.api.text.LiteralText.Builder; //导入方法依赖的package包/类
public static Text formatWorldDescription(String name)
{
Builder builder = Text.builder("");
builder.append(
Text.of(TextColors.GOLD, "----------{ "),
Text.of(TextColors.YELLOW, name),
Text.of(TextColors.GOLD, " }----------")
);
boolean enabled = ConfigHandler.getNode("worlds").getNode(name).getNode("enabled").getBoolean();
builder.append(Text.of(TextColors.GOLD, "\nEnabled: "));
builder.append(Text.builder(LanguageHandler.FLAG_ENABLED)
.color((enabled) ? TextColors.YELLOW : TextColors.DARK_GRAY)
.onClick(TextActions.runCommand("/nw enable " + name)).build());
builder.append(Text.of(TextColors.GOLD, "/"));
builder.append(Text.builder(LanguageHandler.FLAG_DISABLED)
.color((enabled) ? TextColors.DARK_GRAY : TextColors.YELLOW)
.onClick(TextActions.runCommand("/nw disable " + name)).build());
if (!enabled)
{
return builder.build();
}
builder.append(Text.of(TextColors.GOLD, "\n" + LanguageHandler.FORMAT_PERMISSIONS + ": "));
boolean canBuild = ConfigHandler.getNode("worlds").getNode(name).getNode("perms", "build").getBoolean();
builder.append(Text.builder(LanguageHandler.TYPE_BUILD).color((canBuild) ? TextColors.GREEN : TextColors.RED).onClick(TextActions.runCommand("/nw perm " + Nation.PERM_BUILD)).build());
builder.append(Text.of(TextColors.GOLD, "/"));
boolean canInteract = ConfigHandler.getNode("worlds").getNode(name).getNode("perms", "interact").getBoolean();
builder.append(Text.builder(LanguageHandler.TYPE_INTERACT).color((canInteract) ? TextColors.GREEN : TextColors.RED).onClick(TextActions.runCommand("/nw perm " + Nation.PERM_INTERACT)).build());
builder.append(Text.of(TextColors.DARK_GRAY, " <- " + LanguageHandler.CLICK));
builder.append(Text.of(TextColors.GOLD, "\n" + LanguageHandler.FORMAT_FLAGS + ":"));
for (Entry<Object, ? extends CommentedConfigurationNode> e : ConfigHandler.getNode("worlds").getNode(name).getNode("flags").getChildrenMap().entrySet())
{
String flag = e.getKey().toString();
boolean b = e.getValue().getBoolean();
builder.append(Text.of(TextColors.GOLD, "\n " + StringUtils.capitalize(flag.toLowerCase()) + ": "));
builder.append(Text.builder(LanguageHandler.FLAG_ENABLED).color((b) ? TextColors.YELLOW : TextColors.DARK_GRAY).onClick(TextActions.runCommand("/nw flag " + flag + " true")).build());
builder.append(Text.of(TextColors.GOLD, "/"));
builder.append(Text.builder(LanguageHandler.FLAG_DISABLED).color((b) ? TextColors.DARK_GRAY : TextColors.YELLOW).onClick(TextActions.runCommand("/nw flag " + flag + " false")).build());
builder.append(Text.of(TextColors.DARK_GRAY, " <- " + LanguageHandler.CLICK));
}
return builder.build();
}