Merge pull request #193 from runelite-extended/cannon

Fix Cannon Notifier Spam
This commit is contained in:
Kyleeld
2019-05-07 00:47:10 +01:00
committed by GitHub

View File

@@ -118,6 +118,8 @@ public class CannonPlugin extends Plugin
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
private boolean lock;
@Provides @Provides
CannonConfig provideConfig(ConfigManager configManager) CannonConfig provideConfig(ConfigManager configManager)
{ {
@@ -129,6 +131,7 @@ public class CannonPlugin extends Plugin
{ {
overlayManager.add(cannonOverlay); overlayManager.add(cannonOverlay);
overlayManager.add(cannonSpotOverlay); overlayManager.add(cannonSpotOverlay);
lock = false;
} }
@Override @Override
@@ -139,6 +142,7 @@ public class CannonPlugin extends Plugin
overlayManager.remove(cannonSpotOverlay); overlayManager.remove(cannonSpotOverlay);
cannonPlaced = false; cannonPlaced = false;
cannonPosition = null; cannonPosition = null;
lock = false;
cballsLeft = 0; cballsLeft = 0;
removeCounter(); removeCounter();
skipProjectileCheckThisTick = false; skipProjectileCheckThisTick = false;
@@ -373,6 +377,7 @@ public class CannonPlugin extends Plugin
{ {
if (cballsLeft > 15) if (cballsLeft > 15)
{ {
lock = false;
return Color.green; return Color.green;
} }
else if (cballsLeft > 5) else if (cballsLeft > 5)
@@ -381,9 +386,10 @@ public class CannonPlugin extends Plugin
} }
else if (cballsLeft <= config.ammoAmount()) else if (cballsLeft <= config.ammoAmount())
{ {
if (config.notifyAmmoLeft()) if (config.notifyAmmoLeft() && !lock)
{ {
notifier.notify("Your cannon has " + config.ammoAmount() + " balls left!"); notifier.notify("Your cannon has " + config.ammoAmount() + " balls left!");
lock = true;
} }
} }