diff --git a/src/main/java/emu/grasscutter/game/quest/QuestManager.java b/src/main/java/emu/grasscutter/game/quest/QuestManager.java index cb31904bb..3d314e292 100644 --- a/src/main/java/emu/grasscutter/game/quest/QuestManager.java +++ b/src/main/java/emu/grasscutter/game/quest/QuestManager.java @@ -127,18 +127,18 @@ public class QuestManager extends BasePlayerManager { this.player.getActivityManager().triggerActivityConditions(); } - public void onTick(){ - checkTimeVars(); + public void onTick() { + var world = this.getPlayer().getWorld(); + if (world == null) return; + checkTimeVars(); // trigger game time tick for quests queueEvent(QuestContent.QUEST_CONTENT_GAME_TIME_TICK, - player.getWorld().getGameTimeHours() , // hours + world.getGameTimeHours() , // hours 0); } private void checkTimeVars() { - if (this.player.getWorld() == null) return; - val currentDays = player.getWorld().getTotalGameTimeDays(); val currentHours = player.getWorld().getTotalGameTimeHours(); boolean checkDays = currentDays != lastDayCheck; @@ -385,7 +385,7 @@ public class QuestManager extends BasePlayerManager { */ public void checkQuestAlreadyFullfilled(GameQuest quest){ Grasscutter.getGameServer().getScheduler().scheduleDelayedTask(() -> { - for(var condition : quest.getQuestData().getFinishCond()){ + for (var condition : quest.getQuestData().getFinishCond()){ switch (condition.getType()) { case QUEST_CONTENT_OBTAIN_ITEM, QUEST_CONTENT_ITEM_LESS_THAN -> { //check if we already own enough of the item