Make fishing overlays use hidden instead of manager
Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -114,12 +114,16 @@ public class FishingPlugin extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.add(spotOverlay);
|
||||
overlayManager.add(fishingSpotMinimapOverlay);
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
spotOverlay.setHidden(true);
|
||||
fishingSpotMinimapOverlay.setHidden(true);
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.remove(spotOverlay);
|
||||
overlayManager.remove(fishingSpotMinimapOverlay);
|
||||
@@ -139,16 +143,8 @@ public class FishingPlugin extends Plugin
|
||||
|| canPlayerFish(client.getItemContainer(InventoryID.INVENTORY))
|
||||
|| canPlayerFish(client.getItemContainer(InventoryID.EQUIPMENT));
|
||||
|
||||
if (showOverlays)
|
||||
{
|
||||
overlayManager.add(spotOverlay);
|
||||
overlayManager.add(fishingSpotMinimapOverlay);
|
||||
}
|
||||
else
|
||||
{
|
||||
overlayManager.remove(spotOverlay);
|
||||
overlayManager.remove(fishingSpotMinimapOverlay);
|
||||
}
|
||||
spotOverlay.setHidden(!showOverlays);
|
||||
fishingSpotMinimapOverlay.setHidden(!showOverlays);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -162,8 +158,8 @@ public class FishingPlugin extends Plugin
|
||||
if (event.getMessage().contains("You catch a") || event.getMessage().contains("You catch some"))
|
||||
{
|
||||
session.setLastFishCaught(Instant.now());
|
||||
overlayManager.add(spotOverlay);
|
||||
overlayManager.add(fishingSpotMinimapOverlay);
|
||||
spotOverlay.setHidden(false);
|
||||
fishingSpotMinimapOverlay.setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.GraphicID;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -39,6 +41,9 @@ class FishingSpotMinimapOverlay extends Overlay
|
||||
{
|
||||
private final FishingPlugin plugin;
|
||||
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean hidden;
|
||||
|
||||
@Inject
|
||||
public FishingSpotMinimapOverlay(FishingPlugin plugin)
|
||||
{
|
||||
@@ -50,6 +55,11 @@ class FishingSpotMinimapOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (hidden)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
NPC[] fishingSpots = plugin.getFishingSpots();
|
||||
if (fishingSpots == null)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,8 @@ import java.awt.image.BufferedImage;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GraphicID;
|
||||
import net.runelite.api.NPC;
|
||||
@@ -54,6 +56,9 @@ class FishingSpotOverlay extends Overlay
|
||||
private final Client client;
|
||||
private final ItemManager itemManager;
|
||||
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean hidden;
|
||||
|
||||
@Inject
|
||||
private FishingSpotOverlay(FishingPlugin plugin, FishingConfig config, Client client, ItemManager itemManager)
|
||||
{
|
||||
@@ -68,6 +73,11 @@ class FishingSpotOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (hidden)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
NPC[] fishingSpots = plugin.getFishingSpots();
|
||||
if (fishingSpots == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user