use of pl.themolka.arcade.config.Ref in project Arcade2 by ShootGame.
the class ScoreGameParser method parseNode.
@Override
protected ParserResult<ScoreGame.Config> parseNode(Node node, String name, String value) throws ParserException {
Set<Score.Config> scores = new LinkedHashSet<>();
for (Node scoreNode : node.children("score")) {
scores.add(this.scoreParser.parse(scoreNode).orFail());
}
if (ParserUtils.ensureNotEmpty(scores)) {
throw this.fail(node, name, value, "No scores defined");
}
Set<ScoreBox.Config> scoreBoxes = new LinkedHashSet<>();
for (Node scoreBoxNode : node.children("score-box", "scorebox")) {
scoreBoxes.add(this.scoreBoxParser.parse(scoreBoxNode).orFail());
}
return ParserResult.fine(node, name, value, new ScoreGame.Config() {
public Ref<Set<Score.Config>> scores() {
return Ref.ofProvided(scores);
}
public Ref<Set<ScoreBox.Config>> scoreBoxes() {
return Ref.ofProvided(scoreBoxes);
}
});
}
use of pl.themolka.arcade.config.Ref in project Arcade2 by ShootGame.
the class AutoRespawnGameParser method parseNode.
@Override
protected ParserResult<AutoRespawnGame.Config> parseNode(Node node, String name, String value) throws ParserException {
Ref<Filter.Config<?>> filter = this.filterParser.parse(node.property("filter")).orDefault(Ref.empty());
Time cooldown = this.cooldownParser.parse(node.property("cooldown", "after")).orDefault(PlayerDeathEvent.DEFAULT_AUTO_RESPAWN_COOLDOWN);
return ParserResult.fine(node, name, value, new AutoRespawnGame.Config() {
public Ref<Filter.Config<?>> filter() {
return filter;
}
public Time cooldown() {
return cooldown;
}
});
}
Aggregations