scriptEntry.addObject("location", arg.asType(dLocation.class));
}
else if (!scriptEntry.hasObject("type")
&& arg.matches("random")) {
scriptEntry.addObject("type", new Element(FireworkEffect.Type.values()[CoreUtilities.getRandom().nextInt(FireworkEffect.Type.values().length)].name()));
}
else if (!scriptEntry.hasObject("type")
&& arg.matchesEnum(FireworkEffect.Type.values())) {
scriptEntry.addObject("type", arg.asElement());
}
else if (!scriptEntry.hasObject("power")
&& arg.matchesPrimitive(aH.PrimitiveType.Integer)) {
scriptEntry.addObject("power", arg.asElement());
}
else if (!scriptEntry.hasObject("flicker")
&& arg.matches("flicker")) {
scriptEntry.addObject("flicker", "");
}
else if (!scriptEntry.hasObject("trail")
&& arg.matches("trail")) {
scriptEntry.addObject("trail", "");
}
else if (!scriptEntry.hasObject("primary")
&& arg.matchesPrefix("primary")
&& arg.matchesArgumentList(dColor.class)) {
scriptEntry.addObject("primary", arg.asType(dList.class).filter(dColor.class));
}
else if (!scriptEntry.hasObject("fade")
&& arg.matchesPrefix("fade")
&& arg.matchesArgumentList(dColor.class)) {
scriptEntry.addObject("fade", arg.asType(dList.class).filter(dColor.class));
}
else
arg.reportUnhandled();
}
// Use the NPC or player's locations as the location if one is not specified
scriptEntry.defaultObject("location",
((BukkitScriptEntryData)scriptEntry.entryData).hasNPC() ? ((BukkitScriptEntryData)scriptEntry.entryData).getNPC().getLocation() : null,
((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getLocation() : null);
scriptEntry.defaultObject("type", new Element("ball"));
scriptEntry.defaultObject("power", new Element(1));
scriptEntry.defaultObject("primary", Arrays.asList(dColor.valueOf("yellow")));
}