combatcounter: Don't access map more than needed
This commit is contained in:
@@ -96,17 +96,18 @@ class CombatOverlay extends Overlay
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String name : map.keySet())
|
for (Map.Entry<String, Long> counter : map.entrySet())
|
||||||
{
|
{
|
||||||
|
String name = counter.getKey();
|
||||||
if (client.getLocalPlayer().getName().contains(name))
|
if (client.getLocalPlayer().getName().contains(name))
|
||||||
{
|
{
|
||||||
tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getSelfColor()), ColorUtil.prependColorTag(Long.toString(map.get(name)), plugin.getSelfColor()));
|
tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getSelfColor()), ColorUtil.prependColorTag(Long.toString(counter.getValue()), plugin.getSelfColor()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getOtherColor()), ColorUtil.prependColorTag(Long.toString(map.get(name)), plugin.getOtherColor()));
|
tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getOtherColor()), ColorUtil.prependColorTag(Long.toString(counter.getValue()), plugin.getOtherColor()));
|
||||||
}
|
}
|
||||||
total += map.get(name);
|
total += counter.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!map.containsKey(local.getName()))
|
if (!map.containsKey(local.getName()))
|
||||||
|
|||||||
@@ -97,16 +97,16 @@ class DamageOverlay extends Overlay
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String name : map.keySet())
|
for (Map.Entry<String, Double> damage : map.entrySet())
|
||||||
{
|
{
|
||||||
String val = String.format("%.1f", map.get(name));
|
String val = String.format("%.1f", damage.getValue());
|
||||||
if (client.getLocalPlayer().getName().contains(name))
|
if (client.getLocalPlayer().getName().contains(damage.getKey()))
|
||||||
{
|
{
|
||||||
tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getSelfColor()), ColorUtil.prependColorTag(val, plugin.getSelfColor()));
|
tableComponent.addRow(ColorUtil.prependColorTag(damage.getKey(), plugin.getSelfColor()), ColorUtil.prependColorTag(val, plugin.getSelfColor()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getOtherColor()), ColorUtil.prependColorTag(val, plugin.getOtherColor()));
|
tableComponent.addRow(ColorUtil.prependColorTag(damage.getKey(), plugin.getOtherColor()), ColorUtil.prependColorTag(val, plugin.getOtherColor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user