Package net.aufdemrand.denizencore.exceptions

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


            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

        }

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

        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

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


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

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

        // No potion specified? Problem!
        if (!scriptEntry.hasObject("effect"))
            throw new InvalidArgumentsException("Must specify a valid PotionType!");

        scriptEntry.defaultObject("duration", new Duration(60));
        scriptEntry.defaultObject("amplifier", new Element(1));
        scriptEntry.defaultObject("remove", Element.FALSE);
View Full Code Here

            }
            else
                arg.reportUnhandled();
        }
        if (!((BukkitScriptEntryData)scriptEntry.entryData).hasNPC())
            throw new InvalidArgumentsException("This command requires a linked NPC!");

    }
View Full Code Here

                scriptEntry.addObject("trait", new Element(arg.getValue()));

        }

        if (!scriptEntry.hasObject("trait"))
            throw new InvalidArgumentsException("Missing trait argument!");

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

        scriptEntry.defaultObject("state", new Element("TOGGLE"));

    }
View Full Code Here

                arg.reportUnhandled();

        }

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

        if (!scriptEntry.hasObject("action"))
            scriptEntry.addObject("action", new Element("OPEN"));

        if (!scriptEntry.hasObject("sound"))
            scriptEntry.addObject("sound", Element.TRUE);

        if (!scriptEntry.hasObject("players")) {
            if (((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer())
                scriptEntry.addObject("players", Arrays.asList(((BukkitScriptEntryData)scriptEntry.entryData).getPlayer()));
            else // TODO: Perhaps instead add all players in sight range?
                throw new InvalidArgumentsException("Missing 'players' argument!");
        }
    }
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.