-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:
mobius
2015-02-09 13:49:08 +00:00
parent 2dd69863cc
commit f9a65fe3c1
13 changed files with 36 additions and 99 deletions

View File

@@ -95,22 +95,8 @@ public class RaidBossPointsManager
public final void addPoints(L2PcInstance player, int bossId, int points)
{
int ownerId = player.getObjectId();
Map<Integer, Integer> tmpPoint = _list.get(ownerId);
if (tmpPoint == null)
{
tmpPoint = new HashMap<>();
tmpPoint.put(bossId, points);
updatePointsInDB(player, bossId, points);
}
else
{
int currentPoins = tmpPoint.containsKey(bossId) ? tmpPoint.get(bossId) : 0;
currentPoins += points;
tmpPoint.put(bossId, currentPoins);
updatePointsInDB(player, bossId, currentPoins);
}
_list.put(ownerId, tmpPoint);
final Map<Integer, Integer> tmpPoint = _list.computeIfAbsent(player.getObjectId(), k -> new HashMap<>());
updatePointsInDB(player, bossId, tmpPoint.merge(bossId, points, Integer::sum));
}
public final int getPointsByOwnerId(int ownerId)