Skip to content

Commit b526aba

Browse files
authored
Fix FlatLaf compatability (#178)
1 parent 0e2a828 commit b526aba

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/main/java/com/botdetector/BotDetectorPlugin.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import javax.swing.SwingUtilities;
7474
import javax.swing.event.HyperlinkEvent;
7575
import lombok.Getter;
76+
import lombok.Setter;
7677
import lombok.extern.slf4j.Slf4j;
7778
import net.runelite.api.ChatMessageType;
7879
import net.runelite.api.Client;
@@ -229,6 +230,10 @@ public class BotDetectorPlugin extends Plugin
229230
private BotDetectorPanel panel;
230231
private NavigationButton navButton;
231232

233+
@Getter
234+
@Setter
235+
private boolean navButtonIsSelected;
236+
232237
@Provides
233238
BotDetectorConfig provideConfig(ConfigManager configManager)
234239
{
@@ -344,6 +349,7 @@ protected void startUp()
344349

345350
final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "bot-icon.png");
346351

352+
this.navButtonIsSelected = false;
347353
navButton = NavigationButton.builder()
348354
.panel(panel)
349355
.tooltip("Bot Detector")
@@ -517,7 +523,7 @@ public synchronized void refreshPlayerStats(boolean forceRefresh)
517523
{
518524
Instant now = Instant.now();
519525
// 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
521527
|| now.isBefore(lastStatsRefresh.plusSeconds(AUTO_REFRESH_STATS_COOLDOWN_SECONDS))
522528
|| now.isBefore(lastFlush.plusSeconds(AUTO_REFRESH_LAST_FLUSH_GRACE_PERIOD_SECONDS)))
523529
{
@@ -1083,11 +1089,7 @@ public void predictPlayer(String playerName)
10831089
{
10841090
SwingUtilities.invokeLater(() ->
10851091
{
1086-
if (!navButton.isSelected())
1087-
{
1088-
navButton.getOnSelect().run();
1089-
}
1090-
1092+
clientToolbar.openPanel(navButton);
10911093
panel.predictPlayer(playerName);
10921094
});
10931095
}

src/main/java/com/botdetector/ui/BotDetectorPanel.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@ public void shutdown()
291291
public void onActivate()
292292
{
293293
eventBus.post(new BotDetectorPanelActivated());
294+
plugin.setNavButtonIsSelected(true);
295+
}
296+
297+
@Override
298+
public void onDeactivate()
299+
{
300+
plugin.setNavButtonIsSelected(false);
294301
}
295302

296303
/**

0 commit comments

Comments
 (0)