From 52ef8a0727633627a11b6981187e97bbc043c9c1 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Mon, 18 Nov 2024 23:19:41 +0100 Subject: [PATCH] feat: Add config to hide quest rewards --- src/main/java/com/questhelper/QuestHelperConfig.java | 11 +++++++++++ .../com/questhelper/panel/QuestOverviewPanel.java | 6 +++++- .../java/com/questhelper/panel/QuestRewardsPanel.java | 8 ++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/questhelper/QuestHelperConfig.java b/src/main/java/com/questhelper/QuestHelperConfig.java index de5cb5b811..b79c305909 100644 --- a/src/main/java/com/questhelper/QuestHelperConfig.java +++ b/src/main/java/com/questhelper/QuestHelperConfig.java @@ -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.
If you already had a quest helper open, you need to
restart it to hide the quest rewards.", + section = sidebarDetailsSection + ) + default boolean hideQuestRewards() + { + return false; + } + @ConfigSection( position = 2, name = "Quest Hints", diff --git a/src/main/java/com/questhelper/panel/QuestOverviewPanel.java b/src/main/java/com/questhelper/panel/QuestOverviewPanel.java index 185cca1c17..62871cf32a 100644 --- a/src/main/java/com/questhelper/panel/QuestOverviewPanel.java +++ b/src/main/java/com/questhelper/panel/QuestOverviewPanel.java @@ -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 allRequirements, Set processedQuestIds) diff --git a/src/main/java/com/questhelper/panel/QuestRewardsPanel.java b/src/main/java/com/questhelper/panel/QuestRewardsPanel.java index 406390de54..f16e29f3b9 100644 --- a/src/main/java/com/questhelper/panel/QuestRewardsPanel.java +++ b/src/main/java/com/questhelper/panel/QuestRewardsPanel.java @@ -100,4 +100,12 @@ public void setRewards(@Nullable List rewards) revalidate(); } + + public void hideRewards() + { + rewardsText.setText("Hidden by the \"Hide quest rewards\" config"); + rewardsText.setForeground(Color.GRAY); + + revalidate(); + } }