Merge pull request #7621 from deathbeam/dots-are-lame
Remove anymatch regex from chat commands plugin patterns
This commit is contained in:
@@ -82,12 +82,12 @@ import org.apache.commons.text.WordUtils;
|
|||||||
public class ChatCommandsPlugin extends Plugin
|
public class ChatCommandsPlugin extends Plugin
|
||||||
{
|
{
|
||||||
private static final float HIGH_ALCHEMY_CONSTANT = 0.6f;
|
private static final float HIGH_ALCHEMY_CONSTANT = 0.6f;
|
||||||
private static final Pattern KILLCOUNT_PATTERN = Pattern.compile("Your (.+) kill count is: <col=ff0000>(\\d+)</col>.");
|
private static final Pattern KILLCOUNT_PATTERN = 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 RAIDS_PATTERN = Pattern.compile("Your completed (.+) count is: <col=ff0000>(\\d+)</col>");
|
||||||
private static final Pattern WINTERTODT_PATTERN = Pattern.compile("Your subdued Wintertodt count is: <col=ff0000>(\\d+)</col>.");
|
private static final Pattern WINTERTODT_PATTERN = Pattern.compile("Your subdued Wintertodt count is: <col=ff0000>(\\d+)</col>");
|
||||||
private static final Pattern BARROWS_PATTERN = Pattern.compile("Your Barrows chest count is: <col=ff0000>(\\d+)</col>.");
|
private static final Pattern BARROWS_PATTERN = Pattern.compile("Your Barrows chest count is: <col=ff0000>(\\d+)</col>");
|
||||||
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("Fight duration: <col=ff0000>[0-9:]+</col>. Personal best: ([0-9:]+).");
|
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("Fight duration: <col=ff0000>[0-9:]+</col>. Personal best: ([0-9:]+)");
|
||||||
private static final Pattern NEW_PB_PATTERN = Pattern.compile("Fight duration: <col=ff0000>([0-9:]+)</col> \\(new personal best\\).");
|
private static final Pattern NEW_PB_PATTERN = Pattern.compile("Fight duration: <col=ff0000>([0-9:]+)</col> \\(new personal best\\)");
|
||||||
private static final String TOTAL_LEVEL_COMMAND_STRING = "!total";
|
private static final String TOTAL_LEVEL_COMMAND_STRING = "!total";
|
||||||
private static final String PRICE_COMMAND_STRING = "!price";
|
private static final String PRICE_COMMAND_STRING = "!price";
|
||||||
private static final String LEVEL_COMMAND_STRING = "!lvl";
|
private static final String LEVEL_COMMAND_STRING = "!lvl";
|
||||||
|
|||||||
@@ -147,6 +147,23 @@ public class ChatCommandsPluginTest
|
|||||||
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(79));
|
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(79));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPersonalBestNoTrailingPeriod()
|
||||||
|
{
|
||||||
|
final String FIGHT_DURATION = "Fight duration: <col=ff0000>0:59</col>. Personal best: 0:55";
|
||||||
|
|
||||||
|
when(client.getUsername()).thenReturn("Adam");
|
||||||
|
|
||||||
|
// This sets lastBoss
|
||||||
|
ChatMessage chatMessage = new ChatMessage(SERVER, "", "Your Zulrah kill count is: <col=ff0000>4</col>.", null);
|
||||||
|
chatCommandsPlugin.onChatMessage(chatMessage);
|
||||||
|
|
||||||
|
chatMessage = new ChatMessage(SERVER, "", FIGHT_DURATION, null);
|
||||||
|
chatCommandsPlugin.onChatMessage(chatMessage);
|
||||||
|
|
||||||
|
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("zulrah"), eq(55));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNewPersonalBest()
|
public void testNewPersonalBest()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user