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()));
}
}