Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure last step is reset on quest shutdown #1862

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 15 additions & 27 deletions src/main/java/com/questhelper/managers/QuestManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.questhelper.steps.QuestStep;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.QuestState;
Expand All @@ -59,6 +60,7 @@
* Responsible for initializing, updating, and shutting down quests.
*/
@Singleton
@Slf4j
public class QuestManager
{
@Inject
Expand Down Expand Up @@ -320,32 +322,6 @@ private void initializeNewQuest(QuestHelper questHelper, boolean shouldOpenSideb
}
}

/**
* Shuts down the quest from the sidebar.
* Unregisters the quest and removes it from the panel.
*/
public void shutDownQuestFromSidebar()
{
if (selectedQuest != null)
{
selectedQuest.shutDown();
questBankManager.shutDownQuest();
SwingUtilities.invokeLater(panel::removeQuest);
unregisterQuestFromEventBus(selectedQuest);

// If closing the item checking helper and should still check in background, start it back up in background
if (selectedQuest.getQuest() == QuestHelperQuest.CHECK_ITEMS && config.highlightItemsBackground())
{
selectedQuest = null;
startUpBackgroundQuest(QuestHelperQuest.CHECK_ITEMS.getName());
}
else
{
selectedQuest = null;
}
}
}

private void shutDownPreviousQuest()
{
shutDownQuest(true);
Expand All @@ -370,8 +346,20 @@ public void shutDownQuest(boolean shouldUpdateList)
questBankManager.shutDownQuest();
SwingUtilities.invokeLater(panel::removeQuest);
unregisterQuestFromEventBus(selectedQuest);
selectedQuest = null;

// If closing the item checking helper and should still check in background, start it back up in background
if (selectedQuest.getQuest() == QuestHelperQuest.CHECK_ITEMS && config.highlightItemsBackground())
{
selectedQuest = null;
startUpBackgroundQuest(QuestHelperQuest.CHECK_ITEMS.getName());
}
else
{
selectedQuest = null;
}
}

this.lastStep = null;
}

public void activateShortestPath()
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/questhelper/panel/QuestOverviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,10 @@ public void removeQuest()
revalidate();
}

/// The quest helper's X is clicked
private void closeHelper()
{
questManager.shutDownQuestFromSidebar();
questManager.shutDownQuest(false);
}

void updateCollapseText()
Expand Down
Loading