Package com.sk89q.worldedit.util.command

Examples of com.sk89q.worldedit.util.command.Description


    public void registerCommands(Dispatcher dispatcher) {
        if (server == null) return;
        ServerCommandManager mcMan = (ServerCommandManager) server.getCommandManager();

        for (final CommandMapping command : dispatcher.getCommands()) {
            final Description description = command.getDescription();
            mcMan.registerCommand(new CommandBase() {
                @Override
                public String getCommandName() {
                    return command.getPrimaryAlias();
                }

                @Override
                public List<String> getCommandAliases() {
                    return Arrays.asList(command.getAllAliases());
                }

                @Override
                public void processCommand(ICommandSender var1, String[] var2) {}

                @Override
                public String getCommandUsage(ICommandSender icommandsender) {
                    return "/" + command.getPrimaryAlias() + " " + description.getUsage();
                }

                @Override
                public int getRequiredPermissionLevel() {
                    return 0;
View Full Code Here


    @Override
    public String getFullText(Command command) {
        CommandMapping mapping = dispatcher.get(command.getName());
        if (mapping != null) {
            Description description = mapping.getDescription();
            return "Usage: " + description.getUsage() + (description.getHelp() != null ? "\n" + description.getHelp() : "");
        } else {
            logger.warning("BukkitCommandInspector doesn't know how about the command '" + command + "'");
            return "Help text not available";
        }
    }
View Full Code Here

    public void registerCommands(Dispatcher dispatcher) {
        List<CommandInfo> toRegister = new ArrayList<CommandInfo>();
        BukkitCommandInspector inspector = new BukkitCommandInspector(plugin, dispatcher);
       
        for (CommandMapping command : dispatcher.getCommands()) {
            Description description = command.getDescription();
            List<String> permissions = description.getPermissions();
            String[] permissionsArray = new String[permissions.size()];
            permissions.toArray(permissionsArray);

            toRegister.add(new CommandInfo(description.getUsage(), description.getShortDescription(), command.getAllAliases(), inspector, permissionsArray));
        }

        dynamicCommands.register(toRegister);
    }
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.util.command.Description

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.