Package net.citizensnpcs.api.command.exception

Examples of net.citizensnpcs.api.command.exception.CommandException


            }
            paginator.addLine("");
        }

        if (!paginator.sendPage(sender, page))
            throw new CommandException(Messages.COMMAND_PAGE_MISSING, page);
    }
View Full Code Here


        } if (!entriesPresent) paginator.addLine("<c>No Interact Scripts assigned.");
        paginator.addLine("");

        if (!entriesPresent) {
            if (!paginator.sendPage(sender, page))
                throw new CommandException(Messages.COMMAND_PAGE_MISSING);
            return;
        }

        // Scheduled Activities
        entriesPresent = false;
        paginator.addLine(ChatColor.GRAY + "Scheduled Scripts:");
        paginator.addLine("<e>Key: <a>Time  <b>Name");
        if (assignmentScript.contains("SCHEDULED ACTIVITIES")) {
            entriesPresent = true;
            for (String scriptEntry : assignmentScript.getStringList("SCHEDULED ACTIVITIES"))
                paginator.addLine("<a>" + scriptEntry.split(" ")[0] + "<b> " + scriptEntry.split(" ", 2)[1]);
        } if (!entriesPresent) paginator.addLine("<c>No scheduled scripts activities.");
        paginator.addLine("");

        // Actions
        entriesPresent = false;
        paginator.addLine(ChatColor.GRAY + "Actions:");
        paginator.addLine("<e>Key: <a>Action name  <b>Script Size");
        if (assignmentScript.contains("ACTIONS")) entriesPresent = true;
        if (entriesPresent)
            for (String action : assignmentScript.getConfigurationSection("ACTIONS").getKeys(false))
                paginator.addLine("<a>" + action + " <b>" + assignmentScript.getStringList("ACTIONS." + action).size());
        else paginator.addLine("<c>No actions defined in the assignment.");
        paginator.addLine("");

        if (!paginator.sendPage(sender, page))
            throw new CommandException(Messages.COMMAND_PAGE_MISSING, page);
    }
View Full Code Here

    @Requirements(selected = true, ownership = true)
    public void constants(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
        if (!npc.hasTrait(ConstantsTrait.class)) npc.addTrait(ConstantsTrait.class);
        ConstantsTrait trait = npc.getTrait(ConstantsTrait.class);
        if (args.hasValueFlag("set")) {
            if (!args.hasValueFlag("value")) throw new CommandException("--SET requires use of the '--VALUE \"constant value\"' argument.");
            trait.setConstant(args.getFlag("set"), args.getFlag("value"));
            Messaging.sendInfo(sender, npc.getName() + " has added constant '" + args.getFlag("set") + "'.");
            return;

        } else if (args.hasValueFlag("remove")) {
            trait.removeConstant(args.getFlag("remove"));
            Messaging.sendInfo(sender, npc.getName() + " has removed constant '" + args.getFlag("remove") + "'.");
            return;

        } else if (args.length() > 2 && args.getInteger(1, 0) < 1) {
            Messaging.send(sender, "");
            Messaging.send(sender, "<f>Use '--set name' to add/set a new NPC-specific constant.");
            Messaging.send(sender, "<f>Must also specify '--value \"constant value\"'.");
            Messaging.send(sender, "<b>Example: /npc constant --set constant_1 --value \"test value\"");
            Messaging.send(sender, "<f>Remove NPC-specific constants with '--remove name'");
            Messaging.send(sender, "<f>Note: Constants set will override any specified in an");
            Messaging.send(sender, "<f>assignment. Constants specified in assignments cannot be");
            Messaging.send(sender, "<f>removed with this command.");
            Messaging.send(sender, "");
            return;
        }

        try {
            trait.describe(sender, args.getInteger(1, 1));
        } catch (net.citizensnpcs.api.command.exception.CommandException e) {
            throw new CommandException(e.getMessage());
        }
    }
View Full Code Here

        }

        try {
            trait.describe(sender, args.getInteger(1, 1));
        } catch (net.citizensnpcs.api.command.exception.CommandException e) {
            throw new CommandException(e.getMessage());
        }
    }
View Full Code Here

        }

        try {
            trait.describe(sender, args.getInteger(1, 1));
        } catch (net.citizensnpcs.api.command.exception.CommandException e) {
            throw new CommandException(e.getMessage());
        }
    }
View Full Code Here

                    + "<d> " + getCooldownType(entry.getKey()).name()
                    + "<e> " + (getRadius(entry.getKey()) == -1 ? "" : getRadius(entry.getKey()));
            paginator.addLine(line);
        }
        if (!paginator.sendPage(sender, page))
            throw new CommandException(Messages.COMMAND_PAGE_MISSING, page);
    }
View Full Code Here

TOP

Related Classes of net.citizensnpcs.api.command.exception.CommandException

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.