use of pl.themolka.arcade.time.Time in project Arcade2 by ShootGame.
the class MatchGameParser method parseNode.
@Override
protected ParserResult<MatchGame.Config> parseNode(Node node, String name, String value) throws ParserException {
boolean autoCycle = this.autoCycleParser.parse(node.property("auto-cycle", "autocycle")).orDefault(MatchGame.Config.DEFAULT_IS_AUTO_CYCLE);
boolean autoStart = this.autoStartParser.parse(node.property("auto-start", "autostart")).orDefault(MatchGame.Config.DEFAULT_IS_AUTO_START);
Time startCountdown = this.startCountdownParser.parse(node.property("start-countdown", "startcountdown")).orDefault(MatchGame.Config.DEFAULT_START_COUNTDOWN);
Observers.Config observers = this.observersParser.parse(node.firstChild("observers")).orFail();
return ParserResult.fine(node, name, value, new MatchGame.Config() {
public boolean autoCycle() {
return autoCycle;
}
public boolean autoStart() {
return autoStart;
}
public Time startCountdown() {
return startCountdown;
}
public Ref<Observers.Config> observers() {
return Ref.ofProvided(observers);
}
});
}
use of pl.themolka.arcade.time.Time in project Arcade2 by ShootGame.
the class PlayerTitleParser method parseTree.
@Override
protected ParserResult<PlayerTitle> parseTree(Node node, String name) throws ParserException {
BaseComponent primary = this.primaryParser.parse(node.firstChild("title", "primary")).orDefaultNull();
BaseComponent secondary = this.seconaryParser.parse(node.firstChild("subtitle", "sub-title", "secondary")).orDefaultNull();
if (primary == null && secondary == null) {
return ParserResult.empty(node, "Missing <title> or <subtitle>");
}
PlayerTitle title = new PlayerTitle(primary != null ? primary : empty, secondary != null ? secondary : empty);
Time fadeIn = this.fadeInParser.parse(node.property("fade-in", "fadein")).orDefaultNull();
if (fadeIn != null) {
title.setFadeIn(fadeIn);
}
Time viewTime = this.viewTimeParser.parse(node.property("view-time", "viewtime", "time", "timeout")).orDefaultNull();
if (viewTime != null) {
title.setViewTime(viewTime);
}
Time fadeOut = this.fadeOutParser.parse(node.property("fade-out", "fadeout")).orDefaultNull();
if (fadeOut != null) {
title.setFadeOut(fadeOut);
}
return ParserResult.fine(node, name, title);
}
use of pl.themolka.arcade.time.Time in project Arcade2 by ShootGame.
the class PotionEffectParser method parsePrimitive.
@Override
protected ParserResult<PotionEffect> parsePrimitive(Node node, String name, String value) throws ParserException {
boolean ambient = this.ambientParser.parse(node.property("ambient")).orDefault(true);
int amplifier = this.amplifierParser.parse(node.property("amplifier")).orDefault(0);
Color color = this.colorParser.parse(node.property("color")).orDefaultNull();
Time duration = this.durationParser.parse(node.property("duration", "time")).orFail();
boolean particles = this.particlesParser.parse(node.property("particles")).orDefault(true);
PotionEffectType type = this.typeParser.parseWithDefinition(node, name, value).orFail();
if (amplifier < 0) {
throw this.fail(node, name, value, "Amplifier must be positive or zero (greater than, or equal to 0)");
}
return ParserResult.fine(node, name, value, new PotionEffect(type, TimeUtils.toTicksInt(duration), amplifier, ambient, particles, color));
}
use of pl.themolka.arcade.time.Time in project Arcade2 by ShootGame.
the class PlayerTitleBuilder method build.
@Override
public PlayerTitle build() {
PlayerTitle title = new PlayerTitle(this.primary(), this.secondary());
Time fadeIn = this.fadeIn();
if (fadeIn != null) {
title.setFadeIn(fadeIn);
}
Time viewTime = this.viewTime();
if (viewTime != null) {
title.setViewTime(viewTime);
}
Time fadeOut = this.fadeOut();
if (fadeOut != null) {
title.setFadeOut(fadeOut);
}
return title;
}
use of pl.themolka.arcade.time.Time 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