theatre: Use efficient entrySets

This commit is contained in:
sdburns1998
2019-07-07 21:35:45 +02:00
parent c12232a4cb
commit d668d4113a
3 changed files with 16 additions and 16 deletions

View File

@@ -152,11 +152,11 @@ public class NyloHandler extends RoomHandler
{ {
if (plugin.isShowNyloPillarHealth()) if (plugin.isShowNyloPillarHealth())
{ {
for (NPC npc : pillars.keySet()) for (Map.Entry<NPC, Integer> pillars : pillars.entrySet())
{ {
final int health = pillars.get(npc); final int health = pillars.getValue();
final String healthStr = health + "%"; final String healthStr = health + "%";
WorldPoint p = npc.getWorldLocation(); WorldPoint p = pillars.getKey().getWorldLocation();
LocalPoint lp = LocalPoint.fromWorld(client, p.getX() + 1, p.getY() + 1); LocalPoint lp = LocalPoint.fromWorld(client, p.getX() + 1, p.getY() + 1);
Color c = this.healthColorCode(health); Color c = this.healthColorCode(health);
@@ -172,15 +172,15 @@ public class NyloHandler extends RoomHandler
switch (plugin.getShowNylocasExplosions()) switch (plugin.getShowNylocasExplosions())
{ {
case TILE: case TILE:
for (NPC npc : spiders.keySet()) for (Map.Entry<NPC, Integer> spiders : spiders.entrySet())
{ {
int ticksLeft = spiders.get(npc); int ticksLeft = spiders.getValue();
if (ticksLeft > -1 && ticksLeft < 6) if (ticksLeft > -1 && ticksLeft < 6)
{ {
Color color = new Color(255, 255, 0, 180); Color color = new Color(255, 255, 0, 180);
int outlineWidth = 2; int outlineWidth = 2;
int outlineAlpha = 150; int outlineAlpha = 150;
renderNpcOverlay(graphics, npc, color, outlineWidth, outlineAlpha, 15); renderNpcOverlay(graphics, spiders.getKey(), color, outlineWidth, outlineAlpha, 15);
} }
} }
break; break;

View File

@@ -152,18 +152,18 @@ public class NyloPredictor
handler.setWave(currentIndex); handler.setWave(currentIndex);
System.out.println("Nylocas Wave #" + currentIndex + " has spawned @ " + (this.client.getTickCount() - this.handler.startTick) + " | " + npcs.size() + " size."); System.out.println("Nylocas Wave #" + currentIndex + " has spawned @ " + (this.client.getTickCount() - this.handler.startTick) + " | " + npcs.size() + " size.");
for (NPC npc : npcs.keySet()) for (Map.Entry<NPC, Nylocas> nylocas : npcs.entrySet())
{ {
Nylocas nylo = npcs.get(npc); Nylocas nylo = nylocas.getValue();
if (!this.handler.waveSpawns.contains(npc)) if (!this.handler.waveSpawns.contains(nylocas.getKey()))
{ {
this.handler.waveSpawns.add(npc); this.handler.waveSpawns.add(nylocas.getKey());
} }
if (this.isAgressive(nylo.getType(), nylo.getSpawn(), currentIndex) && !this.handler.waveAgros.contains(npc)) if (this.isAgressive(nylo.getType(), nylo.getSpawn(), currentIndex) && !this.handler.waveAgros.contains(nylocas.getKey()))
{ {
this.handler.waveAgros.add(npc); this.handler.waveAgros.add(nylocas.getKey());
} }
} }

View File

@@ -134,9 +134,9 @@ public class XarpusHandler extends RoomHandler
if (npc.getId() == NpcID.XARPUS_8339 && plugin.isShowXarpusHeals()) if (npc.getId() == NpcID.XARPUS_8339 && plugin.isShowXarpusHeals())
{ {
for (GroundObject o : exhumes.keySet()) for (Map.Entry<GroundObject, Integer> exhum : exhumes.entrySet())
{ {
Polygon poly = o.getCanvasTilePoly(); Polygon poly = exhum.getKey().getCanvasTilePoly();
if (poly != null) if (poly != null)
{ {
Color c = new Color(0, 255, 0, 130); Color c = new Color(0, 255, 0, 130);
@@ -144,8 +144,8 @@ public class XarpusHandler extends RoomHandler
graphics.setStroke(new BasicStroke(1)); graphics.setStroke(new BasicStroke(1));
graphics.draw(poly); graphics.draw(poly);
String count = Integer.toString(exhumes.get(o) + 1); String count = Integer.toString(exhum.getValue() + 1);
LocalPoint lp = o.getLocalLocation(); LocalPoint lp = exhum.getKey().getLocalLocation();
Point point = Perspective.getCanvasTextLocation(client, graphics, lp, count, 0); Point point = Perspective.getCanvasTextLocation(client, graphics, lp, count, 0);
if (point != null) if (point != null)
{ {