Package com.sk89q.minecraft.util.commands

Examples of com.sk89q.minecraft.util.commands.CommandPermissionsException


    @Override
    public boolean call(String arguments, CommandLocals locals, String[] parentCommands) throws CommandException {
        // We have permission for this command if we have permissions for subcommands
        if (!testPermission(locals)) {
            throw new CommandPermissionsException();
        }

        String[] split = CommandContext.split(arguments);
        Set<String> aliases = getPrimaryAliases();
View Full Code Here


    @Override
    public boolean call(String stringArguments, CommandLocals locals, String[] parentCommands) throws CommandException {
        // Test permission
        if (!testPermission(locals)) {
            throw new CommandPermissionsException();
        }

        String calledCommand = parentCommands.length > 0 ? parentCommands[parentCommands.length - 1] : "_";
        String[] split = CommandContext.split(calledCommand + " " + stringArguments);
        CommandContext context = new CommandContext(split, getValueFlags(), false, locals);
View Full Code Here

     */
    public void checkPermission(CommandSender sender, String perm)
            throws CommandPermissionsException {

        if (!hasPermission(sender, perm)) {
            throw new CommandPermissionsException();
        }
    }
View Full Code Here

            if (!player.hasPermission("craftbook.mech.area.save." + context.getFlag('n')))
                throw new CommandException("You do not have permission to use this namespace.");
            namespace = context.getFlag('n');
            personal = false;
        } else if (!player.hasPermission("craftbook.mech.area.save.self"))
            throw new CommandPermissionsException();

        if (Area.instance.shortenNames && namespace.length() > 14)
            namespace = namespace.substring(0, 14);

        if (!CopyManager.isValidNamespace(namespace))
View Full Code Here

            if(!player.hasPermission("craftbook.mech.area.list." + context.getFlag('n')))
                throw new CommandException("You do not have permission to use this namespace.");
            namespace = context.getFlag('n');
        } else if (context.hasFlag('a') && player.hasPermission("craftbook.mech.area.list.all")) {
            namespace = "";
        } else if (!player.hasPermission("craftbook.mech.area.list.self")) throw new CommandPermissionsException();

        if (Area.instance.shortenNames && namespace.length() > 15)
            namespace = namespace.substring(0, 15);

        int page = 1;
View Full Code Here

        // Get the namespace
        if (context.hasFlag('n')) {
            if(!player.hasPermission("craftbook.mech.area.delete." + context.getFlag('n')))
                throw new CommandException("You do not have permission to use this namespace.");
            namespace = context.getFlag('n');
        } else if (!player.hasPermission("craftbook.mech.area.delete.self")) throw new CommandPermissionsException();

        if (Area.instance.shortenNames && namespace.length() > 15)
            namespace = namespace.substring(0, 15);

        boolean deleteAll = false;
View Full Code Here

            key = context.getFlag('n');

        if(!VariableManager.instance.hasVariable(context.getString(0), key)) {

            if(!hasVariablePermission(sender, key, context.getString(0), "define"))
                throw new CommandPermissionsException();
            if(!RegexUtil.VARIABLE_KEY_PATTERN.matcher(context.getString(0)).find())
                throw new FastCommandException("Invalid Variable Name!");
            if(!RegexUtil.VARIABLE_VALUE_PATTERN.matcher(context.getString(1)).find())
                throw new FastCommandException("Invalid Variable Value!");
            VariableManager.instance.setVariable(context.getString(0), key, context.getString(1));
View Full Code Here

            key = context.getFlag('n');

        if(VariableManager.instance.hasVariable(context.getString(0), key)) {

            if(!hasVariablePermission(sender, key, context.getString(0), "get"))
                throw new CommandPermissionsException();
            if(!RegexUtil.VARIABLE_KEY_PATTERN.matcher(context.getString(0)).find())
                throw new FastCommandException("Invalid Variable Name!");
            sender.sendMessage(ChatColor.YELLOW + context.getString(0) + ": " + VariableManager.instance.getVariable(context.getString(0), key));
        } else
            throw new FastCommandException("Unknown Variable!");
View Full Code Here

            key = context.getFlag('n');

        if(VariableManager.instance.hasVariable(context.getString(0), key)) {

            if(!hasVariablePermission(sender, key, context.getString(0), "erase"))
                throw new CommandPermissionsException();
            if(!RegexUtil.VARIABLE_KEY_PATTERN.matcher(context.getString(0)).find())
                throw new FastCommandException("Invalid Variable Name!");
            VariableManager.instance.removeVariable(context.getString(0), key);
            resetICCache(context.getString(0), key);
            sender.sendMessage(ChatColor.YELLOW + "Removed variable: " + context.getString(0));
View Full Code Here

    }

    public void checkModifyPermissions(CommandSender sender, String key, String var) throws CommandException {

        if(!hasVariablePermission(sender, key, var, "modify"))
            throw new CommandPermissionsException();
    }
View Full Code Here

TOP

Related Classes of com.sk89q.minecraft.util.commands.CommandPermissionsException

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.