Package net.aufdemrand.denizencore.exceptions

Examples of net.aufdemrand.denizencore.exceptions.InvalidArgumentsException


            else arg.reportUnhandled();
        }

        // Make sure at least one equipment argument was used
        if (equipment.isEmpty())
            throw new InvalidArgumentsException("Must specify equipment!");

        scriptEntry.addObject("equipment", equipment);

        // Use player or NPC as default entity
        scriptEntry.defaultObject("entities", (((BukkitScriptEntryData)scriptEntry.entryData).hasNPC() ? Arrays.asList(((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getDenizenEntity()) : null),
View Full Code Here


        scriptEntry.defaultObject("action", BookAction.GIVE);
        scriptEntry.defaultObject("item", new dItem(Material.WRITTEN_BOOK));

        // Must contain a book script
        if (!scriptEntry.hasObject("script"))
            throw new InvalidArgumentsException("Missing SCRIPT argument!");

    }
View Full Code Here

                 arg.reportUnhandled();
        }

        // Check for required information
         if (!scriptEntry.hasObject("location"))
              throw new InvalidArgumentsException("Missing location argument!");
    }
View Full Code Here

        scriptEntry.defaultObject("duration", new Duration(20));

        // Check to make sure required arguments have been filled

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

        if (!scriptEntry.hasObject("originEntity") && !scriptEntry.hasObject("originLocation"))
            throw new InvalidArgumentsException("Must specify an origin location!");
    }
View Full Code Here

            }

        }

        if (!((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() || !((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().isValid())
            throw new InvalidArgumentsException("Must have player context!");

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

        scriptEntry.defaultObject("type", new Element("REMAINING")).defaultObject("mode", new Element("SET"));

    }
View Full Code Here

        if (type != Type.MONEY && scriptEntry.getObject("inventory") == null)
            scriptEntry.addObject("inventory", ((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getInventory(): null);

        if (!scriptEntry.hasObject("inventory") && type != Type.MONEY)
            throw new InvalidArgumentsException("Must specify an inventory to take from!");

        if (type == Type.ITEM && scriptEntry.getObject("items") == null)
            throw new InvalidArgumentsException("Must specify item/items!");

    }
View Full Code Here

            }

        }

        if (!scriptEntry.hasObject("map-id") && !scriptEntry.hasObject("new"))
            throw new InvalidArgumentsException("Must specify a map ID or create a new map!");

        if (!scriptEntry.hasObject("reset")
                && !scriptEntry.hasObject("image")
                && !scriptEntry.hasObject("text"))
            throw new InvalidArgumentsException("Must specify value to modify!");

        scriptEntry.defaultObject("x-value", new Element(0)).defaultObject("y-value", new Element(0))
                .defaultObject("resize", Element.FALSE);

    }
View Full Code Here

        scriptEntry.defaultObject("duration", new Duration(20));
        scriptEntry.defaultObject("frequency", Duration.valueOf("1t"));

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

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


        if (scriptEntry.getArguments().size() > 4)
            throw new InvalidArgumentsException("Too many arguments! Did you forget a 'quote'?");

        // Iterate through arguments
        for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) {
            if (!scriptEntry.hasObject("format")
                    && arg.matchesPrefix("format", "f")) {
                FormatScriptContainer format = null;
                String formatStr = arg.getValue();
                format = ScriptRegistry.getScriptContainer(formatStr);
                if (format == null) dB.echoError("Could not find format script matching '" + formatStr + '\'');
                scriptEntry.addObject("format", format);
            }

            // Add players to target list
            else if (!scriptEntry.hasObject("targets")
                    && arg.matchesPrefix("target", "targets", "t")) {
                scriptEntry.addObject("targets", arg.asType(dList.class).filter(dPlayer.class));
            }

            // Use raw_value as to not accidentally strip a value before any :'s.
            else if (!scriptEntry.hasObject("text"))
                    scriptEntry.addObject("text", new Element(TagManager.cleanOutputFully(arg.raw_value)));

            else
                arg.reportUnhandled();

        }

        // If there are no targets, check if you can add this player
        // to the targets
        if (!scriptEntry.hasObject("targets"))
            scriptEntry.addObject("targets",
                    (((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? Arrays.asList(((BukkitScriptEntryData)scriptEntry.entryData).getPlayer()) : null));

        if (!scriptEntry.hasObject("text"))
            throw new InvalidArgumentsException("Missing any text!");

    }
View Full Code Here

        if (type != Type.MONEY && scriptEntry.getObject("inventory") == null)
            scriptEntry.addObject("inventory", ((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getInventory(): null);

        if (!scriptEntry.hasObject("inventory") && type != Type.MONEY)
            throw new InvalidArgumentsException("Must specify an inventory to give to!");

        if (type == Type.ITEM && scriptEntry.getObject("items") == null)
            throw new InvalidArgumentsException("Must specify item/items!");

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