diff --git a/Server/src/main/java/core/game/node/entity/player/link/quest/QuestRepository.java b/Server/src/main/java/core/game/node/entity/player/link/quest/QuestRepository.java index 7e9d3acab..b1d911271 100644 --- a/Server/src/main/java/core/game/node/entity/player/link/quest/QuestRepository.java +++ b/Server/src/main/java/core/game/node/entity/player/link/quest/QuestRepository.java @@ -95,6 +95,21 @@ public final class QuestRepository { * @param stage The stage. */ public void setStage(Quest quest, int stage) { + int oldStage = getStage(quest); + if(oldStage < stage) { + quests.put(quest.getIndex(), stage); + } else { + SystemLogger.logWarn(String.format("Nonmonotonic QuestRepository.setStage call for player \"%s\", quest \"%s\", old stage %d, new stage %d", player.getName(), quest.getName(), oldStage, stage)); + } + } + + /** + * Sets the stage of a quest, permitting non-monotonic updates. + * + * @param quest The quest. + * @param stage The stage. + */ + public void setStageNonmonotonic(Quest quest, int stage) { quests.put(quest.getIndex(), stage); } diff --git a/Server/src/main/kotlin/rs09/game/system/command/sets/QuestCommandSet.kt b/Server/src/main/kotlin/rs09/game/system/command/sets/QuestCommandSet.kt index 53d39880c..825fca176 100644 --- a/Server/src/main/kotlin/rs09/game/system/command/sets/QuestCommandSet.kt +++ b/Server/src/main/kotlin/rs09/game/system/command/sets/QuestCommandSet.kt @@ -34,7 +34,7 @@ class QuestCommandSet : CommandSet(Command.Privilege.ADMIN){ } val quest = args[1].toIntOrNull() ?: reject(player,"INVALID QUEST") val stage = args[2].toIntOrNull() ?: reject(player,"INVALID STAGE") - player.questRepository.setStage(player.questRepository.forIndex(quest as Int), stage as Int) + player.questRepository.setStageNonmonotonic(player.questRepository.forIndex(quest as Int), stage as Int) notify(player, "