added second option to game selection menu, finished stickfight
This commit is contained in:
@@ -28,7 +28,8 @@ public class StickFightFactory implements GameFactory {
|
|||||||
@Override
|
@Override
|
||||||
public ConfigManager configuration() {
|
public ConfigManager configuration() {
|
||||||
return new ConfigManager()
|
return new ConfigManager()
|
||||||
.addOption(new NumericOption("length", Material.SANDSTONE, TranslatedComponent.byId("optionCommon#length"), 7, 10, 13, 16, 19));
|
.addOption(new NumericOption("length", Material.SANDSTONE, TranslatedComponent.byId("optionCommon#length"), 7, 10, 13, 16, 19))
|
||||||
|
.addOption(new NumericOption("seconds", Material.CLOCK, TranslatedComponent.byId("optionCommon#seconds"), 0, 30, 60, 90, 120));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -40,7 +41,7 @@ public class StickFightFactory implements GameFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Game manufacture(Room parent, Map<String, Option<?>> configuration) {
|
public Game manufacture(Room parent, Map<String, Option<?>> configuration) {
|
||||||
return new Stickfight(configuration.get("length").getAsInt()).setParent(parent);
|
return new Stickfight(configuration.get("length").getAsInt(), configuration.get("seconds").getAsInt()).setParent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,10 +24,12 @@ public class Stickfight extends StatelessGame {
|
|||||||
private final WeakHashMap<Player, Pos> spawnPoints = new WeakHashMap<>();
|
private final WeakHashMap<Player, Pos> spawnPoints = new WeakHashMap<>();
|
||||||
private final Map<Player, Integer> scoreMap = new WeakHashMap<>();
|
private final Map<Player, Integer> scoreMap = new WeakHashMap<>();
|
||||||
private boolean countdownStarted = false;
|
private boolean countdownStarted = false;
|
||||||
|
private final int seconds;
|
||||||
|
|
||||||
public Stickfight(int length) {
|
public Stickfight(int length, int seconds) {
|
||||||
super(Dimension.OVERWORLD.key, "Stickfight", new LowestPointsWinScore());
|
super(Dimension.OVERWORLD.key, "Stickfight", new LowestPointsWinScore());
|
||||||
this.radius = length;
|
this.radius = length;
|
||||||
|
this.seconds = seconds;
|
||||||
|
|
||||||
this.eventNode().addChild(
|
this.eventNode().addChild(
|
||||||
CombatFeatures.empty()
|
CombatFeatures.empty()
|
||||||
@@ -88,6 +90,11 @@ public class Stickfight extends StatelessGame {
|
|||||||
super.start();
|
super.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
this.setTimeLimit(this.seconds);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
this.scoreMap.forEach((player, score) -> this.getScore().insertResult(player, score));
|
this.scoreMap.forEach((player, score) -> this.getScore().insertResult(player, score));
|
||||||
|
|||||||
Reference in New Issue
Block a user