File tree Expand file tree Collapse file tree 4 files changed +19
-2
lines changed
src/main/java/lol/hyper/customlauncher Expand file tree Collapse file tree 4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1717
1818package lol .hyper .customlauncher .fieldofficetracker ;
1919
20+ import dorkbox .notify .Notify ;
21+ import dorkbox .notify .Pos ;
22+ import lol .hyper .customlauncher .Main ;
2023import lol .hyper .customlauncher .accounts .JSONManager ;
2124import org .apache .logging .log4j .LogManager ;
2225import org .apache .logging .log4j .Logger ;
@@ -92,7 +95,7 @@ public void actionPerformed(ActionEvent e) {
9295 it .remove ();
9396 }
9497 }
95-
98+ fieldOfficeTracker . runs ++;
9699 fieldOfficeTracker .lastFetched = System .currentTimeMillis ();
97100 }
98101}
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ public class FieldOfficeTracker {
4343 public JLabel lastFetchedLabel ;
4444 public final SimpleDateFormat lastFetchedFormat = new SimpleDateFormat ("hh:mm:ss a" );
4545 public long lastFetched = 0 ;
46+ public int runs = 0 ;
4647 public static final HashMap <Integer , String > zonesToStreets = new HashMap <>();
4748 public boolean isDown = false ;
4849 public Timer fieldOfficeTaskTimer ;
@@ -163,6 +164,10 @@ private void startFieldOfficeRefresh() {
163164 }
164165
165166 public void showNotification (FieldOffice fieldOffice , boolean newFieldOffice ) {
167+ // do not spam the user with all notifications at once
168+ if (runs == 0 ) {
169+ return ;
170+ }
166171 // do we show notifications?
167172 if (!configHandler .showFieldOfficeNotifications ()) {
168173 return ;
Original file line number Diff line number Diff line change @@ -99,13 +99,16 @@ public void actionPerformed(ActionEvent e) {
9999 Iterator <Map .Entry <String , Invasion >> it = invasionTracker .invasions .entrySet ().iterator ();
100100 while (it .hasNext ()) {
101101 Map .Entry <String , Invasion > pair = it .next ();
102- String key = pair .getKey () + "/" + pair .getValue ().getCogType (); // this is the district
102+ // this is the district
103+ // <district>/<cog name>
104+ String key = pair .getKey () + "/" + pair .getValue ().getCogType ();
103105 if (!invasionsJSON .has (key )) {
104106 invasionTracker .showNotification (pair .getValue (), false );
105107 it .remove ();
106108 logger .info ("Remove invasion: " + key );
107109 }
108110 }
111+ invasionTracker .runs ++;
109112 invasionTracker .lastFetched = System .currentTimeMillis ();
110113 }
111114}
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ public class InvasionTracker {
4444 public JLabel lastFetchedLabel ;
4545 public final SimpleDateFormat lastFetchedFormat = new SimpleDateFormat ("hh:mm:ss a" );
4646 public long lastFetched = 0 ;
47+ public int runs = 0 ;
4748 public boolean isDown = false ;
4849 public Timer invasionTaskTimer ;
4950 final ConfigHandler configHandler ;
@@ -170,6 +171,11 @@ private String convertTime(long totalSecs) {
170171 }
171172
172173 public void showNotification (Invasion invasion , boolean newInvasion ) {
174+ // do not spam the user with all notifications at once
175+ if (runs == 0 ) {
176+ return ;
177+ }
178+
173179 // do we show notifications?
174180 if (!configHandler .showCogInvasionNotifications ()) {
175181 return ;
You can’t perform that action at this time.
0 commit comments