Package net.aufdemrand.denizencore.exceptions

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


        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

                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

            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

        }

        // 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

                // 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

        for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) {

            if (!scriptEntry.hasObject("target")
                    && arg.matches("player")) {
                if (!((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer())
                    throw new InvalidArgumentsException("No player attached!");
                scriptEntry.addObject("target", Arrays.asList(((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getDenizenEntity()));
            }

            else if (!scriptEntry.hasObject("qty")
                    && arg.matchesPrimitive(aH.PrimitiveType.Integer))
                scriptEntry.addObject("qty", arg.asElement());

            else if (!scriptEntry.hasObject("target")
                    && arg.matchesArgumentList(dEntity.class))
                scriptEntry.addObject("target", arg.asType(dList.class).filter(dEntity.class, scriptEntry));

            else if (!scriptEntry.hasObject("action")
                    && arg.matchesPrefix("state"))
                scriptEntry.addObject("action", arg.asElement());

            else arg.reportUnhandled();
        }


        // Check for required information

        if (!scriptEntry.hasObject("qty") && !scriptEntry.hasObject("action"))
            throw new InvalidArgumentsException("Must specify a quantity!");
        if (!scriptEntry.hasObject("target")) {
            if (!((BukkitScriptEntryData)scriptEntry.entryData).hasNPC())
                throw new InvalidArgumentsException("Missing NPC!");
            scriptEntry.addObject("target", Arrays.asList(((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getDenizenEntity()));
        }

    }
View Full Code Here

            else arg.reportUnhandled();
        }

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

        if (!scriptEntry.hasObject("cancel")) {

            scriptEntry.defaultObject("holder",
                    ((BukkitScriptEntryData)scriptEntry.entryData).hasNPC() ? ((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getDenizenEntity() : null,
View Full Code Here

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

        }

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

        scriptEntry.defaultObject("catch", new Element("NONE"))
                .defaultObject("stop", Element.FALSE)
                .defaultObject("percent", new Element(65));

        if (!((BukkitScriptEntryData)scriptEntry.entryData).hasNPC() || !((BukkitScriptEntryData)scriptEntry.entryData).getNPC().isSpawned())
            throw new InvalidArgumentsException("This command requires a linked and spawned NPC!");

    }
View Full Code Here

        scriptEntry.defaultObject("entities",
                (((BukkitScriptEntryData)scriptEntry.entryData).hasNPC() ? Arrays.asList(((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getDenizenEntity()) : null),
                (((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? Arrays.asList(((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getDenizenEntity()) : null));

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

TOP

Related Classes of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

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.