cannon: make onChatMessage use if/else

This commit is contained in:
Hydrox6
2021-09-10 02:33:06 +01:00
parent 342e0169e3
commit 67751b72a9

View File

@@ -320,8 +320,7 @@ public class CannonPlugin extends Plugin
} }
} }
} }
else if (event.getMessage().contains("You pick up the cannon")
if (event.getMessage().contains("You pick up the cannon")
|| event.getMessage().contains("Your cannon has decayed. Speak to Nulodion to get a new one!") || event.getMessage().contains("Your cannon has decayed. Speak to Nulodion to get a new one!")
|| event.getMessage().contains("Your cannon has been destroyed!")) || event.getMessage().contains("Your cannon has been destroyed!"))
{ {
@@ -329,8 +328,7 @@ public class CannonPlugin extends Plugin
cballsLeft = 0; cballsLeft = 0;
removeCounter(); removeCounter();
} }
else if (event.getMessage().startsWith("You load the cannon with"))
if (event.getMessage().startsWith("You load the cannon with"))
{ {
Matcher m = NUMBER_PATTERN.matcher(event.getMessage()); Matcher m = NUMBER_PATTERN.matcher(event.getMessage());
if (m.find()) if (m.find())
@@ -368,8 +366,7 @@ public class CannonPlugin extends Plugin
cannonBallNotificationSent = false; cannonBallNotificationSent = false;
} }
else if (event.getMessage().contains("Your cannon is out of ammo!"))
if (event.getMessage().contains("Your cannon is out of ammo!"))
{ {
skipProjectileCheckThisTick = true; skipProjectileCheckThisTick = true;
@@ -383,8 +380,7 @@ public class CannonPlugin extends Plugin
notifier.notify("Your cannon is out of ammo!"); notifier.notify("Your cannon is out of ammo!");
} }
} }
else if (event.getMessage().startsWith("Your cannon contains"))
if (event.getMessage().startsWith("Your cannon contains"))
{ {
Matcher m = NUMBER_PATTERN.matcher(event.getMessage()); Matcher m = NUMBER_PATTERN.matcher(event.getMessage());
if (m.find()) if (m.find())
@@ -392,8 +388,7 @@ public class CannonPlugin extends Plugin
cballsLeft = Integer.parseInt(m.group()); cballsLeft = Integer.parseInt(m.group());
} }
} }
else if (event.getMessage().startsWith("You unload your cannon and receive Cannonball")
if (event.getMessage().startsWith("You unload your cannon and receive Cannonball")
|| event.getMessage().startsWith("You unload your cannon and receive Granite cannonball")) || event.getMessage().startsWith("You unload your cannon and receive Granite cannonball"))
{ {
skipProjectileCheckThisTick = true; skipProjectileCheckThisTick = true;