Make cannon plugin use hidden instead of manager
Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -128,11 +128,13 @@ public class CannonPlugin extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(cannonOverlay);
|
||||
overlayManager.add(cannonSpotOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
cannonSpotOverlay.setHidden(true);
|
||||
overlayManager.remove(cannonOverlay);
|
||||
overlayManager.remove(cannonSpotOverlay);
|
||||
cannonPlaced = false;
|
||||
@@ -190,14 +192,7 @@ public class CannonPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (hasAll)
|
||||
{
|
||||
overlayManager.add(cannonSpotOverlay);
|
||||
}
|
||||
else
|
||||
{
|
||||
overlayManager.remove(cannonSpotOverlay);
|
||||
}
|
||||
cannonSpotOverlay.setHidden(!hasAll);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -30,6 +30,8 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.ItemID.CANNONBALL;
|
||||
import net.runelite.api.Perspective;
|
||||
@@ -52,6 +54,9 @@ public class CannonSpotOverlay extends Overlay
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean hidden;
|
||||
|
||||
@Inject
|
||||
CannonSpotOverlay(Client client, CannonPlugin plugin, CannonConfig config)
|
||||
{
|
||||
@@ -64,7 +69,7 @@ public class CannonSpotOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!config.showCannonSpots() || plugin.isCannonPlaced())
|
||||
if (hidden || !config.showCannonSpots() || plugin.isCannonPlaced())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user