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


Java CommandSpec.Builder方法代码示例

本文整理汇总了Java中org.spongepowered.api.command.spec.CommandSpec.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java CommandSpec.Builder方法的具体用法?Java CommandSpec.Builder怎么用?Java CommandSpec.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.spongepowered.api.command.spec.CommandSpec的用法示例。


在下文中一共展示了CommandSpec.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerSubCommand

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
/**
 * Registers a {@link PhononSubcommand}
 *
 * @param subcommandToRegister The subcommand to register.
 * @return <code>true</code> if successful.
 */
public boolean registerSubCommand(PhononSubcommand subcommandToRegister) {
    // Work out how the sub command system will work - probably annotation based, but not sure yet.
    // By definition, all subcommands will be lower case

    // Register the command.
    Collection<String> sc = Arrays.asList(subcommandToRegister.getAliases());
    if (subCommands.keySet().stream().map(String::toLowerCase).noneMatch(sc::contains)) {
        // We can register the aliases. Create the CommandSpec
        // We might want to add descriptions in.
        CommandSpec.Builder specbuilder = CommandSpec.builder();
        subcommandToRegister.getPermission().ifPresent(specbuilder::permission);
        CommandSpec spec = specbuilder
            .arguments(subcommandToRegister.getArguments())
            .executor(subcommandToRegister)
            .build();

        sc.forEach(x -> subCommands.put(x.toLowerCase(), spec));
        return true;
    }

    return false;
}
 
开发者ID:NucleusPowered,项目名称:Phonon,代码行数:29,代码来源:PhononCommand.java

示例2: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nationadmin.extra")
			.arguments(
					GenericArguments.optional(GenericArguments.choices(Text.of("give|take|set"),
							ImmutableMap.<String, String> builder()
									.put("give", "give")
									.put("take", "take")
									.put("set", "set")
									.build())),
					GenericArguments.optional(new NationNameElement(Text.of("nation"))),
					GenericArguments.optional(GenericArguments.integer(Text.of("amount"))))
			.executor(new NationadminExtraExecutor())
			.build(), "extra");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:17,代码来源:NationadminExtraExecutor.java

示例3: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nationadmin.perm")
			.arguments(
					GenericArguments.optional(new NationNameElement(Text.of("nation"))),
					GenericArguments.optional(GenericArguments.choices(Text.of("type"),
							ImmutableMap.<String, String> builder()
									.put(Nation.TYPE_OUTSIDER, Nation.TYPE_OUTSIDER)
									.put(Nation.TYPE_CITIZEN, Nation.TYPE_CITIZEN)
									.put(Nation.TYPE_COOWNER, Nation.TYPE_COOWNER)
									.build())),
					GenericArguments.optional(GenericArguments.choices(Text.of("perm"),
							ImmutableMap.<String, String> builder()
									.put(Nation.PERM_BUILD, Nation.PERM_BUILD)
									.put(Nation.PERM_INTERACT, Nation.PERM_INTERACT)
									.build())),
					GenericArguments.optional(GenericArguments.bool(Text.of("bool"))))
			.executor(new NationadminPermExecutor())
			.build(), "perm");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:22,代码来源:NationadminPermExecutor.java

示例4: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nationadmin.create")
			.arguments(GenericArguments.optional(GenericArguments.string(Text.of("name"))))
			.executor(new NationadminCreateExecutor())
			.build(), "create");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:9,代码来源:NationadminCreateExecutor.java

示例5: register

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public void register() {
    currentCommandScripts.add(this);
    if (Denizen2Core.getImplementation().generalDebug()) {
        Debug.good("Registering command " + ColorSet.emphasis + cmdName + ColorSet.good + " to sponge...");
    }
    CommandSpec.Builder cmdspecb = CommandSpec.builder()
            .description(Text.of(cmdDesc))
            .arguments(GenericArguments.optional(GenericArguments.remainingRawJoinedStrings(Text.of("dCommand"))))
            .executor(this);
    if (cmdPerm != null) {
        cmdspecb.permission(cmdPerm);
    }
    CommandSpec cmdspec = cmdspecb.build();
    cmdMapping = Sponge.getCommandManager().register(Denizen2Sponge.instance, cmdspec, cmdName).get();
}
 
开发者ID:DenizenScript,项目名称:Denizen2Sponge,代码行数:16,代码来源:GameCommandScript.java

示例6: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(NationsPlugin plugin)
{

	CommandSpec.Builder nationCmd = CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nation.execute")
			.executor(new NationInfoExecutor());

	CommandSpec.Builder nationadminCmd = CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nationadmin.execute")
			.executor(new NationadminExecutor());

	CommandSpec.Builder zoneCmd = CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.zone.execute")
			.executor(new ZoneExecutor());

	CommandSpec.Builder nationworldCmd = CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nationworld.execute")
			.executor(new NationworldExecutor());

	createCmds(nationCmd, "com.arckenver.nations.cmdexecutor.nation");
	createCmds(nationadminCmd, "com.arckenver.nations.cmdexecutor.nationadmin");
	createCmds(zoneCmd, "com.arckenver.nations.cmdexecutor.zone");
	createCmds(nationworldCmd, "com.arckenver.nations.cmdexecutor.nationworld");

	Sponge.getCommandManager().register(plugin, nationadminCmd.build(), "nationadmin", "na", "nationsadmin");
	Sponge.getCommandManager().register(plugin, nationCmd.build(), "nation", "n", "nations");
	Sponge.getCommandManager().register(plugin, zoneCmd.build(), "zone", "z");
	Sponge.getCommandManager().register(plugin, nationworldCmd.build(), "nationworld", "nw");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:34,代码来源:NationCmds.java

示例7: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nationworld.help")
			.arguments()
			.executor(new NationworldExecutor())
			.build(), "help", "?");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:9,代码来源:NationworldExecutor.java

示例8: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nationworld.list")
			.arguments()
			.executor(new NationworldListExecutor())
			.build(), "list");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:9,代码来源:NationworldListExecutor.java

示例9: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nation.leave")
			.arguments()
			.executor(new NationLeaveExecutor())
			.build(), "leave", "quit");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:9,代码来源:NationLeaveExecutor.java

示例10: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nationadmin.forceupkeep")
			.arguments()
			.executor(new NationadminForceupkeepExecutor())
			.build(), "forceupkeep");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:9,代码来源:NationadminForceupkeepExecutor.java

示例11: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nation.citizen")
			.arguments(GenericArguments.optional(new PlayerNameElement(Text.of("player"))))
			.executor(new NationCitizenExecutor())
			.build(), "citizen", "whois");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:9,代码来源:NationCitizenExecutor.java

示例12: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.zone.setowner")
			.arguments(GenericArguments.optional(new PlayerNameElement(Text.of("owner"))))
			.executor(new ZoneSetownerExecutor())
			.build(), "setowner");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:9,代码来源:ZoneSetownerExecutor.java

示例13: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nation.deposit")
			.arguments(GenericArguments.optional(GenericArguments.doubleNum(Text.of("amount"))))
			.executor(new NationDepositExecutor())
			.build(), "deposit", "give");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:9,代码来源:NationDepositExecutor.java

示例14: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nationadmin.spy")
			.arguments()
			.executor(new NationadminSpyExecutor())
			.build(), "spy", "spychat");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:9,代码来源:NationadminSpyExecutor.java

示例15: create

import org.spongepowered.api.command.spec.CommandSpec; //导入方法依赖的package包/类
public static void create(CommandSpec.Builder cmd) {
	cmd.child(CommandSpec.builder()
			.description(Text.of(""))
			.permission("nations.command.nation.here")
			.arguments()
			.executor(new NationHereExecutor())
			.build(), "here", "h");
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:9,代码来源:NationHereExecutor.java


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