This commit is contained in:
ChomeNS
2023-05-15 18:39:57 +07:00
parent 6fbbb57374
commit a2dc3e39e7

View File

@@ -121,8 +121,13 @@ public class MailCommand implements Command {
return null;
}
case "read" -> {
// TODO: use less for loops?
int senderMailSize = 0;
for (Mail ignored : bot.mail().mails()) senderMailSize++;
for (Mail mail : bot.mail().mails()) {
if (!mail.sentTo().equals(sender.profile().getName())) continue;
senderMailSize++;
}
if (senderMailSize == 0) return Component.text("You have no new mails").color(NamedTextColor.RED);