Changed getAi method to synchronized.

This commit is contained in:
MobiusDevelopment
2019-11-03 20:52:05 +00:00
parent fb5302e0ab
commit 3ed4660df9
18 changed files with 39 additions and 148 deletions

View File

@ -1777,18 +1777,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* Gets this creature's AI.
* @return the AI
*/
public CreatureAI getAI()
public synchronized CreatureAI getAI()
{
CreatureAI ai = _ai;
if (ai == null)
{
synchronized (this)
{
if (_ai == null)
{
return _ai = initAI();
}
}
_ai = ai = initAI();
}
return ai;
}