-Misc clean up/refactor.
-Removed unnecessary Map.containsKey calls
-Using java 8 methods where possible to avoid external checks.
Source L2J HighFive branch:
9d0fee8537
This commit is contained in:
@ -426,16 +426,8 @@ public class L2Attackable extends L2Npc
|
||||
totalDamage += damage;
|
||||
|
||||
// Calculate real damages (Summoners should get own damage plus summon's damage)
|
||||
DamageDoneInfo reward = rewards.get(attacker);
|
||||
if (reward == null)
|
||||
{
|
||||
reward = new DamageDoneInfo(attacker, damage);
|
||||
rewards.put(attacker, reward);
|
||||
}
|
||||
else
|
||||
{
|
||||
reward.addDamage(damage);
|
||||
}
|
||||
final DamageDoneInfo reward = rewards.computeIfAbsent(attacker, DamageDoneInfo::new);
|
||||
reward.addDamage(damage);
|
||||
|
||||
if (reward.getDamage() > maxDamage)
|
||||
{
|
||||
@ -710,12 +702,7 @@ public class L2Attackable extends L2Npc
|
||||
|
||||
final L2PcInstance targetPlayer = attacker.getActingPlayer();
|
||||
// Get the AggroInfo of the attacker L2Character from the _aggroList of the L2Attackable
|
||||
AggroInfo ai = getAggroList().get(attacker);
|
||||
if (ai == null)
|
||||
{
|
||||
ai = new AggroInfo(attacker);
|
||||
getAggroList().put(attacker, ai);
|
||||
}
|
||||
final AggroInfo ai = getAggroList().computeIfAbsent(attacker, AggroInfo::new);
|
||||
ai.addDamage(damage);
|
||||
// traps does not cause aggro
|
||||
// making this hack because not possible to determine if damage made by trap
|
||||
|
@ -22,6 +22,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.logging.Level;
|
||||
@ -1015,10 +1016,7 @@ public class L2PetInstance extends L2Summon
|
||||
}
|
||||
|
||||
// Clear list for overwrite
|
||||
if (SummonEffectsTable.getInstance().getPetEffects().containsKey(getControlObjectId()))
|
||||
{
|
||||
SummonEffectsTable.getInstance().getPetEffects().get(getControlObjectId()).clear();
|
||||
}
|
||||
SummonEffectsTable.getInstance().getPetEffects().getOrDefault(getControlObjectId(), Collections.emptyList()).clear();
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||
|
@ -22,6 +22,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -282,9 +283,9 @@ public class L2ServitorInstance extends L2Summon implements Runnable
|
||||
}
|
||||
|
||||
// Clear list for overwrite
|
||||
if (SummonEffectsTable.getInstance().getServitorEffectsOwner().containsKey(getOwner().getObjectId()) && SummonEffectsTable.getInstance().getServitorEffectsOwner().get(getOwner().getObjectId()).containsKey(getOwner().getClassIndex()) && SummonEffectsTable.getInstance().getServitorEffects(getOwner()).containsKey(getReferenceSkill()))
|
||||
if (SummonEffectsTable.getInstance().getServitorEffectsOwner().getOrDefault(getOwner().getObjectId(), Collections.emptyMap()).containsKey(getOwner().getClassIndex()))
|
||||
{
|
||||
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).get(getReferenceSkill()).clear();
|
||||
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).getOrDefault(getReferenceSkill(), Collections.emptyList()).clear();
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
|
Reference in New Issue
Block a user