Examples of InvalidUsage


Examples of com.iCo6.command.exceptions.InvalidUsage

    }

    @Override
    public boolean perform(CommandSender sender, LinkedHashMap<String, Argument> arguments) throws InvalidUsage {
        if(!hasPermissions(sender, "empty"))
            throw new InvalidUsage("You do not have permission to do that.");

        Accounts.empty();

        String tag = template.color(Template.Node.TAG_MONEY);
        template.set(Template.Node.ACCOUNTS_EMPTY);
View Full Code Here

Examples of com.iCo6.command.exceptions.InvalidUsage

        String name = arguments.get("name").getStringValue();
        String tag = template.color(Template.Node.TAG_MONEY);
        Double amount;

        if(name.equals("0"))
            throw new InvalidUsage("Missing <white>name<rose>: /money pay <name> <amount>");

        if(arguments.get("amount").getStringValue().equals("empty"))
            throw new InvalidUsage("Missing <white>amount<rose>: /money pay <name> <amount>");

        try {
            amount = arguments.get("amount").getDoubleValue();
        } catch(NumberFormatException e) {
            throw new InvalidUsage("Invalid <white>amount<rose>, must be double.");
        }

        if(Double.isInfinite(amount) || Double.isNaN(amount))
            throw new InvalidUsage("Invalid <white>amount<rose>, must be double.");

        if(amount < 0.1)
            throw new InvalidUsage("Invalid <white>amount<rose>, cannot be less than 0.1");

        if(Common.matches(from.getName(), name)) {
            template.set(Template.Node.PAYMENT_SELF);
            Messaging.send(sender, template.parse());
            return false;
View Full Code Here

Examples of com.iCo6.command.exceptions.InvalidUsage

    }

    @Override
    public boolean perform(CommandSender sender, LinkedHashMap<String, Argument> arguments) throws InvalidUsage {
        if(!hasPermissions(sender, "purge"))
            throw new InvalidUsage("You do not have permission to do that.");

        Accounts.purge();

        String tag = template.color(Template.Node.TAG_MONEY);
        template.set(Template.Node.ACCOUNTS_PURGE);
View Full Code Here

Examples of com.iCo6.command.exceptions.InvalidUsage

    }

    @Override
    public boolean perform(CommandSender sender, LinkedHashMap<String, Argument> arguments) throws InvalidUsage {
        if(!hasPermissions(sender, "create"))
            throw new InvalidUsage("You do not have permission to do that.");

        String name = arguments.get("name").getStringValue();
        String tag = template.color(Template.Node.TAG_MONEY);

        if(name.equals("0"))
            throw new InvalidUsage("Missing <white>name<rose>: /money create <name>");

        if(Accounts.exists(name)) {
            template.set(Template.Node.ERROR_EXISTS);
            Messaging.send(sender, tag + template.parse());
            return false;
View Full Code Here

Examples of com.iCo6.command.exceptions.InvalidUsage

    @Override
    public boolean perform(CommandSender sender, LinkedHashMap<String, Argument> arguments) throws InvalidUsage {
        if(Constants.Nodes.useHoldingsPermission.getBoolean())
            if(!hasPermissions(sender, "money"))
                throw new InvalidUsage("You do not have permission to do that.");

        String name = arguments.get("name").getStringValue();
        String tag = template.color(Template.Node.TAG_MONEY);

        if(name.equals("0")) {
            if(isConsole(sender)) {
                Messaging.send(sender, "`rCannot check money on non-living organism.");
                return false;
            }

            Player player = (Player) sender;

            if(player == null)
                return false;

            Account account = new Account(player.getName());
            account.getHoldings().showBalance(null);
            return false;
        }

        if(!hasPermissions(sender, "money+"))
            throw new InvalidUsage("You do not have permission to do that.");

        if(!Accounts.exists(name)) {
            template.set(Template.Node.ERROR_ACCOUNT);
            template.add("name", name);
View Full Code Here

Examples of com.iCo6.command.exceptions.InvalidUsage

    }

    @Override
    public boolean perform(CommandSender sender, LinkedHashMap<String, Argument> arguments) throws InvalidUsage {
        if(!hasPermissions(sender, "top"))
            throw new InvalidUsage("You do not have permission to do that.");

        template.set(Template.Node.TOP_OPENING);
        Messaging.send(sender, template.parse());

        template.set(Template.Node.TOP_ITEM);
View Full Code Here

Examples of com.iCo6.command.exceptions.InvalidUsage

    }

    @Override
    public boolean perform(CommandSender sender, LinkedHashMap<String, Argument> arguments) throws InvalidUsage {
        if(!hasPermissions(sender, "status"))
            throw new InvalidUsage("You do not have permission to do that.");

        String name = arguments.get("name").getStringValue();
        String tag = template.color(Template.Node.TAG_MONEY);
        boolean self = false;

        if(!isConsole(sender))
            if(((Player)sender).getName().equalsIgnoreCase(name))
                self = true;

        if(name.equals("0"))
            throw new InvalidUsage("Missing <white>name<rose>: /money status <name> (new status)");

        if(!Accounts.exists(name)) {
            template.set(Template.Node.ERROR_ACCOUNT);
            template.add("name", name);

            Messaging.send(sender, tag + template.parse());
            return false;
        }

        Account account = new Account(name);

        if(arguments.get("status").getStringValue().equalsIgnoreCase("empty")) {
            int current = account.getStatus();

            if(self)
                template.set(Template.Node.PERSONAL_STATUS);
            else {
                template.set(Template.Node.PLAYER_STATUS);
                template.add("name", name);
            }

            template.add("status", current);
            Messaging.send(sender, tag + template.parse());

        } else {
            if(!hasPermissions(sender, "status+"))
                throw new InvalidUsage("You do not have permission to do that.");

            int status = arguments.get("status").getIntegerValue();
            account.setStatus(status);

            template.set(Template.Node.ACCOUNTS_STATUS);
View Full Code Here

Examples of com.iCo6.command.exceptions.InvalidUsage

    }

    @Override
    public boolean perform(CommandSender sender, LinkedHashMap<String, Argument> arguments) throws InvalidUsage {
        if(!hasPermissions(sender, "remove"))
            throw new InvalidUsage("You do not have permission to do that.");

        String name = arguments.get("name").getStringValue();
        String tag = template.color(Template.Node.TAG_MONEY);

        if(name.equals("0"))
            throw new InvalidUsage("Missing <white>name<rose>: /money remove <name>");

        if(!Accounts.exists(name)) {
            template.set(Template.Node.ERROR_ACCOUNT);
            template.add("name", name);
            Messaging.send(sender, tag + template.parse());
View Full Code Here

Examples of com.iCo6.command.exceptions.InvalidUsage

    }

    @Override
    public boolean perform(CommandSender sender, LinkedHashMap<String, Argument> arguments) throws InvalidUsage {
        if(!hasPermissions(sender, "set"))
            throw new InvalidUsage("You do not have permission to do that.");

        String name = arguments.get("name").getStringValue();
        String tag = template.color(Template.Node.TAG_MONEY);
        Double amount;

        if(name.equals("0"))
            throw new InvalidUsage("Missing <white>name<rose>: /money set <name> <amount>");

        if(arguments.get("amount").getStringValue().equals("empty"))
            throw new InvalidUsage("Missing <white>amount<rose>: /money set <name> <amount>");

        try {
            amount = arguments.get("amount").getDoubleValue();
        } catch(NumberFormatException e) {
            throw new InvalidUsage("Invalid <white>amount<rose>, must be double.");
        }

        if(Double.isInfinite(amount) || Double.isNaN(amount))
            throw new InvalidUsage("Invalid <white>amount<rose>, must be double.");

        if(!Accounts.exists(name)) {
            template.set(Template.Node.ERROR_ACCOUNT);
            template.add("name", name);
View Full Code Here

Examples of com.iCo6.command.exceptions.InvalidUsage

    }

    @Override
    public boolean perform(CommandSender sender, LinkedHashMap<String, Argument> arguments) throws InvalidUsage {
        if(!hasPermissions(sender, "help"))
            throw new InvalidUsage("You do not have permission to do that.");

        // TODO: add support for checking help on single command.

        Messaging.send(sender, "`w ");
        Messaging.send(sender, "`w iConomy (`y" + Constants.Nodes.CodeName.toString() + "`w)");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.