当前位置: 首页>>代码示例>>Java>>正文


Java Builder类代码示例

本文整理汇总了Java中org.spongepowered.api.text.LiteralText.Builder的典型用法代码示例。如果您正苦于以下问题:Java Builder类的具体用法?Java Builder怎么用?Java Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Builder类属于org.spongepowered.api.text.LiteralText包,在下文中一共展示了Builder类的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();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:19,代码来源:EEExp.java

示例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();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:26,代码来源:EESpeed.java

示例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();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:17,代码来源:EETree.java

示例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();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:22,代码来源:EEGameMode.java

示例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();
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:32,代码来源:EParentCommand.java

示例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();
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:12,代码来源:EEButcherType.java

示例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();
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:78,代码来源:Utils.java

示例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();
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:52,代码来源:Utils.java


注:本文中的org.spongepowered.api.text.LiteralText.Builder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。