mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-27 06:24:27 +00:00
Fix potential NPE
this can occur if the player disconnects before logging in
This commit is contained in:
parent
c2e9bdd261
commit
7efa6d1b78
@ -137,6 +137,8 @@ public class QuestManager extends BasePlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkTimeVars() {
|
private void checkTimeVars() {
|
||||||
|
if (this.player.getWorld() == null) return;
|
||||||
|
|
||||||
val currentDays = player.getWorld().getTotalGameTimeDays();
|
val currentDays = player.getWorld().getTotalGameTimeDays();
|
||||||
val currentHours = player.getWorld().getTotalGameTimeHours();
|
val currentHours = player.getWorld().getTotalGameTimeHours();
|
||||||
boolean checkDays = currentDays != lastDayCheck;
|
boolean checkDays = currentDays != lastDayCheck;
|
||||||
@ -150,13 +152,13 @@ public class QuestManager extends BasePlayerManager {
|
|||||||
this.lastHourCheck = currentHours;
|
this.lastHourCheck = currentHours;
|
||||||
|
|
||||||
player.getActiveQuestTimers().forEach(mainQuestId -> {
|
player.getActiveQuestTimers().forEach(mainQuestId -> {
|
||||||
if(checkHours) {
|
if (checkHours) {
|
||||||
queueEvent(QuestCond.QUEST_COND_TIME_VAR_GT_EQ, mainQuestId);
|
this.queueEvent(QuestCond.QUEST_COND_TIME_VAR_GT_EQ, mainQuestId);
|
||||||
queueEvent(QuestContent.QUEST_CONTENT_TIME_VAR_GT_EQ, mainQuestId);
|
this.queueEvent(QuestContent.QUEST_CONTENT_TIME_VAR_GT_EQ, mainQuestId);
|
||||||
}
|
}
|
||||||
if(checkDays) {
|
if (checkDays) {
|
||||||
queueEvent(QuestCond.QUEST_COND_TIME_VAR_PASS_DAY, mainQuestId);
|
this.queueEvent(QuestCond.QUEST_COND_TIME_VAR_PASS_DAY, mainQuestId);
|
||||||
queueEvent(QuestContent.QUEST_CONTENT_TIME_VAR_PASS_DAY, mainQuestId);
|
this.queueEvent(QuestContent.QUEST_CONTENT_TIME_VAR_PASS_DAY, mainQuestId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user