diff --git a/forge-gui/src/main/java/forge/quest/QuestController.java b/forge-gui/src/main/java/forge/quest/QuestController.java index bd3fc3570e2..0b15c20ccb1 100644 --- a/forge-gui/src/main/java/forge/quest/QuestController.java +++ b/forge-gui/src/main/java/forge/quest/QuestController.java @@ -149,7 +149,7 @@ public class QuestController { model.Ratings.add(r); } } - + /** * Gets the my decks. * @@ -429,19 +429,25 @@ public class QuestController { * Reset the duels manager. */ public void resetDuelsManager() { + QuestWorld world = getWorld(); - String path; - if(world.getName().equals(QuestWorld.STANDARDWORLDNAME)){ - this.duelManager = new QuestEventLDADuelManager(); - return; - } - if (world == null || !world.isCustom()){ - path = world == null || world.getDuelsDir() == null ? ForgeConstants.DEFAULT_DUELS_DIR : ForgeConstants.QUEST_WORLD_DIR + world.getDuelsDir(); - }else{ - path = world == null || world.getDuelsDir() == null ? ForgeConstants.DEFAULT_DUELS_DIR : ForgeConstants.USER_QUEST_WORLD_DIR + world.getDuelsDir(); + String path = ForgeConstants.DEFAULT_CHALLENGES_DIR; + + if (world != null) { + + if (world.getName().equals(QuestWorld.STANDARDWORLDNAME)) { + this.duelManager = new QuestEventLDADuelManager(); + return; + } else if (world.isCustom()) { + path = world.getDuelsDir() == null ? ForgeConstants.DEFAULT_DUELS_DIR : ForgeConstants.USER_QUEST_WORLD_DIR + world.getDuelsDir(); + } else { + path = world.getDuelsDir() == null ? ForgeConstants.DEFAULT_DUELS_DIR : ForgeConstants.QUEST_WORLD_DIR + world.getDuelsDir(); + } + } this.duelManager = new QuestEventDuelManager(new File(path)); + } public HashSet GetRating() { @@ -453,19 +459,25 @@ public class QuestController { * Reset the challenges manager. */ public void resetChallengesManager() { + QuestWorld world = getWorld(); - String path; - if (world.getName().equals(QuestWorld.STANDARDWORLDNAME)){ - allChallenges = QuestChallengeGenerator.generateChallenges(); - return; - } - if (world == null || !world.isCustom()){ - path = world == null || world.getChallengesDir() == null ? ForgeConstants.DEFAULT_CHALLENGES_DIR : ForgeConstants.QUEST_WORLD_DIR + world.getChallengesDir(); - }else{ - path = world == null || world.getChallengesDir() == null ? ForgeConstants.DEFAULT_CHALLENGES_DIR : ForgeConstants.USER_QUEST_WORLD_DIR + world.getChallengesDir(); + String path = ForgeConstants.DEFAULT_CHALLENGES_DIR; + + if (world != null) { + + if (world.getName().equals(QuestWorld.STANDARDWORLDNAME)) { + allChallenges = QuestChallengeGenerator.generateChallenges(); + return; + } else if (world.isCustom()) { + path = world.getChallengesDir() == null ? ForgeConstants.DEFAULT_CHALLENGES_DIR : ForgeConstants.QUEST_WORLD_DIR + world.getChallengesDir(); + } else { + path = world.getChallengesDir() == null ? ForgeConstants.DEFAULT_CHALLENGES_DIR : ForgeConstants.USER_QUEST_WORLD_DIR + world.getChallengesDir(); + } } - this.allChallenges = new StorageBase("Quest Challenges", new QuestChallengeReader(new File(path))); + + this.allChallenges = new StorageBase<>("Quest Challenges", new QuestChallengeReader(new File(path))); + } /**