sxcybot

Discord bot for OSRS based channels
git clone git://git.wimdupont.com/sxcybot.git
Log | Files | Refs | README | LICENSE

commit a35ce326d4226362de48d7c8aad88e3eafb5042c
parent 1a23c47335b0d37841e3e866a51d444288a13c49
Author: Wim Dupont <wim@wimdupont.com>
Date:   Fri, 15 Apr 2022 16:08:12 +0200

fix bosses after rifts added

Diffstat:
Msrc/main/java/com/sxcy/sxcybot/client/HiScoreClient.java | 9++++-----
Msrc/main/java/com/sxcy/sxcybot/listeners/admin/banlist/UpdateBanlistUserListener.java | 3+--
Asrc/main/resources/db/migration/V1_6__rifts_added_fix_bosses.sql | 1+
Msrc/test/java/com/sxcy/sxcybot/client/HiScoreClientTest.java | 4++--
4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/sxcy/sxcybot/client/HiScoreClient.java b/src/main/java/com/sxcy/sxcybot/client/HiScoreClient.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; @Slf4j @Component @@ -31,8 +30,8 @@ public class HiScoreClient { private static final int STATS_START = 0; private static final int STATS_END = 23; - private static final int BOSS_START = 36; - private static final int BOSS_END = 83; + private static final int BOSS_START = 37; + private static final int BOSS_END = 84; @NonNull private final OsrsHiscoreBossService osrsHiscoreBossService; @@ -70,10 +69,10 @@ public class HiScoreClient { String result = restTemplate.getForObject(String.format(URL, playername), String.class); if (result != null) { int i = fromIndex; - List<String> hiScores = Arrays.stream(result.split("\n")).collect(Collectors.toList()); + List<String> hiScores = Arrays.stream(result.split("\n")).toList(); try { for (String osrsHiScoresStats : hiScores.subList(fromIndex, toIndex + 1)) { - List<String> hiScoreStatValues = Arrays.stream(osrsHiScoresStats.split(",")).collect(Collectors.toList()); + List<String> hiScoreStatValues = Arrays.stream(osrsHiScoresStats.split(",")).toList(); try { hiScoreList.add(hiScoreBuilder.accept(osrsHiScoresStats, hiScoreStatValues, i)); } catch (EntityNotFoundException e) { diff --git a/src/main/java/com/sxcy/sxcybot/listeners/admin/banlist/UpdateBanlistUserListener.java b/src/main/java/com/sxcy/sxcybot/listeners/admin/banlist/UpdateBanlistUserListener.java @@ -15,7 +15,6 @@ import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent; import org.springframework.stereotype.Component; import java.awt.Color; -import java.util.stream.Collectors; @Component @RequiredArgsConstructor @@ -35,7 +34,7 @@ public class UpdateBanlistUserListener implements PrivateListener { EmbedBuilder embedBuilder = new EmbedBuilder(); embedBuilder.setColor(Color.red); embedBuilder.setTitle("Banned users:"); - userService.findAllBanned().stream().map(User::getName).collect(Collectors.toList()).forEach(f -> + userService.findAllBanned().stream().map(User::getName).toList().forEach(f -> embedBuilder.addField(f, "", false)); privateChannel.sendMessage(embedBuilder.build()).queue(); this.proces(privateMessageReceivedEvent, event); diff --git a/src/main/resources/db/migration/V1_6__rifts_added_fix_bosses.sql b/src/main/resources/db/migration/V1_6__rifts_added_fix_bosses.sql @@ -0,0 +1 @@ +UPDATE osrs_hiscore_boss SET order_value = order_value+1 WHERE order_value > 1; diff --git a/src/test/java/com/sxcy/sxcybot/client/HiScoreClientTest.java b/src/test/java/com/sxcy/sxcybot/client/HiScoreClientTest.java @@ -81,11 +81,11 @@ class HiScoreClientTest { String playerName = "Zxxy"; List<OsrsHiscoreBoss> hiscoreBosses = newArrayList(OsrsHiscoreBoss.builder() .name("KBD") - .orderValue(58) + .orderValue(59) .build(), OsrsHiscoreBoss.builder() .name("Wintertodt") - .orderValue(81) + .orderValue(82) .build() );