From c20c0c8eb3fa5d1a7d79b9f48e02105498f8fd17 Mon Sep 17 00:00:00 2001 From: Cow Date: Tue, 25 Jul 2023 20:12:10 +0200 Subject: Fixed bestfriends migration message being sent when not necessary --- .../cowtipper/cowlection/listener/PlayerListener.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java b/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java index 713902a..0420b94 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/PlayerListener.java @@ -143,14 +143,19 @@ public class PlayerListener { isPlayerJoiningServer = false; if (this.nextMigrationNotification < System.currentTimeMillis()) { - this.nextMigrationNotification = System.currentTimeMillis() + 10000; + this.nextMigrationNotification = System.currentTimeMillis() + 600_000; // every 10 minutes new TickDelay(() -> { - if (MooConfig.doBestFriendsOnlineCheck || main.getFriendsHandler().getBestFriendsListSize() > 0) { - main.getChatHelper().sendMessage(new MooChatComponent("[" + EnumChatFormatting.DARK_RED + Cowlection.MODNAME + EnumChatFormatting.RED + "] The 'best friends list' feature has been removed from this mod.").red() - .appendSibling(new MooChatComponent(" Run " + EnumChatFormatting.GOLD + "/moo bestfriends " + EnumChatFormatting.YELLOW + "to migrate your best friends list").yellow()) - .setSuggestCommand("/moo bestfriends", false) - .setHover(new MooChatComponent.KeyValueChatComponent("Run", "/moo bestfriends", " ") - .appendFreshSibling(new MooChatComponent("(This message will re-appear as long as there are still names on your Cowlection best friends list)").red()))); + if (MooConfig.doBestFriendsOnlineCheck) { + if (main.getFriendsHandler().getBestFriendsListSize() == 0) { + MooConfig.doBestFriendsOnlineCheck = false; + main.getConfig().syncFromFields(); + } else { + main.getChatHelper().sendMessage(new MooChatComponent("[" + EnumChatFormatting.DARK_RED + Cowlection.MODNAME + EnumChatFormatting.RED + "] The 'best friends list' feature has been removed from this mod.").red() + .appendSibling(new MooChatComponent(" Run " + EnumChatFormatting.GOLD + "/moo bestfriends " + EnumChatFormatting.YELLOW + "to migrate your best friends list").yellow()) + .setSuggestCommand("/moo bestfriends", false) + .setHover(new MooChatComponent.KeyValueChatComponent("Run", "/moo bestfriends", " ") + .appendFreshSibling(new MooChatComponent("(This message will re-appear as long as there are still names on your Cowlection best friends list)").red()))); + } } if (MooConfig.doMonitorNotifications()) { main.getChatHelper().sendMessage(new MooChatComponent("[" + EnumChatFormatting.DARK_RED + Cowlection.MODNAME + EnumChatFormatting.RED + "] The 'login & logout notifications filter' feature has been removed from this mod.").red() -- cgit