@Override public void registerCommands(Dispatcher dispatcher) { for (CommandMapping command : dispatcher.getCommands()) { CommandAdapter adapter = new CommandAdapter(command) { @Override public CommandResult process(CommandSource source, String arguments) throws org.spongepowered.api.command.CommandException { CommandEvent weEvent = new CommandEvent(SpongeWorldEdit.inst().wrapCommandSource(source), command.getPrimaryAlias() + " " + arguments); WorldEdit.getInstance().getEventBus().post(weEvent); return weEvent.isCancelled() ? CommandResult.success() : CommandResult.empty(); } @Override public List<String> getSuggestions(CommandSource source, String arguments, @Nullable Location<org.spongepowered.api.world.World> targetPosition) throws CommandException { CommandSuggestionEvent weEvent = new CommandSuggestionEvent(SpongeWorldEdit.inst().wrapCommandSource(source), command.getPrimaryAlias() + " " + arguments); WorldEdit.getInstance().getEventBus().post(weEvent); return weEvent.getSuggestions(); } }; Sponge.getCommandManager().register(SpongeWorldEdit.inst(), adapter, command.getAllAliases()); } }
@Override public void registerCommand(BaseCommand command) { command.onRegister(this); for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) { String commandName = entry.getKey().toLowerCase(); SpongeRootCommand spongeCommand = (SpongeRootCommand) entry.getValue(); if (!spongeCommand.isRegistered) { Sponge.getCommandManager().register(this.plugin, spongeCommand, commandName); } spongeCommand.isRegistered = true; registeredCommands.put(commandName, spongeCommand); } }
@Listener public void onServerStart(GameStartedServerEvent event) { this.game.getCommandManager().register(this, this, "spark"); }
@Override public void registerCommand(CommandSpec command) { game.getCommandManager().register(this, new PEXSpongeCommand(command, this), command.getAliases()); }
@Override public void registerCommands() { getGame().getCommandManager().register(THIS, new SpongeCommand(), "plots", "p", "plot", "ps", "plotsquared", "p2", "2"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder().arguments(GenericArguments.playerOrSource(Text.of("sniper"))).executor(new VoxelDefaultCommand()) .permission(VoxelSniperConfiguration.PERMISSION_SNIPER).description(Text.of("Resets your VoxelSniper brush settings")) .build(), "d"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder().arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.integer(Text.of("center"))) .executor(new VoxelCenterCommand()).permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper Center point selection")).build(), "vc"); }
public static void setup(Object plugin) { Sponge.getCommandManager() .register(plugin, CommandSpec.builder() .arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.remainingJoinedStrings(Text.of("args"))) .executor(new VoxelBrushToolCommand()) .permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper brush tool settings")).build(), "btool"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder().arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.integer(Text.of("height"))) .executor(new VoxelHeightCommand()).permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper Height selection")).build(), "vh"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder() .arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.optional(GenericArguments.integer(Text.of("count")))) .executor(new VoxelUndoCommand()).permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper undo")).build(), "u"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder() .arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("args")))) .executor(new VoxelSniperCommand()).permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper material list selection")).build(), "vs"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder().arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.string(Text.of("performer"))) .executor(new VoxelPerformerCommand()).permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper performer selection")).build(), "p"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder() .arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.player(Text.of("target"))) .executor(new VoxelUndoUserCommand()).permission(VoxelSniperConfiguration.PERMISSION_COMMAND_UNDO_OTHER) .description(Text.of("VoxelSniper undo other user")).build(), "uu"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder() .arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.optional(GenericArguments.string(Text.of("material")))) .executor(new VoxelVoxelCommand()).permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper material selection")).build(), "v"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder() .arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("args")))) .executor(new VoxelListCommand()).permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper material list selection")).build(), "vl"); }
@Override public void onInitialize() throws CraftBookException { super.onInitialize(); signCopierItem.load(config); usePermissions.register(); signs = new HashMap<>(); CommandSpec signEditCommand = CommandSpec.builder() .permission(editPermissions.getNode()) .arguments(GenericArguments.integer(Text.of("line")), GenericArguments.remainingJoinedStrings(Text.of("text"))) .executor(new EditSignCommand(this)) .description(Text.of("Allows editing the currently copied sign!")) .build(); signCommandManager = Sponge.getCommandManager().register(CraftBookPlugin.spongeInst().getContainer(), CommandSpec.builder() .child(signEditCommand, "edit") .description(Text.of("Base command of the SignCopier mechanic")) .build(), "sign", "signcopier").orElse(null); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder() .arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.optional(GenericArguments.string(Text.of("material")))) .executor(new VoxelReplaceCommand()).permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper replace material selection")).build(), "vr"); }
public static void setup(Object plugin) { Sponge.getCommandManager() .register(plugin, CommandSpec.builder() .arguments( GenericArguments.optional(GenericArguments.string(Text.of("brush"))), GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("brush_args")))) .executor(new VoxelBrushCommand()) .permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper brush settings")).build(), "b", "brush"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder() .arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.string(Text.of("key")), GenericArguments.literal(Text.of("equals"), "="), GenericArguments.string(Text.of("value"))) .executor(new VoxelInkReplaceCommand()).permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper Replace Ink selection")).build(), "vir"); }
public static void setup(Object plugin) { Sponge.getCommandManager().register(plugin, CommandSpec.builder() .arguments(GenericArguments.playerOrSource(Text.of("sniper")), GenericArguments.string(Text.of("key")), GenericArguments.literal(Text.of("equals"), "="), GenericArguments.string(Text.of("value"))) .executor(new VoxelInkCommand()).permission(VoxelSniperConfiguration.PERMISSION_SNIPER) .description(Text.of("VoxelSniper Ink selection")).build(), "vi"); }