use of org.bukkit.FireworkEffect in project Arcade2 by ShootGame.
the class FireworkEffectParser method parseTree.
@Override
protected ParserResult<FireworkEffect> parseTree(Node node, String name) throws ParserException {
FireworkEffect.Builder builder = FireworkEffect.builder().with(this.typeParser.parse(node.property("type", "of")).orDefault(FireworkEffect.Type.BALL)).flicker(this.flickerParser.parse(node.property("flicker")).orDefault(false)).trail(this.trailParser.parse(node.property("trail")).orDefault(false));
boolean colorsDefined = false;
for (Node color : node.children("color")) {
builder.withColor(this.colorParser.parse(color).orFail());
colorsDefined = true;
}
if (!colorsDefined) {
throw this.fail(node, name, null, "No colors defined");
}
for (Node fadeColor : node.children("fade-color", "fadecolor", "fade")) {
builder.withFade(this.fadeColorParser.parse(fadeColor).orFail());
}
return ParserResult.fine(node, name, builder.build());
}
Aggregations