Revert "Fix cannon cannonball count"

This reverts commit 9d215b4b285711e511997157b944a2fb745b873e.
This commit is contained in:
Adam
2018-04-28 17:21:20 -04:00
parent f8ac1f18b5
commit 7c8db8025e

View File

@@ -67,6 +67,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
public class CannonPlugin extends Plugin public class CannonPlugin extends Plugin
{ {
private static final Pattern NUMBER_PATTERN = Pattern.compile("([0-9]+)"); private static final Pattern NUMBER_PATTERN = Pattern.compile("([0-9]+)");
private static final int MAX_CBALLS = 30;
private CannonCounter counter; private CannonCounter counter;
@@ -235,7 +236,16 @@ public class CannonPlugin extends Plugin
if (m.find()) if (m.find())
{ {
int amt = Integer.valueOf(m.group()); int amt = Integer.valueOf(m.group());
cballsLeft += amt;
// make sure cballs doesn't go above MAX_CBALLS
if (amt + cballsLeft > MAX_CBALLS)
{
cballsLeft = MAX_CBALLS;
}
else
{
cballsLeft += amt;
}
} }
} }
@@ -246,6 +256,8 @@ public class CannonPlugin extends Plugin
if (event.getMessage().contains("Your cannon is out of ammo!")) if (event.getMessage().contains("Your cannon is out of ammo!"))
{ {
cballsLeft = 0;
if (config.showEmptyCannonNotification()) if (config.showEmptyCannonNotification())
{ {
notifier.notify("Your cannon is out of ammo!"); notifier.notify("Your cannon is out of ammo!");