chat commands: count barrows chests too

This commit is contained in:
Adam
2018-07-13 18:39:22 -04:00
parent 94fe9de7e0
commit a52b811af1
2 changed files with 20 additions and 0 deletions

View File

@@ -79,6 +79,7 @@ public class ChatCommandsPlugin extends Plugin implements ChatboxInputListener
private static final Pattern KILLCOUNT_PATERN = Pattern.compile("Your (.+) kill count is: <col=ff0000>(\\d+)</col>.");
private static final Pattern RAIDS_PATTERN = Pattern.compile("Your completed (.+) count is: <col=ff0000>(\\d+)</col>.");
private static final Pattern WINTERTODT_PATERN = Pattern.compile("Your subdued Wintertodt count is: <col=ff0000>(\\d+)</col>.");
private static final Pattern BARROWS_PATERN = Pattern.compile("Your Barrows chest count is: <col=ff0000>(\\d+)</col>.");
private final HiscoreClient hiscoreClient = new HiscoreClient();
private final KillCountClient killCountClient = new KillCountClient();
@@ -248,6 +249,14 @@ public class ChatCommandsPlugin extends Plugin implements ChatboxInputListener
setKc(boss, kc);
}
matcher = BARROWS_PATERN.matcher(message);
if (matcher.find())
{
int kc = Integer.parseInt(matcher.group(1));
setKc("Barrows", kc);
}
}
@Override

View File

@@ -117,4 +117,15 @@ public class ChatCommandsPluginTest
verify(configManager).setConfiguration("killcount.adam", "kree'arra", 4);
}
@Test
public void testBarrows()
{
when(client.getUsername()).thenReturn("Adam");
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "", "Your Barrows chest count is: <col=ff0000>277</col>.", null);
chatCommandsPlugin.onChatMessage(chatMessageEvent);
verify(configManager).setConfiguration("killcount.adam", "barrows", 277);
}
}