From a908e32d0bc90dafbb5983209c4effa992614ee2 Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Tue, 4 Jun 2024 21:18:57 +0200 Subject: [PATCH] Fix message validation and chat log order Corrected conditional logic in VoteToMuteHelper to validate messages properly and adjusted sorting of chat logs in VoteToMuteStarter to display in reverse chronological order. The update now accurately verifies the existence of selected messages and presents recent logs first for more user-friendly navigation. --- .../java/com/alttd/velocitychat/commands/VoteToMuteHelper.java | 2 +- .../velocitychat/commands/vote_to_mute/VoteToMuteStarter.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/velocity/src/main/java/com/alttd/velocitychat/commands/VoteToMuteHelper.java b/velocity/src/main/java/com/alttd/velocitychat/commands/VoteToMuteHelper.java index f646c81..4d87162 100644 --- a/velocity/src/main/java/com/alttd/velocitychat/commands/VoteToMuteHelper.java +++ b/velocity/src/main/java/com/alttd/velocitychat/commands/VoteToMuteHelper.java @@ -150,7 +150,7 @@ public class VoteToMuteHelper { } int highestLogEntry = max.get(); - if (voteToMuteStarter.getTotalLogEntries() > highestLogEntry) { + if (voteToMuteStarter.getTotalLogEntries() < highestLogEntry) { commandContext.getSource().sendMessage(Utility.parseMiniMessage("Some of your selected messages do not exist.")); return 1; } diff --git a/velocity/src/main/java/com/alttd/velocitychat/commands/vote_to_mute/VoteToMuteStarter.java b/velocity/src/main/java/com/alttd/velocitychat/commands/vote_to_mute/VoteToMuteStarter.java index dfafe3c..57b213b 100644 --- a/velocity/src/main/java/com/alttd/velocitychat/commands/vote_to_mute/VoteToMuteStarter.java +++ b/velocity/src/main/java/com/alttd/velocitychat/commands/vote_to_mute/VoteToMuteStarter.java @@ -60,7 +60,7 @@ public class VoteToMuteStarter { private void parseChatLogs(List chatLogs) { TagResolver.Single playerTag = Placeholder.parsed("player", votedPlayer.getUsername()); TagResolver.Single prefixTag = Placeholder.component("prefix", prefix); - chatLogs.sort(Comparator.comparing(ChatLog::getTimestamp)); + chatLogs.sort(Comparator.comparing(ChatLog::getTimestamp).reversed()); parsedChatLogs = IntStream.range(0, chatLogs.size()) .mapToObj(i -> Utility.parseMiniMessage( ". : ",