Skip to content

Commit

Permalink
feat: Add config to hide quest rewards (#1842)
Browse files Browse the repository at this point in the history
  • Loading branch information
pajlada authored Nov 18, 2024
1 parent d5c4432 commit f3f559a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/main/java/com/questhelper/QuestHelperConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,17 @@ default boolean showFullRequirements()
return false;
}

@ConfigItem(
keyName = "hideQuestRewards",
name = "Hide quest rewards",
description = "Enable this config if you want to hide quest rewards.<br>If you already had a quest helper open, you need to<br>restart it to hide the quest rewards.",
section = sidebarDetailsSection
)
default boolean hideQuestRewards()
{
return false;
}

@ConfigSection(
position = 2,
name = "Quest Hints",
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/questhelper/panel/QuestOverviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,11 @@ public void setupQuestRequirements(QuestHelper quest)
updateQuestNotes(quest.getNotes());

/* Rewards */
questRewardsPanel.setRewards(quest.getQuestRewards());
if (questHelperPlugin.getConfig().hideQuestRewards()) {
questRewardsPanel.hideRewards();
} else {
questRewardsPanel.setRewards(quest.getQuestRewards());
}
}

private static void collectRequirements(QuestHelper quest, List<Requirement> allRequirements, Set<String> processedQuestIds)
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/questhelper/panel/QuestRewardsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,12 @@ public void setRewards(@Nullable List<Reward> rewards)

revalidate();
}

public void hideRewards()
{
rewardsText.setText("Hidden by the \"Hide quest rewards\" config");
rewardsText.setForeground(Color.GRAY);

revalidate();
}
}

0 comments on commit f3f559a

Please sign in to comment.