From 104a30610b9b645ca77961bd934f887633bf42d4 Mon Sep 17 00:00:00 2001 From: newracket Date: Tue, 5 Jul 2022 22:10:29 -0700 Subject: [PATCH] Added opt out to defense tracker --- src/main/java/tk/avicia/avomod/Avomod.java | 1 + .../avomod/features/AttackedTerritoryDifficulty.java | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/tk/avicia/avomod/Avomod.java b/src/main/java/tk/avicia/avomod/Avomod.java index 116b3ea..00adf1f 100644 --- a/src/main/java/tk/avicia/avomod/Avomod.java +++ b/src/main/java/tk/avicia/avomod/Avomod.java @@ -86,6 +86,7 @@ public class Avomod { new ConfigToggle("War", "Prevent joining wars when afk", "Enabled", "afkWarProtection"), new ConfigInput("War", "Minutes until considered afk", "10", "[0-9]+", "^[0-9]+$", 3, "afkTime"), new ConfigInput("War", "Territory attack confirmation threshold", "15000", "[0-9]+", "^[0-9]+$", 6, "attackConfirmation"), + new ConfigToggle("War", "Send defenses from attacked territories to server (improves accuracy of timer list for guild members)", "Enabled", "storeDefs"), new ConfigToggle("Misc", "Auto /stream on World Swap", "Disabled", "autoStream"), new ConfigToggle("Misc", "Prevent Moving Armor/Accessories", "Disabled", "disableMovingArmor"), new ConfigToggle("Misc", "Make Mob Health Bars More Readable", "Enabled", "readableHealth"), diff --git a/src/main/java/tk/avicia/avomod/features/AttackedTerritoryDifficulty.java b/src/main/java/tk/avicia/avomod/features/AttackedTerritoryDifficulty.java index a340e6a..7b2d05b 100644 --- a/src/main/java/tk/avicia/avomod/features/AttackedTerritoryDifficulty.java +++ b/src/main/java/tk/avicia/avomod/features/AttackedTerritoryDifficulty.java @@ -59,18 +59,18 @@ public static void inMenu() { } public static void receivedChatMessage(String message, String territory) { - if (System.currentTimeMillis() - currentTime < 5000 && territory.equals(currentTerritory)) { - if (Avomod.getConfigBoolean("terrDefenseInChat")) { - Avomod.getMC().player.sendChatMessage("/g " + currentTerritory + " defense is " + currentDefense); - } + if (System.currentTimeMillis() - currentTime > 5000 || !territory.equals(currentTerritory)) return; + + if (Avomod.getConfigBoolean("terrDefenseInChat")) { + Avomod.getMC().player.sendChatMessage("/g " + currentTerritory + " defense is " + currentDefense); + } + if (Avomod.getConfigBoolean("storeDefs")) { try { recordDefense(message, territory, currentDefense); } catch (Exception e) { e.printStackTrace(); } - } else { - recordDefense(message, territory, "Unknown"); } }