Slight change on synchronization method. (#2135)

This commit is contained in:
scooterboo
2023-04-30 19:05:15 -07:00
committed by GitHub
parent b2c5ae93d2
commit e524926ae0
2 changed files with 16 additions and 12 deletions

View File

@@ -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));