mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 08:56:04 +01:00
Slight change on synchronization method. (#2135)
This commit is contained in:
@@ -144,13 +144,15 @@ public class GameMainQuest {
|
||||
public void finish() {
|
||||
// Avoid recursion from child finish() in GameQuest
|
||||
// when auto finishing all child quests with QUEST_STATE_UNFINISHED (below)
|
||||
if (this.isFinished || this.state == ParentQuestState.PARENT_QUEST_STATE_FINISHED) {
|
||||
Grasscutter.getLogger().debug("Skip main quest finishing because it's already finished");
|
||||
return;
|
||||
}
|
||||
synchronized (this) {
|
||||
if (this.isFinished || this.state == ParentQuestState.PARENT_QUEST_STATE_FINISHED) {
|
||||
Grasscutter.getLogger().debug("Skip main quest {} finishing because it's already finished",this.getParentQuestId());
|
||||
return;
|
||||
}
|
||||
|
||||
this.isFinished = true;
|
||||
this.state = ParentQuestState.PARENT_QUEST_STATE_FINISHED;
|
||||
this.isFinished = true;
|
||||
this.state = ParentQuestState.PARENT_QUEST_STATE_FINISHED;
|
||||
}
|
||||
|
||||
/*
|
||||
* We also need to check for unfinished childQuests in this MainQuest
|
||||
|
||||
@@ -178,14 +178,16 @@ public class GameQuest {
|
||||
return true;
|
||||
}
|
||||
|
||||
public synchronized void finish() {
|
||||
public void finish() {
|
||||
// Check if the quest has been finished.
|
||||
if (this.state == QuestState.QUEST_STATE_FINISHED) {
|
||||
Grasscutter.getLogger().debug("Quest {} was already finished.", this.getSubQuestId());
|
||||
return;
|
||||
}
|
||||
synchronized (this) {
|
||||
if (this.state == QuestState.QUEST_STATE_FINISHED) {
|
||||
Grasscutter.getLogger().debug("Quest {} was already finished.", this.getSubQuestId());
|
||||
return;
|
||||
}
|
||||
|
||||
this.state = QuestState.QUEST_STATE_FINISHED;
|
||||
this.state = QuestState.QUEST_STATE_FINISHED;
|
||||
}
|
||||
this.finishTime = Utils.getCurrentSeconds();
|
||||
|
||||
this.getOwner().sendPacket(new PacketQuestListUpdateNotify(this));
|
||||
|
||||
Reference in New Issue
Block a user