|
73 | 73 | import javax.swing.SwingUtilities; |
74 | 74 | import javax.swing.event.HyperlinkEvent; |
75 | 75 | import lombok.Getter; |
| 76 | +import lombok.Setter; |
76 | 77 | import lombok.extern.slf4j.Slf4j; |
77 | 78 | import net.runelite.api.ChatMessageType; |
78 | 79 | import net.runelite.api.Client; |
@@ -229,6 +230,10 @@ public class BotDetectorPlugin extends Plugin |
229 | 230 | private BotDetectorPanel panel; |
230 | 231 | private NavigationButton navButton; |
231 | 232 |
|
| 233 | + @Getter |
| 234 | + @Setter |
| 235 | + private boolean navButtonIsSelected; |
| 236 | + |
232 | 237 | @Provides |
233 | 238 | BotDetectorConfig provideConfig(ConfigManager configManager) |
234 | 239 | { |
@@ -344,6 +349,7 @@ protected void startUp() |
344 | 349 |
|
345 | 350 | final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "bot-icon.png"); |
346 | 351 |
|
| 352 | + this.navButtonIsSelected = false; |
347 | 353 | navButton = NavigationButton.builder() |
348 | 354 | .panel(panel) |
349 | 355 | .tooltip("Bot Detector") |
@@ -517,7 +523,7 @@ public synchronized void refreshPlayerStats(boolean forceRefresh) |
517 | 523 | { |
518 | 524 | Instant now = Instant.now(); |
519 | 525 | // Only perform non-manual refreshes when a player is not anon, logged in and the panel is open |
520 | | - if (config.enableAnonymousUploading() || loggedPlayerName == null || !navButton.isSelected() |
| 526 | + if (config.enableAnonymousUploading() || loggedPlayerName == null || !navButtonIsSelected |
521 | 527 | || now.isBefore(lastStatsRefresh.plusSeconds(AUTO_REFRESH_STATS_COOLDOWN_SECONDS)) |
522 | 528 | || now.isBefore(lastFlush.plusSeconds(AUTO_REFRESH_LAST_FLUSH_GRACE_PERIOD_SECONDS))) |
523 | 529 | { |
@@ -1083,11 +1089,7 @@ public void predictPlayer(String playerName) |
1083 | 1089 | { |
1084 | 1090 | SwingUtilities.invokeLater(() -> |
1085 | 1091 | { |
1086 | | - if (!navButton.isSelected()) |
1087 | | - { |
1088 | | - navButton.getOnSelect().run(); |
1089 | | - } |
1090 | | - |
| 1092 | + clientToolbar.openPanel(navButton); |
1091 | 1093 | panel.predictPlayer(playerName); |
1092 | 1094 | }); |
1093 | 1095 | } |
|
0 commit comments