Examples of InvalidArgumentsException


Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

        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

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

            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

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

                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

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

        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

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

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

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

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

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

            else arg.reportUnhandled();
        }

        // Check to make sure required arguments have been filled
        if (!scriptEntry.hasObject("entities"))
            throw new InvalidArgumentsException("No valid entities specified.");

        // Use default age if one is not specified
        scriptEntry.defaultObject("age", new Element(1));

    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

        }

        // Even if the target is a player, this command requires an NPC to get the pose from.
        if (!((BukkitScriptEntryData)scriptEntry.entryData).hasNPC())
            throw new InvalidArgumentsException("This command requires an NPC!");

        // It also requires a pose ID
        if (!scriptEntry.hasObject("pose_id"))
                throw new InvalidArgumentsException("No ID specified!");

        // Set default objects
        scriptEntry.defaultObject("target", TargetType.NPC);
        scriptEntry.defaultObject("action", Action.ASSUME);

        // If the target is a player, it needs a player! However, you can't ADD/REMOVE poses
        // from players, so only allow ASSUME.
        if (scriptEntry.getObject("target") == TargetType.PLAYER) {
            if (scriptEntry.getObject("action") != Action.ASSUME)
                throw new InvalidArgumentsException("You cannot add or remove poses from a player.");
            else if (!((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer())
                throw new InvalidArgumentsException("This command requires a linked player!");
        }

    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

        scriptEntry.defaultObject("speed", new Element(1.2));
        scriptEntry.defaultObject("rotationThreshold", new Element(15));

        // Check to make sure required arguments have been filled
        if (!scriptEntry.hasObject("entities"))
            throw new InvalidArgumentsException("Must specify entity/entities!");
        if (!scriptEntry.hasObject("origin"))
            throw new InvalidArgumentsException("Must specify an origin!");
    }
View Full Code Here

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException

                ((BukkitScriptEntryData)scriptEntry.entryData).hasNPC() ? ((BukkitScriptEntryData)scriptEntry.entryData).getNPC().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


        // Check for required information

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

        if (!scriptEntry.hasObject("npcs")) {
            if (((BukkitScriptEntryData)scriptEntry.entryData).getNPC() == null
                    || !((BukkitScriptEntryData)scriptEntry.entryData).getNPC().isValid()
                    || !((BukkitScriptEntryData)scriptEntry.entryData).getNPC().isSpawned())
                throw new InvalidArgumentsException("Must have a valid spawned NPC attached.");
            else
                scriptEntry.addObject("npcs", Arrays.asList(((BukkitScriptEntryData)scriptEntry.entryData).getNPC()));
        }

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.