fishingspot: don't expose spots map

This commit is contained in:
Adam
2019-08-20 19:46:16 -04:00
parent 9fc04bf7e2
commit d8be3b85cf
4 changed files with 10 additions and 6 deletions

View File

@@ -217,7 +217,7 @@ public class FishingPlugin extends Plugin
} }
final NPC npc = (NPC) target; final NPC npc = (NPC) target;
FishingSpot spot = FishingSpot.getSPOTS().get(npc.getId()); FishingSpot spot = FishingSpot.findSpot(npc.getId());
if (spot == null) if (spot == null)
{ {
@@ -289,7 +289,7 @@ public class FishingPlugin extends Plugin
for (NPC npc : fishingSpots) for (NPC npc : fishingSpots)
{ {
if (FishingSpot.getSPOTS().get(npc.getId()) == FishingSpot.MINNOW && config.showMinnowOverlay()) if (FishingSpot.findSpot(npc.getId()) == FishingSpot.MINNOW && config.showMinnowOverlay())
{ {
final int id = npc.getIndex(); final int id = npc.getIndex();
final MinnowSpot minnowSpot = minnowSpots.get(id); final MinnowSpot minnowSpot = minnowSpots.get(id);
@@ -315,7 +315,7 @@ public class FishingPlugin extends Plugin
{ {
final NPC npc = event.getNpc(); final NPC npc = event.getNpc();
if (!FishingSpot.getSPOTS().containsKey(npc.getId())) if (FishingSpot.findSpot(npc.getId()) == null)
{ {
return; return;
} }

View File

@@ -172,7 +172,6 @@ enum FishingSpot
COMMON_TENCH("Common tench, Bluegill, Greater siren, Mottled eel", ItemID.COMMON_TENCH, COMMON_TENCH("Common tench, Bluegill, Greater siren, Mottled eel", ItemID.COMMON_TENCH,
FISHING_SPOT_8523); FISHING_SPOT_8523);
@Getter
private static final Map<Integer, FishingSpot> SPOTS; private static final Map<Integer, FishingSpot> SPOTS;
private final String name; private final String name;
@@ -200,4 +199,9 @@ enum FishingSpot
this.fishSpriteId = fishSpriteId; this.fishSpriteId = fishSpriteId;
this.ids = ids; this.ids = ids;
} }
static FishingSpot findSpot(int id)
{
return SPOTS.get(id);
}
} }

View File

@@ -64,7 +64,7 @@ class FishingSpotMinimapOverlay extends Overlay
for (NPC npc : plugin.getFishingSpots()) for (NPC npc : plugin.getFishingSpots())
{ {
FishingSpot spot = FishingSpot.getSPOTS().get(npc.getId()); FishingSpot spot = FishingSpot.findSpot(npc.getId());
if (spot == null) if (spot == null)
{ {

View File

@@ -86,7 +86,7 @@ class FishingSpotOverlay extends Overlay
WorldPoint previousLocation = null; WorldPoint previousLocation = null;
for (NPC npc : plugin.getFishingSpots()) for (NPC npc : plugin.getFishingSpots())
{ {
FishingSpot spot = FishingSpot.getSPOTS().get(npc.getId()); FishingSpot spot = FishingSpot.findSpot(npc.getId());
if (spot == null) if (spot == null)
{ {