From 4362057b2ff001cd3e5d539dd2ac571d87210bc4 Mon Sep 17 00:00:00 2001 From: William Date: Thu, 4 Apr 2024 18:14:31 +0100 Subject: [PATCH] fix: Squares per deeds column not resetting, close #440 --- .../husktowns/command/TownCommand.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/net/william278/husktowns/command/TownCommand.java b/common/src/main/java/net/william278/husktowns/command/TownCommand.java index 1dbee56c..6e4666e6 100644 --- a/common/src/main/java/net/william278/husktowns/command/TownCommand.java +++ b/common/src/main/java/net/william278/husktowns/command/TownCommand.java @@ -195,10 +195,20 @@ public void execute(@NotNull CommandUser executor, @NotNull String[] args) { .toList())) .flatMap((worldMap) -> worldMap.getValue().stream() .peek(claim -> total.getAndIncrement()) - .map(claim -> MapSquare.claim(claim.claim().getChunk(), worldMap.getKey(), claim, plugin)) + .map(claim -> MapSquare.claim( + claim.claim().getChunk(), + worldMap.getKey(), + claim, + plugin + )) .map(MapSquare::toComponent) - .map(square -> column.getAndIncrement() > SQUARES_PER_DEEDS_COLUMN - ? square.appendNewline() : square)) + .map(square -> { + if (column.getAndIncrement() > SQUARES_PER_DEEDS_COLUMN) { + column.set(0); + return square.appendNewline(); + } + return square; + })) .reduce(Component.empty(), Component::append); plugin.getLocales().getLocale("town_deeds_title", town.getName(),