本文整理汇总了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;
}
示例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");
}
示例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");
}
示例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");
}
示例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();
}
示例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");
}
示例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", "?");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}