Package net.aufdemrand.denizencore.exceptions

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException


            else
                arg.reportUnhandled();
        }

        if (!scriptEntry.hasObject("object"))
            throw new InvalidArgumentsException("You must specify an object!");

        if (!scriptEntry.hasObject("mechanism"))
            throw new InvalidArgumentsException("You must specify a mechanism!");
    }
View Full Code Here


    @Override
    public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {

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

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

            if (!scriptEntry.hasObject("duration")
View Full Code Here

        }

        if (!scriptEntry.hasObject("braces")) {
            if (!scriptEntry.hasObject("possibilities"))
                throw new InvalidArgumentsException("Missing possibilities!");

            if (scriptEntry.getElement("possibilities").asInt() <= 1)
                throw new InvalidArgumentsException("Must randomly select more than one item.");

            if (scriptEntry.getResidingQueue().getQueueSize() < scriptEntry.getElement("possibilities").asInt())
                throw new InvalidArgumentsException("Invalid Size! Random # must not be larger than the script!");
        }

    }
View Full Code Here

        }

        // Check to make sure required arguments have been filled

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

        // If the world has not been specified, try to use the NPC's or player's
        // world, or default to "world" if necessary
        if (!scriptEntry.hasObject("world")) {
            scriptEntry.addObject("world",
                    ((BukkitScriptEntryData) scriptEntry.entryData).hasNPC() ?
                    new dWorld(((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getWorld()) :
                    (((BukkitScriptEntryData) scriptEntry.entryData).hasPlayer() ?
                    new dWorld(((BukkitScriptEntryData) scriptEntry.entryData).getPlayer().getWorld()) : null));
        }

        scriptEntry.defaultObject("type", new Element("GLOBAL"));

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

        }
        if (!scriptEntry.hasObject("target")) {
            if (((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer())
                scriptEntry.addObject("target", ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getDenizenEntity());
            else
                throw new InvalidArgumentsException("This command requires a linked player!");
        }
        if (!((BukkitScriptEntryData)scriptEntry.entryData).hasNPC())
            throw new InvalidArgumentsException("This command requires a linked NPC!");
    }
View Full Code Here

            else arg.reportUnhandled();
        }

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

        scriptEntry.defaultObject("duration", new Duration(0));
        scriptEntry.defaultObject("switchstate", new Element("TOGGLE"));
    }
View Full Code Here

        if (!scriptEntry.getObject("type").equals(Type.GLOBAL_COOLDOWN))
            scriptEntry.defaultObject("players", ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer());

        // Must specify a script unless resetting SAVES
        if (!scriptEntry.hasObject("script") && !scriptEntry.getObject("type").equals(Type.SAVES))
            throw new InvalidArgumentsException("Must specify a script!");
    }
View Full Code Here

    @Override
    public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {

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

    }
View Full Code Here

        }

        // Make sure all required arguments are met

        if (!scriptEntry.hasObject("action"))
            throw new InvalidArgumentsException("Must specify something to drop!");

        if (!scriptEntry.hasObject("location"))
            if (((BukkitScriptEntryData)scriptEntry.entryData).getPlayer() != null && ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().isOnline()) {
                scriptEntry.addObject("location", ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getLocation().setPrefix("location"));
                dB.echoDebug(scriptEntry, "Did not specify a location, assuming Player's location.");

            } else throw new InvalidArgumentsException("Must specify a location!");

        if (!scriptEntry.hasObject("qty"))
            scriptEntry.addObject("qty", Element.valueOf("1").setPrefix("qty"));

        // Okay!
View Full Code Here

        if (!scriptEntry.hasObject("npcs")) {
            if (((BukkitScriptEntryData)scriptEntry.entryData).hasNPC())
                scriptEntry.addObject("npcs", Arrays.asList(((BukkitScriptEntryData)scriptEntry.entryData).getNPC()));
            else
                throw new InvalidArgumentsException("Must specify a valid list of NPCs!");
        }

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