diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bd1735f879..d710e9d91c 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -891,6 +891,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -988,13 +990,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -1006,14 +1005,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bd1735f879..d710e9d91c 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -891,6 +891,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -988,13 +990,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -1006,14 +1005,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bd1735f879..d710e9d91c 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -891,6 +891,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -988,13 +990,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -1006,14 +1005,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bd1735f879..d710e9d91c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -891,6 +891,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -988,13 +990,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -1006,14 +1005,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bd1735f879..d710e9d91c 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -891,6 +891,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -988,13 +990,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -1006,14 +1005,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bd1735f879..d710e9d91c 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -891,6 +891,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -988,13 +990,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -1006,14 +1005,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bd1735f879..d710e9d91c 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -891,6 +891,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -988,13 +990,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -1006,14 +1005,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bd1735f879..d710e9d91c 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -891,6 +891,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -988,13 +990,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -1006,14 +1005,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bffe6681a9..c1e143dae4 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -881,6 +881,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -978,13 +980,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -996,14 +995,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bffe6681a9..c1e143dae4 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -881,6 +881,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -978,13 +980,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -996,14 +995,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bffe6681a9..c1e143dae4 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -881,6 +881,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -978,13 +980,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -996,14 +995,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bffe6681a9..c1e143dae4 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -881,6 +881,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -978,13 +980,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -996,14 +995,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bffe6681a9..c1e143dae4 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -881,6 +881,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -978,13 +980,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -996,14 +995,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bffe6681a9..c1e143dae4 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -881,6 +881,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -978,13 +980,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -996,14 +995,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast) diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index bffe6681a9..c1e143dae4 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -881,6 +881,8 @@ public class CreatureStat */ public void recalculateStats(boolean broadcast) { + Set changed = null; + // Copy old data before wiping it out final Map adds; final Map muls; @@ -978,13 +980,10 @@ public class CreatureStat _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); - // Notify recalculation to child classes - onRecalculateStats(broadcast); - if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow. { // Calculate the difference between old and new stats - final Set changed = new HashSet<>(); + changed = new HashSet<>(); for (Stat stat : Stat.values()) { if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue())) @@ -996,14 +995,20 @@ public class CreatureStat changed.add(stat); } } - - _creature.broadcastModifiedStats(changed); } } finally { _lock.writeLock().unlock(); } + + if (changed != null) + { + _creature.broadcastModifiedStats(changed); + } + + // Notify recalculation to child classes + onRecalculateStats(broadcast); } protected void onRecalculateStats(boolean broadcast)