mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-25 01:52:58 +08:00
Fix NPEs when player leaves world
This commit is contained in:
parent
02653620d4
commit
5f4f220eab
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user