Dont add duplicates to history (console and chat) (#10710)

* Dont add duplicates to history

* redundant parenthesis removal
This commit is contained in:
1ue999 2025-04-22 17:06:22 +02:00 committed by GitHub
parent 4e2215151f
commit d6c2ec85f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -201,7 +201,7 @@ public class ChatFragment extends Table{
//avoid sending prefix-empty messages
if(message.isEmpty() || (message.startsWith(mode.prefix) && message.substring(mode.prefix.length()).isEmpty())) return;
history.insert(1, message);
if(history.size < 2 || !history.get(1).equals(message)) history.insert(1, message);
message = UI.formatIcons(message);

View file

@ -170,7 +170,7 @@ public class ConsoleFragment extends Table{
return;
}
history.insert(1, message);
if(history.size < 2 || !history.get(1).equals(message)) history.insert(1, message);
addMessage("[lightgray]> " + message.replace("[", "[["));
addMessage(mods.getScripts().runConsole(injectConsoleVariables() + message).replace("[", "[["));