Bulk process when players join, if new missions are added.
This commit is contained in:
parent
9509ae0672
commit
2bd4b1889b
@ -444,6 +444,7 @@ public class MissionManager extends MiniDbClientPlugin<MissionClient>
|
||||
if (started > 0)
|
||||
{
|
||||
player.sendMessage(F.main(getName(), "You started " + F.count(started) + " new mission" + (started == 1 ? "" : "s") + ". Visit " + NPC_NAME + C.mBody + " to view them."));
|
||||
runAsync(_repository::bulkProcess);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,12 +49,14 @@ public class MissionRepository extends RepositoryBase
|
||||
}
|
||||
|
||||
private final List<MissionQuery> _queries;
|
||||
private final Object _lock;
|
||||
|
||||
MissionRepository()
|
||||
{
|
||||
super(DBPool.getAccount());
|
||||
|
||||
_queries = new ArrayList<>();
|
||||
_lock = new Object();
|
||||
}
|
||||
|
||||
public void addQueryToQueue(MissionQuery query)
|
||||
@ -68,6 +70,8 @@ public class MissionRepository extends RepositoryBase
|
||||
}
|
||||
|
||||
public void bulkProcess()
|
||||
{
|
||||
synchronized (_lock)
|
||||
{
|
||||
if (_queries.isEmpty())
|
||||
{
|
||||
@ -85,6 +89,7 @@ public class MissionRepository extends RepositoryBase
|
||||
|
||||
_queries.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean completeMission(int accountId, int missionId)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user