Examples of InvalidArgumentsException


Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

        }

        // Check to make sure required arguments have been filled

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

        if (!scriptEntry.hasObject("text"))
            throw new InvalidArgumentsException("Must specify sign text!");

        // Default to SIGN_POST type
        scriptEntry.defaultObject("type", new Element(Type.AUTOMATIC.name()));
    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

                arg.reportUnhandled();

        }

        if (!scriptEntry.hasObject("sound"))
            throw new InvalidArgumentsException("Missing sound argument!");
        if (!scriptEntry.hasObject("locations") && !scriptEntry.hasObject("entities"))
            throw new InvalidArgumentsException("Missing location argument!");

        scriptEntry.defaultObject("volume", new Element(1));
        scriptEntry.defaultObject("pitch", new Element(1));
        scriptEntry.defaultObject("custom", Element.FALSE);
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

            else
                arg.reportUnhandled();
        }

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

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

        if (!scriptEntry.hasObject("type"))
            scriptEntry.addObject("type", new Element("INFO"));
    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

            else
                arg.reportUnhandled();
        }

        if (!scriptEntry.hasObject("actions"))
            throw new InvalidArgumentsException("Must specify a list of action names!");

        if (!scriptEntry.hasObject("npcs")) {
            if (((BukkitScriptEntryData)scriptEntry.entryData).hasNPC())
                scriptEntry.addObject("npcs", Arrays.asList(((BukkitScriptEntryData)scriptEntry.entryData).getNPC()));
            else
                throw new InvalidArgumentsException("Must specify an NPC to use!");
        }

        scriptEntry.defaultObject("context", new dList());

    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

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

        // Check to make sure required arguments have been filled
        if (!scriptEntry.hasObject("entities"))
            throw new InvalidArgumentsException("Must specify entity/entities!");

        if (!scriptEntry.hasObject("location"))
            throw new InvalidArgumentsException("Must specify a location!");
    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

        for (String arg : scriptEntry.getArguments())
            if (aH.matchesState(arg))
                vulnerable = Toggle.valueOf(aH.getStringFrom(arg).toUpperCase());

        if (((BukkitScriptEntryData)scriptEntry.entryData).getNPC() == null)
            throw new InvalidArgumentsException("This command requires a linked NPC!");

        // Add objects that need to be passed to execute() to the scriptEntry
        scriptEntry.addObject("vulnerable", vulnerable);
    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

                scriptEntry.addObject("name", arg.asElement());

        }

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

        if (((BukkitScriptEntryData)scriptEntry.entryData).getNPC() == null || !((BukkitScriptEntryData)scriptEntry.entryData).getNPC().isValid())
            throw new InvalidArgumentsException("Must have a NPC attached!");
    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

            if (((BukkitScriptEntryData)scriptEntry.entryData).getPlayer() != null)
                entities.add(((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getDenizenEntity());
            else if (((BukkitScriptEntryData)scriptEntry.entryData).getNPC() != null)
                entities.add(((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getDenizenEntity());
            else
                throw new InvalidArgumentsException("No valid target entities found.");
            scriptEntry.addObject("entities", entities);
        }

    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

        }

        // Check to make sure required arguments have been filled

        if (!scriptEntry.hasObject("entities"))
            throw new InvalidArgumentsException("Must specify entity/entities!");

        if (!scriptEntry.hasObject("effect") && !scriptEntry.hasObject("animation"))
            throw new InvalidArgumentsException("Must specify a valid animation!");
    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

                // Check the type of script.. it must be an assignment-type container
                if (arg.asType(dScript.class) != null
                        && arg.asType(dScript.class).getType().equalsIgnoreCase("assignment"))
                    scriptEntry.addObject("script", arg.asType(dScript.class));
                else
                    throw new InvalidArgumentsException("Script specified is not an 'assignment-type' container.");
            }


            else arg.reportUnhandled();
        }

        // Check required arguments
        if (!((BukkitScriptEntryData)scriptEntry.entryData).hasNPC())
            throw new InvalidArgumentsException("NPC linked was missing or invalid.");

        if (!scriptEntry.hasObject("action"))
            throw new InvalidArgumentsException("Must specify an action!");

        if (scriptEntry.getObject("action").equals(Action.SET) && !scriptEntry.hasObject("script"))
            throw new InvalidArgumentsException("Script specified was missing or invalid.");

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