Examples of InvalidArgumentsException


Examples of com.cedarsolutions.exception.InvalidArgumentsException

            while (i < args.length) {
                String item = args[i];

                if (option.equals(item)) {
                    if ((i + 1) >= args.length) {
                        throw new InvalidArgumentsException("Parameter " + option + " was malformed.");
                    } else {
                        if (result != null) {
                            throw new InvalidArgumentsException("Parameter " + option + " was found more than once.");
                        } else {
                            result = args[++i];
                        }
                    }
                }

                i += 1;
            }
        }

        if (result == null) {
            throw new InvalidArgumentsException("Parameter " + option + " was not found");
        }

        return result;
    }
View Full Code Here

Examples of com.cedarsolutions.exception.InvalidArgumentsException

            while (i < args.length) {
                String item = args[i];

                if (option.equals(item)) {
                    if ((i + 1) >= args.length) {
                        throw new InvalidArgumentsException("Parameter " + option + " was malformed.");
                    } else {
                        if (result != null) {
                            throw new InvalidArgumentsException("Parameter " + option + " was found more than once.");
                        } else {
                            result = args[++i];
                        }
                    }
                }
View Full Code Here

Examples of com.cedarsolutions.exception.InvalidArgumentsException

            while (i < args.length) {
                String item = args[i];

                if (option.equals(item)) {
                    if ((i + 1) >= args.length) {
                        throw new InvalidArgumentsException("Parameter " + option + " was malformed.");
                    } else {
                        result.add(args[++i]);
                    }
                }

                i += 1;
            }
        }

        if (result.isEmpty()) {
            throw new InvalidArgumentsException("Parameter " + option + " was not found");
        }

        return result;
    }
View Full Code Here

Examples of com.cedarsolutions.exception.InvalidArgumentsException

            while (i < args.length) {
                String item = args[i];

                if (option.equals(item)) {
                    if ((i + 1) >= args.length) {
                        throw new InvalidArgumentsException("Parameter " + option + " was malformed.");
                    } else {
                        result.add(args[++i]);
                    }
                }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

            else arg.reportUnhandled();

        }

        if (!scriptEntry.hasObject("script") && !scriptEntry.hasObject("local"))
            throw new InvalidArgumentsException("Must define a SCRIPT to be run.");

        if (!scriptEntry.hasObject("path") && scriptEntry.hasObject("local"))
            throw new InvalidArgumentsException("Must specify a PATH.");

    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

        scriptEntry.defaultObject("location",
                ((BukkitScriptEntryData)scriptEntry.entryData).hasNPC() ? ((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getLocation() : null,
                ((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getLocation() : null);

        if (!scriptEntry.hasObject("location")) {
            throw new InvalidArgumentsException("Missing location argument!");
        }
    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

            if (!scriptEntry.hasObject("entity_type")
                    && arg.matchesArgumentType(dEntity.class)) {
                // Avoid duplication of objects
                dEntity ent = arg.asType(dEntity.class);
                if (!ent.isGeneric() && !ent.isNPC())
                    throw new InvalidArgumentsException("Entity supplied must be generic or an NPC!");
                scriptEntry.addObject("entity_type", ent);
            }

            else if (!scriptEntry.hasObject("spawn_location")
                    && arg.matchesArgumentType(dLocation.class))
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

        }

        // Only required thing is a valid NPC. This may be an already linked
        // NPC, or one specified by arguments
        if (((BukkitScriptEntryData)scriptEntry.entryData).getNPC() == null)
            throw new InvalidArgumentsException("NPC linked was missing or invalid.");

    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

            else arg.reportUnhandled();
        }

        // Check required arguments
        if (!scriptEntry.hasObject("location") && !scriptEntry.hasObject("cuboid"))
            throw new InvalidArgumentsException("Must specify a source loaction or cuboid.");

        if (!scriptEntry.hasObject("destination"))
            throw new InvalidArgumentsException("Must specify a destination location.");

        // Set defaults
        scriptEntry.defaultObject("remove", Element.FALSE);
    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

        //stand should have no additional arguments
        for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) {
            arg.reportUnhandled();
        }
        if (!((BukkitScriptEntryData)scriptEntry.entryData).hasNPC())
            throw new InvalidArgumentsException("This command requires a linked NPC!");

    }
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.