Fix cannon cannonball count

This commit is contained in:
WooxSolo
2018-04-18 23:22:24 +02:00
parent 33ece1071b
commit 227eed522c

View File

@@ -67,7 +67,6 @@ 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;
@@ -236,16 +235,7 @@ 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;
}
} }
} }
@@ -256,8 +246,6 @@ 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!");