From 078a59d2c48900ff39d734d3560827842f147259 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 19 Jan 2018 06:46:02 +0000 Subject: [PATCH] Dropped reused minion references. --- .../gameserver/ai/L2AttackableAI.java | 7 - .../actor/instance/L2MonsterInstance.java | 6 - .../l2jmobius/gameserver/util/MinionList.java | 93 ++--------- .../gameserver/ai/L2AttackableAI.java | 7 - .../actor/instance/L2MonsterInstance.java | 6 - .../l2jmobius/gameserver/util/MinionList.java | 93 ++--------- .../gameserver/ai/L2AttackableAI.java | 7 - .../actor/instance/L2MonsterInstance.java | 6 - .../l2jmobius/gameserver/util/MinionList.java | 93 ++--------- .../gameserver/ai/L2AttackableAI.java | 7 - .../actor/instance/L2MonsterInstance.java | 6 - .../l2jmobius/gameserver/util/MinionList.java | 93 ++--------- .../gameserver/ai/L2AttackableAI.java | 4 - .../actor/instance/L2MonsterInstance.java | 6 - .../l2jmobius/gameserver/util/MinionList.java | 150 ++++++++---------- .../gameserver/ai/L2AttackableAI.java | 7 - .../actor/instance/L2MonsterInstance.java | 6 - .../l2jmobius/gameserver/util/MinionList.java | 93 ++--------- 18 files changed, 134 insertions(+), 556 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 81b89461fc..6fc8e2db7b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -509,13 +509,6 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable { npc.clearAggroList(); npc.getAttackByList().clear(); - if (npc.isMonster()) - { - if (((L2MonsterInstance) npc).hasMinions()) - { - ((L2MonsterInstance) npc).getMinionList().deleteReusedMinions(); - } - } } // Check if the mob should not return to spawn point diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index fe55288a3a..0985488e6d 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -115,12 +115,6 @@ public class L2MonsterInstance extends L2Attackable getLeader().getMinionList().onMinionSpawn(this); } - // delete spawned minions before dynamic minions spawned by script - if (hasMinions()) - { - getMinionList().onMasterSpawn(); - } - startMaintenanceTask(); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/MinionList.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/MinionList.java index eafbd496c3..fda128217e 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/MinionList.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/MinionList.java @@ -30,15 +30,12 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.holders.MinionHolder; /** - * @author luisantonioa, DS + * @author luisantonioa, DS, Mobius */ public class MinionList { protected final L2MonsterInstance _master; - /** List containing the current spawned minions */ - private final List _minionReferences = new CopyOnWriteArrayList<>(); - /** List containing the cached deleted minions for reuse */ - protected List _reusedMinionReferences = null; + private final List _spawnedMinions = new CopyOnWriteArrayList<>(); public MinionList(L2MonsterInstance pMaster) { @@ -54,7 +51,7 @@ public class MinionList */ public List getSpawnedMinions() { - return _minionReferences; + return _spawnedMinions; } /** @@ -69,13 +66,7 @@ public class MinionList */ public final void spawnMinions(List minions) { - if (_master.isAlikeDead()) - { - return; - } - - // List minions = _master.getParameters().getMinionList("Privates"); - if (minions == null) + if (_master.isAlikeDead() || (minions == null)) { return; } @@ -95,8 +86,6 @@ public class MinionList } } } - // remove non-needed minions - deleteReusedMinions(); } /** @@ -104,48 +93,17 @@ public class MinionList */ public void deleteSpawnedMinions() { - if (!_minionReferences.isEmpty()) + if (!_spawnedMinions.isEmpty()) { - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if (minion != null) { minion.setLeader(null); minion.deleteMe(); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } } } - _minionReferences.clear(); - } - } - - /** - * Delete all reused minions to prevent memory leaks. - */ - public void deleteReusedMinions() - { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.clear(); - } - } - - // hooks - - /** - * Called on the master spawn Old minions (from previous spawn) are deleted. If master can respawn - enabled reuse of the killed minions. - */ - public void onMasterSpawn() - { - deleteSpawnedMinions(); - - // if master has spawn and can respawn - try to reuse minions - if ((_reusedMinionReferences == null) && (_master.getParameters().getSet().get("SummonPrivateRate") == null) && !_master.getParameters().getMinionList("Privates").isEmpty() && (_master.getSpawn() != null) && _master.getSpawn().isRespawnEnabled()) - { - _reusedMinionReferences = new CopyOnWriteArrayList<>(); + _spawnedMinions.clear(); } } @@ -155,7 +113,7 @@ public class MinionList */ public void onMinionSpawn(L2MonsterInstance minion) { - _minionReferences.add(minion); + _spawnedMinions.add(minion); } /** @@ -178,11 +136,7 @@ public class MinionList public void onMinionDie(L2MonsterInstance minion, int respawnTime) { minion.setLeader(null); // prevent memory leaks - _minionReferences.remove(minion); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } + _spawnedMinions.remove(minion); final int time = respawnTime < 0 ? _master.isRaid() ? (int) Config.RAID_MINION_RESPAWN_TIMER : 0 : respawnTime; if ((time > 0) && !_master.isAlikeDead()) @@ -215,7 +169,7 @@ public class MinionList aggro *= 10; } - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && (callerIsMaster || !minion.isInCombat())) { @@ -232,7 +186,7 @@ public class MinionList final int offset = 200; final int minRadius = (int) _master.getCollisionRadius() + 30; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && !minion.isMovementDisabled()) { @@ -267,20 +221,6 @@ public class MinionList { return; } - - // searching in reused minions - if (_reusedMinionReferences != null) - { - final L2MonsterInstance minion = _reusedMinionReferences.stream().filter(m -> (m.getId() == minionId)).findFirst().orElse(null); - if (minion != null) - { - _reusedMinionReferences.remove(minion); - minion.refreshID(); - initializeNpcInstance(_master, minion); - return; - } - } - // not found in cache spawnMinion(_master, minionId); } @@ -301,11 +241,6 @@ public class MinionList // minion can be already spawned or deleted if (!_minion.isSpawned()) { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.remove(_minion); - } - _minion.refreshID(); initializeNpcInstance(_master, _minion); } @@ -390,7 +325,7 @@ public class MinionList private final int countSpawnedMinionsById(int minionId) { int count = 0; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && (minion.getId() == minionId)) { @@ -402,11 +337,11 @@ public class MinionList public final int countSpawnedMinions() { - return _minionReferences.size(); + return _spawnedMinions.size(); } public final long lazyCountSpawnedMinionsGroups() { - return _minionReferences.stream().distinct().count(); + return _spawnedMinions.stream().distinct().count(); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 81b89461fc..6fc8e2db7b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -509,13 +509,6 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable { npc.clearAggroList(); npc.getAttackByList().clear(); - if (npc.isMonster()) - { - if (((L2MonsterInstance) npc).hasMinions()) - { - ((L2MonsterInstance) npc).getMinionList().deleteReusedMinions(); - } - } } // Check if the mob should not return to spawn point diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index fe55288a3a..0985488e6d 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -115,12 +115,6 @@ public class L2MonsterInstance extends L2Attackable getLeader().getMinionList().onMinionSpawn(this); } - // delete spawned minions before dynamic minions spawned by script - if (hasMinions()) - { - getMinionList().onMasterSpawn(); - } - startMaintenanceTask(); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/MinionList.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/MinionList.java index eafbd496c3..fda128217e 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/MinionList.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/MinionList.java @@ -30,15 +30,12 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.holders.MinionHolder; /** - * @author luisantonioa, DS + * @author luisantonioa, DS, Mobius */ public class MinionList { protected final L2MonsterInstance _master; - /** List containing the current spawned minions */ - private final List _minionReferences = new CopyOnWriteArrayList<>(); - /** List containing the cached deleted minions for reuse */ - protected List _reusedMinionReferences = null; + private final List _spawnedMinions = new CopyOnWriteArrayList<>(); public MinionList(L2MonsterInstance pMaster) { @@ -54,7 +51,7 @@ public class MinionList */ public List getSpawnedMinions() { - return _minionReferences; + return _spawnedMinions; } /** @@ -69,13 +66,7 @@ public class MinionList */ public final void spawnMinions(List minions) { - if (_master.isAlikeDead()) - { - return; - } - - // List minions = _master.getParameters().getMinionList("Privates"); - if (minions == null) + if (_master.isAlikeDead() || (minions == null)) { return; } @@ -95,8 +86,6 @@ public class MinionList } } } - // remove non-needed minions - deleteReusedMinions(); } /** @@ -104,48 +93,17 @@ public class MinionList */ public void deleteSpawnedMinions() { - if (!_minionReferences.isEmpty()) + if (!_spawnedMinions.isEmpty()) { - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if (minion != null) { minion.setLeader(null); minion.deleteMe(); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } } } - _minionReferences.clear(); - } - } - - /** - * Delete all reused minions to prevent memory leaks. - */ - public void deleteReusedMinions() - { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.clear(); - } - } - - // hooks - - /** - * Called on the master spawn Old minions (from previous spawn) are deleted. If master can respawn - enabled reuse of the killed minions. - */ - public void onMasterSpawn() - { - deleteSpawnedMinions(); - - // if master has spawn and can respawn - try to reuse minions - if ((_reusedMinionReferences == null) && (_master.getParameters().getSet().get("SummonPrivateRate") == null) && !_master.getParameters().getMinionList("Privates").isEmpty() && (_master.getSpawn() != null) && _master.getSpawn().isRespawnEnabled()) - { - _reusedMinionReferences = new CopyOnWriteArrayList<>(); + _spawnedMinions.clear(); } } @@ -155,7 +113,7 @@ public class MinionList */ public void onMinionSpawn(L2MonsterInstance minion) { - _minionReferences.add(minion); + _spawnedMinions.add(minion); } /** @@ -178,11 +136,7 @@ public class MinionList public void onMinionDie(L2MonsterInstance minion, int respawnTime) { minion.setLeader(null); // prevent memory leaks - _minionReferences.remove(minion); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } + _spawnedMinions.remove(minion); final int time = respawnTime < 0 ? _master.isRaid() ? (int) Config.RAID_MINION_RESPAWN_TIMER : 0 : respawnTime; if ((time > 0) && !_master.isAlikeDead()) @@ -215,7 +169,7 @@ public class MinionList aggro *= 10; } - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && (callerIsMaster || !minion.isInCombat())) { @@ -232,7 +186,7 @@ public class MinionList final int offset = 200; final int minRadius = (int) _master.getCollisionRadius() + 30; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && !minion.isMovementDisabled()) { @@ -267,20 +221,6 @@ public class MinionList { return; } - - // searching in reused minions - if (_reusedMinionReferences != null) - { - final L2MonsterInstance minion = _reusedMinionReferences.stream().filter(m -> (m.getId() == minionId)).findFirst().orElse(null); - if (minion != null) - { - _reusedMinionReferences.remove(minion); - minion.refreshID(); - initializeNpcInstance(_master, minion); - return; - } - } - // not found in cache spawnMinion(_master, minionId); } @@ -301,11 +241,6 @@ public class MinionList // minion can be already spawned or deleted if (!_minion.isSpawned()) { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.remove(_minion); - } - _minion.refreshID(); initializeNpcInstance(_master, _minion); } @@ -390,7 +325,7 @@ public class MinionList private final int countSpawnedMinionsById(int minionId) { int count = 0; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && (minion.getId() == minionId)) { @@ -402,11 +337,11 @@ public class MinionList public final int countSpawnedMinions() { - return _minionReferences.size(); + return _spawnedMinions.size(); } public final long lazyCountSpawnedMinionsGroups() { - return _minionReferences.stream().distinct().count(); + return _spawnedMinions.stream().distinct().count(); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 81b89461fc..6fc8e2db7b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -509,13 +509,6 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable { npc.clearAggroList(); npc.getAttackByList().clear(); - if (npc.isMonster()) - { - if (((L2MonsterInstance) npc).hasMinions()) - { - ((L2MonsterInstance) npc).getMinionList().deleteReusedMinions(); - } - } } // Check if the mob should not return to spawn point diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index fe55288a3a..0985488e6d 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -115,12 +115,6 @@ public class L2MonsterInstance extends L2Attackable getLeader().getMinionList().onMinionSpawn(this); } - // delete spawned minions before dynamic minions spawned by script - if (hasMinions()) - { - getMinionList().onMasterSpawn(); - } - startMaintenanceTask(); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/MinionList.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/MinionList.java index eafbd496c3..fda128217e 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/MinionList.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/MinionList.java @@ -30,15 +30,12 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.holders.MinionHolder; /** - * @author luisantonioa, DS + * @author luisantonioa, DS, Mobius */ public class MinionList { protected final L2MonsterInstance _master; - /** List containing the current spawned minions */ - private final List _minionReferences = new CopyOnWriteArrayList<>(); - /** List containing the cached deleted minions for reuse */ - protected List _reusedMinionReferences = null; + private final List _spawnedMinions = new CopyOnWriteArrayList<>(); public MinionList(L2MonsterInstance pMaster) { @@ -54,7 +51,7 @@ public class MinionList */ public List getSpawnedMinions() { - return _minionReferences; + return _spawnedMinions; } /** @@ -69,13 +66,7 @@ public class MinionList */ public final void spawnMinions(List minions) { - if (_master.isAlikeDead()) - { - return; - } - - // List minions = _master.getParameters().getMinionList("Privates"); - if (minions == null) + if (_master.isAlikeDead() || (minions == null)) { return; } @@ -95,8 +86,6 @@ public class MinionList } } } - // remove non-needed minions - deleteReusedMinions(); } /** @@ -104,48 +93,17 @@ public class MinionList */ public void deleteSpawnedMinions() { - if (!_minionReferences.isEmpty()) + if (!_spawnedMinions.isEmpty()) { - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if (minion != null) { minion.setLeader(null); minion.deleteMe(); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } } } - _minionReferences.clear(); - } - } - - /** - * Delete all reused minions to prevent memory leaks. - */ - public void deleteReusedMinions() - { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.clear(); - } - } - - // hooks - - /** - * Called on the master spawn Old minions (from previous spawn) are deleted. If master can respawn - enabled reuse of the killed minions. - */ - public void onMasterSpawn() - { - deleteSpawnedMinions(); - - // if master has spawn and can respawn - try to reuse minions - if ((_reusedMinionReferences == null) && (_master.getParameters().getSet().get("SummonPrivateRate") == null) && !_master.getParameters().getMinionList("Privates").isEmpty() && (_master.getSpawn() != null) && _master.getSpawn().isRespawnEnabled()) - { - _reusedMinionReferences = new CopyOnWriteArrayList<>(); + _spawnedMinions.clear(); } } @@ -155,7 +113,7 @@ public class MinionList */ public void onMinionSpawn(L2MonsterInstance minion) { - _minionReferences.add(minion); + _spawnedMinions.add(minion); } /** @@ -178,11 +136,7 @@ public class MinionList public void onMinionDie(L2MonsterInstance minion, int respawnTime) { minion.setLeader(null); // prevent memory leaks - _minionReferences.remove(minion); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } + _spawnedMinions.remove(minion); final int time = respawnTime < 0 ? _master.isRaid() ? (int) Config.RAID_MINION_RESPAWN_TIMER : 0 : respawnTime; if ((time > 0) && !_master.isAlikeDead()) @@ -215,7 +169,7 @@ public class MinionList aggro *= 10; } - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && (callerIsMaster || !minion.isInCombat())) { @@ -232,7 +186,7 @@ public class MinionList final int offset = 200; final int minRadius = (int) _master.getCollisionRadius() + 30; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && !minion.isMovementDisabled()) { @@ -267,20 +221,6 @@ public class MinionList { return; } - - // searching in reused minions - if (_reusedMinionReferences != null) - { - final L2MonsterInstance minion = _reusedMinionReferences.stream().filter(m -> (m.getId() == minionId)).findFirst().orElse(null); - if (minion != null) - { - _reusedMinionReferences.remove(minion); - minion.refreshID(); - initializeNpcInstance(_master, minion); - return; - } - } - // not found in cache spawnMinion(_master, minionId); } @@ -301,11 +241,6 @@ public class MinionList // minion can be already spawned or deleted if (!_minion.isSpawned()) { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.remove(_minion); - } - _minion.refreshID(); initializeNpcInstance(_master, _minion); } @@ -390,7 +325,7 @@ public class MinionList private final int countSpawnedMinionsById(int minionId) { int count = 0; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && (minion.getId() == minionId)) { @@ -402,11 +337,11 @@ public class MinionList public final int countSpawnedMinions() { - return _minionReferences.size(); + return _spawnedMinions.size(); } public final long lazyCountSpawnedMinionsGroups() { - return _minionReferences.stream().distinct().count(); + return _spawnedMinions.stream().distinct().count(); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 81b89461fc..6fc8e2db7b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -509,13 +509,6 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable { npc.clearAggroList(); npc.getAttackByList().clear(); - if (npc.isMonster()) - { - if (((L2MonsterInstance) npc).hasMinions()) - { - ((L2MonsterInstance) npc).getMinionList().deleteReusedMinions(); - } - } } // Check if the mob should not return to spawn point diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index fe55288a3a..0985488e6d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -115,12 +115,6 @@ public class L2MonsterInstance extends L2Attackable getLeader().getMinionList().onMinionSpawn(this); } - // delete spawned minions before dynamic minions spawned by script - if (hasMinions()) - { - getMinionList().onMasterSpawn(); - } - startMaintenanceTask(); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/MinionList.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/MinionList.java index eafbd496c3..fda128217e 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/MinionList.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/MinionList.java @@ -30,15 +30,12 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.holders.MinionHolder; /** - * @author luisantonioa, DS + * @author luisantonioa, DS, Mobius */ public class MinionList { protected final L2MonsterInstance _master; - /** List containing the current spawned minions */ - private final List _minionReferences = new CopyOnWriteArrayList<>(); - /** List containing the cached deleted minions for reuse */ - protected List _reusedMinionReferences = null; + private final List _spawnedMinions = new CopyOnWriteArrayList<>(); public MinionList(L2MonsterInstance pMaster) { @@ -54,7 +51,7 @@ public class MinionList */ public List getSpawnedMinions() { - return _minionReferences; + return _spawnedMinions; } /** @@ -69,13 +66,7 @@ public class MinionList */ public final void spawnMinions(List minions) { - if (_master.isAlikeDead()) - { - return; - } - - // List minions = _master.getParameters().getMinionList("Privates"); - if (minions == null) + if (_master.isAlikeDead() || (minions == null)) { return; } @@ -95,8 +86,6 @@ public class MinionList } } } - // remove non-needed minions - deleteReusedMinions(); } /** @@ -104,48 +93,17 @@ public class MinionList */ public void deleteSpawnedMinions() { - if (!_minionReferences.isEmpty()) + if (!_spawnedMinions.isEmpty()) { - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if (minion != null) { minion.setLeader(null); minion.deleteMe(); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } } } - _minionReferences.clear(); - } - } - - /** - * Delete all reused minions to prevent memory leaks. - */ - public void deleteReusedMinions() - { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.clear(); - } - } - - // hooks - - /** - * Called on the master spawn Old minions (from previous spawn) are deleted. If master can respawn - enabled reuse of the killed minions. - */ - public void onMasterSpawn() - { - deleteSpawnedMinions(); - - // if master has spawn and can respawn - try to reuse minions - if ((_reusedMinionReferences == null) && (_master.getParameters().getSet().get("SummonPrivateRate") == null) && !_master.getParameters().getMinionList("Privates").isEmpty() && (_master.getSpawn() != null) && _master.getSpawn().isRespawnEnabled()) - { - _reusedMinionReferences = new CopyOnWriteArrayList<>(); + _spawnedMinions.clear(); } } @@ -155,7 +113,7 @@ public class MinionList */ public void onMinionSpawn(L2MonsterInstance minion) { - _minionReferences.add(minion); + _spawnedMinions.add(minion); } /** @@ -178,11 +136,7 @@ public class MinionList public void onMinionDie(L2MonsterInstance minion, int respawnTime) { minion.setLeader(null); // prevent memory leaks - _minionReferences.remove(minion); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } + _spawnedMinions.remove(minion); final int time = respawnTime < 0 ? _master.isRaid() ? (int) Config.RAID_MINION_RESPAWN_TIMER : 0 : respawnTime; if ((time > 0) && !_master.isAlikeDead()) @@ -215,7 +169,7 @@ public class MinionList aggro *= 10; } - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && (callerIsMaster || !minion.isInCombat())) { @@ -232,7 +186,7 @@ public class MinionList final int offset = 200; final int minRadius = (int) _master.getCollisionRadius() + 30; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && !minion.isMovementDisabled()) { @@ -267,20 +221,6 @@ public class MinionList { return; } - - // searching in reused minions - if (_reusedMinionReferences != null) - { - final L2MonsterInstance minion = _reusedMinionReferences.stream().filter(m -> (m.getId() == minionId)).findFirst().orElse(null); - if (minion != null) - { - _reusedMinionReferences.remove(minion); - minion.refreshID(); - initializeNpcInstance(_master, minion); - return; - } - } - // not found in cache spawnMinion(_master, minionId); } @@ -301,11 +241,6 @@ public class MinionList // minion can be already spawned or deleted if (!_minion.isSpawned()) { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.remove(_minion); - } - _minion.refreshID(); initializeNpcInstance(_master, _minion); } @@ -390,7 +325,7 @@ public class MinionList private final int countSpawnedMinionsById(int minionId) { int count = 0; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && (minion.getId() == minionId)) { @@ -402,11 +337,11 @@ public class MinionList public final int countSpawnedMinions() { - return _minionReferences.size(); + return _spawnedMinions.size(); } public final long lazyCountSpawnedMinionsGroups() { - return _minionReferences.stream().distinct().count(); + return _spawnedMinions.stream().distinct().count(); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index e121f2b667..775f6d2144 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -538,10 +538,6 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable { npc.clearAggroList(); npc.getAttackByList().clear(); - if ((npc instanceof L2MonsterInstance) && ((L2MonsterInstance) npc).hasMinions()) - { - ((L2MonsterInstance) npc).getMinionList().deleteReusedMinions(); - } } // Check if the mob should not return to spawn point diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 9182511be2..f974c900a5 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -97,12 +97,6 @@ public class L2MonsterInstance extends L2Attackable getLeader().getMinionList().onMinionSpawn(this); } - // delete spawned minions before dynamic minions spawned by script - if (hasMinions()) - { - getMinionList().onMasterSpawn(); - } - startMaintenanceTask(); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/MinionList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/MinionList.java index 47d7eacad3..597a468faa 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/MinionList.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/MinionList.java @@ -27,19 +27,15 @@ import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.holders.MinionHolder; -import com.l2jmobius.gameserver.taskmanager.DecayTaskManager; import com.l2jmobius.util.Rnd; /** - * @author luisantonioa, DS + * @author luisantonioa, DS, Mobius */ public class MinionList { protected final L2MonsterInstance _master; - /** List containing the current spawned minions */ - private final List _minionReferences = new CopyOnWriteArrayList<>(); - /** List containing the cached deleted minions for reuse */ - protected List _reusedMinionReferences = null; + private final List _spawnedMinions = new CopyOnWriteArrayList<>(); public MinionList(L2MonsterInstance pMaster) { @@ -55,7 +51,7 @@ public class MinionList */ public List getSpawnedMinions() { - return _minionReferences; + return _spawnedMinions; } /** @@ -75,8 +71,7 @@ public class MinionList return; } - int minionCount, minionId; - long minionsToSpawn; + int minionCount, minionId, minionsToSpawn; for (MinionHolder minion : minions) { minionCount = minion.getCount(); @@ -91,8 +86,6 @@ public class MinionList } } } - // remove non-needed minions - deleteReusedMinions(); } /** @@ -100,49 +93,17 @@ public class MinionList */ public void deleteSpawnedMinions() { - if (_minionReferences.isEmpty()) + if (!_spawnedMinions.isEmpty()) { - return; - } - for (L2MonsterInstance minion : _minionReferences) - { - if (minion != null) + for (L2MonsterInstance minion : _spawnedMinions) { - minion.setLeader(null); - minion.deleteMe(); - if (_reusedMinionReferences != null) + if (minion != null) { - _reusedMinionReferences.add(minion); + minion.setLeader(null); + minion.deleteMe(); } } - } - _minionReferences.clear(); - } - - /** - * Delete all reused minions to prevent memory leaks. - */ - public void deleteReusedMinions() - { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.clear(); - } - } - - // hooks - - /** - * Called on the master spawn Old minions (from previous spawn) are deleted. If master can respawn - enabled reuse of the killed minions. - */ - public void onMasterSpawn() - { - deleteSpawnedMinions(); - - // if master has spawn and can respawn - try to reuse minions - if ((_reusedMinionReferences == null) && (_master.getTemplate().getParameters().getSet().get("SummonPrivateRate") == null) && !_master.getTemplate().getParameters().getMinionList("Privates").isEmpty() && (_master.getSpawn() != null) && _master.getSpawn().isRespawnEnabled()) - { - _reusedMinionReferences = new CopyOnWriteArrayList<>(); + _spawnedMinions.clear(); } } @@ -152,7 +113,7 @@ public class MinionList */ public void onMinionSpawn(L2MonsterInstance minion) { - _minionReferences.add(minion); + _spawnedMinions.add(minion); } /** @@ -175,11 +136,7 @@ public class MinionList public void onMinionDie(L2MonsterInstance minion, int respawnTime) { minion.setLeader(null); // prevent memory leaks - _minionReferences.remove(minion); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } + _spawnedMinions.remove(minion); final int time = respawnTime < 0 ? _master.isRaid() ? (int) Config.RAID_MINION_RESPAWN_TIMER : 0 : respawnTime; if ((time > 0) && !_master.isAlikeDead()) @@ -212,7 +169,7 @@ public class MinionList aggro *= 10; } - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && (callerIsMaster || !minion.isInCombat())) { @@ -229,15 +186,29 @@ public class MinionList final int offset = 200; final int minRadius = (int) _master.getCollisionRadius() + 30; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && !minion.isMovementDisabled()) { int newX = Rnd.get(minRadius * 2, offset * 2); // x int newY = Rnd.get(newX, offset * 2); // distance newY = (int) Math.sqrt((newY * newY) - (newX * newX)); // y - newX = newX > (offset + minRadius) ? (_master.getX() + newX) - offset : (_master.getX() - newX) + minRadius; - newY = newY > (offset + minRadius) ? (_master.getY() + newY) - offset : (_master.getY() - newY) + minRadius; + if (newX > (offset + minRadius)) + { + newX = (_master.getX() + newX) - offset; + } + else + { + newX = (_master.getX() - newX) + minRadius; + } + if (newY > (offset + minRadius)) + { + newY = (_master.getY() + newY) - offset; + } + else + { + newY = (_master.getY() - newY) + minRadius; + } minion.teleToLocation(new Location(newX, newY, _master.getZ())); } @@ -250,21 +221,6 @@ public class MinionList { return; } - // searching in reused minions - if (_reusedMinionReferences != null) - { - final L2MonsterInstance minion = _reusedMinionReferences.stream().filter(m -> (m.getId() == minionId)).findFirst().orElse(null); - if (minion != null) - { - DecayTaskManager.getInstance().cancel(minion); - minion.onDecay(); - _reusedMinionReferences.remove(minion); - minion.refreshID(); - initializeNpcInstance(_master, minion); - return; - } - } - // not found in cache spawnMinion(_master, minionId); } @@ -285,11 +241,6 @@ public class MinionList return; } - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.remove(_minion); - } - _minion.refreshID(); initializeNpcInstance(_master, _minion); } @@ -314,7 +265,12 @@ public class MinionList { // Get the template of the Minion to spawn final L2NpcTemplate minionTemplate = NpcData.getInstance().getTemplate(minionId); - return minionTemplate == null ? null : initializeNpcInstance(master, new L2MonsterInstance(minionTemplate)); + if (minionTemplate == null) + { + return null; + } + + return initializeNpcInstance(master, new L2MonsterInstance(minionTemplate)); } protected static L2MonsterInstance initializeNpcInstance(L2MonsterInstance master, L2MonsterInstance minion) @@ -340,8 +296,22 @@ public class MinionList int newX = Rnd.get(minRadius * 2, offset * 2); // x int newY = Rnd.get(newX, offset * 2); // distance newY = (int) Math.sqrt((newY * newY) - (newX * newX)); // y - newX = newX > (offset + minRadius) ? (master.getX() + newX) - offset : (master.getX() - newX) + minRadius; - newY = newY > (offset + minRadius) ? (master.getY() + newY) - offset : (master.getY() - newY) + minRadius; + if (newX > (offset + minRadius)) + { + newX = (master.getX() + newX) - offset; + } + else + { + newX = (master.getX() - newX) + minRadius; + } + if (newY > (offset + minRadius)) + { + newY = (master.getY() + newY) - offset; + } + else + { + newY = (master.getY() - newY) + minRadius; + } minion.spawnMe(newX, newY, master.getZ()); @@ -350,18 +320,26 @@ public class MinionList // Statistics part - private final long countSpawnedMinionsById(int minionId) + private final int countSpawnedMinionsById(int minionId) { - return _minionReferences.stream().filter(npc -> npc.getId() == minionId).count(); + int count = 0; + for (L2MonsterInstance minion : _spawnedMinions) + { + if ((minion != null) && (minion.getId() == minionId)) + { + count++; + } + } + return count; } public final int countSpawnedMinions() { - return _minionReferences.size(); + return _spawnedMinions.size(); } public final long lazyCountSpawnedMinionsGroups() { - return _minionReferences.stream().map(L2MonsterInstance::getId).distinct().count(); + return _spawnedMinions.stream().distinct().count(); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 81b89461fc..6fc8e2db7b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -509,13 +509,6 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable { npc.clearAggroList(); npc.getAttackByList().clear(); - if (npc.isMonster()) - { - if (((L2MonsterInstance) npc).hasMinions()) - { - ((L2MonsterInstance) npc).getMinionList().deleteReusedMinions(); - } - } } // Check if the mob should not return to spawn point diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index fe55288a3a..0985488e6d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -115,12 +115,6 @@ public class L2MonsterInstance extends L2Attackable getLeader().getMinionList().onMinionSpawn(this); } - // delete spawned minions before dynamic minions spawned by script - if (hasMinions()) - { - getMinionList().onMasterSpawn(); - } - startMaintenanceTask(); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/MinionList.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/MinionList.java index eafbd496c3..fda128217e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/MinionList.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/MinionList.java @@ -30,15 +30,12 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.holders.MinionHolder; /** - * @author luisantonioa, DS + * @author luisantonioa, DS, Mobius */ public class MinionList { protected final L2MonsterInstance _master; - /** List containing the current spawned minions */ - private final List _minionReferences = new CopyOnWriteArrayList<>(); - /** List containing the cached deleted minions for reuse */ - protected List _reusedMinionReferences = null; + private final List _spawnedMinions = new CopyOnWriteArrayList<>(); public MinionList(L2MonsterInstance pMaster) { @@ -54,7 +51,7 @@ public class MinionList */ public List getSpawnedMinions() { - return _minionReferences; + return _spawnedMinions; } /** @@ -69,13 +66,7 @@ public class MinionList */ public final void spawnMinions(List minions) { - if (_master.isAlikeDead()) - { - return; - } - - // List minions = _master.getParameters().getMinionList("Privates"); - if (minions == null) + if (_master.isAlikeDead() || (minions == null)) { return; } @@ -95,8 +86,6 @@ public class MinionList } } } - // remove non-needed minions - deleteReusedMinions(); } /** @@ -104,48 +93,17 @@ public class MinionList */ public void deleteSpawnedMinions() { - if (!_minionReferences.isEmpty()) + if (!_spawnedMinions.isEmpty()) { - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if (minion != null) { minion.setLeader(null); minion.deleteMe(); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } } } - _minionReferences.clear(); - } - } - - /** - * Delete all reused minions to prevent memory leaks. - */ - public void deleteReusedMinions() - { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.clear(); - } - } - - // hooks - - /** - * Called on the master spawn Old minions (from previous spawn) are deleted. If master can respawn - enabled reuse of the killed minions. - */ - public void onMasterSpawn() - { - deleteSpawnedMinions(); - - // if master has spawn and can respawn - try to reuse minions - if ((_reusedMinionReferences == null) && (_master.getParameters().getSet().get("SummonPrivateRate") == null) && !_master.getParameters().getMinionList("Privates").isEmpty() && (_master.getSpawn() != null) && _master.getSpawn().isRespawnEnabled()) - { - _reusedMinionReferences = new CopyOnWriteArrayList<>(); + _spawnedMinions.clear(); } } @@ -155,7 +113,7 @@ public class MinionList */ public void onMinionSpawn(L2MonsterInstance minion) { - _minionReferences.add(minion); + _spawnedMinions.add(minion); } /** @@ -178,11 +136,7 @@ public class MinionList public void onMinionDie(L2MonsterInstance minion, int respawnTime) { minion.setLeader(null); // prevent memory leaks - _minionReferences.remove(minion); - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.add(minion); - } + _spawnedMinions.remove(minion); final int time = respawnTime < 0 ? _master.isRaid() ? (int) Config.RAID_MINION_RESPAWN_TIMER : 0 : respawnTime; if ((time > 0) && !_master.isAlikeDead()) @@ -215,7 +169,7 @@ public class MinionList aggro *= 10; } - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && (callerIsMaster || !minion.isInCombat())) { @@ -232,7 +186,7 @@ public class MinionList final int offset = 200; final int minRadius = (int) _master.getCollisionRadius() + 30; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && !minion.isDead() && !minion.isMovementDisabled()) { @@ -267,20 +221,6 @@ public class MinionList { return; } - - // searching in reused minions - if (_reusedMinionReferences != null) - { - final L2MonsterInstance minion = _reusedMinionReferences.stream().filter(m -> (m.getId() == minionId)).findFirst().orElse(null); - if (minion != null) - { - _reusedMinionReferences.remove(minion); - minion.refreshID(); - initializeNpcInstance(_master, minion); - return; - } - } - // not found in cache spawnMinion(_master, minionId); } @@ -301,11 +241,6 @@ public class MinionList // minion can be already spawned or deleted if (!_minion.isSpawned()) { - if (_reusedMinionReferences != null) - { - _reusedMinionReferences.remove(_minion); - } - _minion.refreshID(); initializeNpcInstance(_master, _minion); } @@ -390,7 +325,7 @@ public class MinionList private final int countSpawnedMinionsById(int minionId) { int count = 0; - for (L2MonsterInstance minion : _minionReferences) + for (L2MonsterInstance minion : _spawnedMinions) { if ((minion != null) && (minion.getId() == minionId)) { @@ -402,11 +337,11 @@ public class MinionList public final int countSpawnedMinions() { - return _minionReferences.size(); + return _spawnedMinions.size(); } public final long lazyCountSpawnedMinionsGroups() { - return _minionReferences.stream().distinct().count(); + return _spawnedMinions.stream().distinct().count(); } }