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