aboutsummaryrefslogtreecommitdiffstats
path: root/common/src
diff options
context:
space:
mode:
authorKrakenied <Krakenied1@gmail.com>2024-03-13 10:53:44 +0100
committerLeonardo Bishop <13875753+LMBishop@users.noreply.github.com>2024-03-16 00:18:37 +0000
commite4181063076628e8819268478a5359b6b4999176 (patch)
tree9a85c644a0c5f942f5f62e3aebe08e8ff3e96dc1 /common/src
parent10fc3ae291ebc632edd0543121286b1bc80fa947 (diff)
Remove unnecessary HashMap#containsKey call from hot path
Related to https://github.com/LMBishop/Quests/issues/629
Diffstat (limited to 'common/src')
-rw-r--r--common/src/main/java/com/leonardobishop/quests/common/player/questprogressfile/QuestProgressFile.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/src/main/java/com/leonardobishop/quests/common/player/questprogressfile/QuestProgressFile.java b/common/src/main/java/com/leonardobishop/quests/common/player/questprogressfile/QuestProgressFile.java
index 222a925e..b1f048b7 100644
--- a/common/src/main/java/com/leonardobishop/quests/common/player/questprogressfile/QuestProgressFile.java
+++ b/common/src/main/java/com/leonardobishop/quests/common/player/questprogressfile/QuestProgressFile.java
@@ -222,7 +222,8 @@ public class QuestProgressFile {
* @return true if player has the quest started
*/
public boolean hasQuestStarted(Quest quest) {
- return questProgress.containsKey(quest.getId()) && questProgress.get(quest.getId()).isStarted();
+ QuestProgress qProgress = questProgress.get(quest.getId());
+ return qProgress != null && qProgress.isStarted();
}
/**