added Build Battle #15

Merged
jannis merged 6 commits from develop-jannis into develop 2026-10-16 18:50:20 +00:00
Showing only changes of commit 75cd304bda - Show all commits
@@ -97,11 +97,11 @@ public class BuildBattle extends StatelessGame {
); );
this.spawnPositions.put(player, plotCenter); this.spawnPositions.put(player, plotCenter);
if(this.spawnPosx >= rowCount) { if(this.spawnPosx >= rowCount - 1) {
this.spawnPosx = 0; this.spawnPosx = 0;
this.spawnPosz++; this.spawnPosz++;
} } else this.spawnPosx ++;
this.spawnPosx++;
player.setGameMode(GameMode.ADVENTURE); player.setGameMode(GameMode.ADVENTURE);
this.scheduler().scheduleNextTick(() -> player.teleport(plotCenter.add(0, 1.5, 0))); this.scheduler().scheduleNextTick(() -> player.teleport(plotCenter.add(0, 1.5, 0)));
return super.onPlayerJoin(player); return super.onPlayerJoin(player);
@@ -164,12 +164,14 @@ public class BuildBattle extends StatelessGame {
} }
private void finishRound() { private void finishRound() {
int sum = this.currentVotes.values().stream().mapToInt(Integer::intValue).sum(); int voteSum = this.currentVotes.values().stream()
this.getPlayers().forEach(p -> p.getInventory().clear()); .mapToInt(Integer::intValue)
.sum();
int score = (int) Math.round((double) voteSum / this.getPlayers().size());
Player owner = this.currentOwner; this.getPlayers().forEach(p -> p.getInventory().clear());
this.getScore().insertResult(this.currentOwner, score);
this.currentOwner = null; this.currentOwner = null;
this.getScore().insertResult(owner, sum);
} }
private boolean isInArea(Point block, Player player) { private boolean isInArea(Point block, Player player) {