From 8ce774a7e97af49feb4adf47fce8c1b9ab17e4f0 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 24 Nov 2024 21:35:52 +0100 Subject: [PATCH] fix: update item requirement without dispatch (#1864) * fix: update item requirements asap in the "quest handler" We are already in the quest thread when here, there is no need to dispatch it to the client thread to run later * refactor: rename `updateSteps` to `updateStepsTexts` just thought this clarifies a bit that the function only tries to update the texts of the steps in the sidepanel, not any other logic --- src/main/java/com/questhelper/managers/QuestManager.java | 4 ++-- src/main/java/com/questhelper/panel/QuestHelperPanel.java | 4 ++-- src/main/java/com/questhelper/panel/QuestOverviewPanel.java | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/questhelper/managers/QuestManager.java b/src/main/java/com/questhelper/managers/QuestManager.java index b31a4aec3a..bb5cbc7ae3 100644 --- a/src/main/java/com/questhelper/managers/QuestManager.java +++ b/src/main/java/com/questhelper/managers/QuestManager.java @@ -138,7 +138,7 @@ private void handleSelectedQuest() { if (selectedQuest.getCurrentStep() != null) { - panel.updateSteps(); + panel.updateStepsTexts(); QuestStep currentStep = selectedQuest.getCurrentStep().getSidePanelStep(); if (currentStep != null && currentStep != lastStep && panel.questActive) { @@ -147,7 +147,7 @@ private void handleSelectedQuest() } if (panel.questActive) { - clientThread.invokeLater(() -> panel.updateItemRequirements(client)); + panel.updateItemRequirements(client); } panel.updateLocks(); } diff --git a/src/main/java/com/questhelper/panel/QuestHelperPanel.java b/src/main/java/com/questhelper/panel/QuestHelperPanel.java index 3daddb33ab..330ecd8df4 100644 --- a/src/main/java/com/questhelper/panel/QuestHelperPanel.java +++ b/src/main/java/com/questhelper/panel/QuestHelperPanel.java @@ -583,9 +583,9 @@ public void addQuest(QuestHelper quest, boolean isActive) revalidate(); } - public void updateSteps() + public void updateStepsTexts() { - questOverviewPanel.updateSteps(); + questOverviewPanel.updateStepsTexts(); } public void updateHighlight(Client client, QuestStep newStep) diff --git a/src/main/java/com/questhelper/panel/QuestOverviewPanel.java b/src/main/java/com/questhelper/panel/QuestOverviewPanel.java index f88ff74000..a23a771c2c 100644 --- a/src/main/java/com/questhelper/panel/QuestOverviewPanel.java +++ b/src/main/java/com/questhelper/panel/QuestOverviewPanel.java @@ -47,7 +47,6 @@ import com.questhelper.util.Fonts; import lombok.Getter; import net.runelite.api.Client; -import net.runelite.api.Item; import net.runelite.api.Skill; import net.runelite.client.ui.ColorScheme; import static net.runelite.client.ui.PluginPanel.PANEL_WIDTH; @@ -316,7 +315,7 @@ public void mouseClicked(MouseEvent e) } } - public void updateSteps() + public void updateStepsTexts() { questStepPanelList.forEach(panel -> { for (QuestStep step : panel.getSteps())