Split Valuable and Untradeable screenshot options (#7167)
This commit is contained in:
@@ -157,7 +157,7 @@ public interface ScreenshotConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "valuableDrop",
|
keyName = "valuableDrop",
|
||||||
name = "Screenshot Valuable drops",
|
name = "Screenshot Valuable drops",
|
||||||
description = "Configures whether or not screenshots are automatically taken when you receive a valuable/untradeable drop.",
|
description = "Configures whether or not screenshots are automatically taken when you receive a valuable drop.",
|
||||||
position = 11
|
position = 11
|
||||||
)
|
)
|
||||||
default boolean screenshotValuableDrop()
|
default boolean screenshotValuableDrop()
|
||||||
@@ -165,11 +165,22 @@ public interface ScreenshotConfig extends Config
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "untradeableDrop",
|
||||||
|
name = "Screenshot Untradeable drops",
|
||||||
|
description = "Configures whether or not screenshots are automatically taken when you receive an untradeable drop.",
|
||||||
|
position = 12
|
||||||
|
)
|
||||||
|
default boolean screenshotUntradeableDrop()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "hotkey",
|
keyName = "hotkey",
|
||||||
name = "Screenshot hotkey",
|
name = "Screenshot hotkey",
|
||||||
description = "When you press this key a screenshot will be taken",
|
description = "When you press this key a screenshot will be taken",
|
||||||
position = 12
|
position = 13
|
||||||
)
|
)
|
||||||
default Keybind hotkey()
|
default Keybind hotkey()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -121,7 +121,8 @@ public class ScreenshotPlugin 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 Pattern LEVEL_UP_PATTERN = Pattern.compile(".*Your ([a-zA-Z]+) (?:level is|are)? now (\\d+)\\.");
|
private static final Pattern LEVEL_UP_PATTERN = Pattern.compile(".*Your ([a-zA-Z]+) (?:level is|are)? now (\\d+)\\.");
|
||||||
private static final Pattern BOSSKILL_MESSAGE_PATTERN = Pattern.compile("Your (.+) kill count is: <col=ff0000>(\\d+)</col>.");
|
private static final Pattern BOSSKILL_MESSAGE_PATTERN = Pattern.compile("Your (.+) kill count is: <col=ff0000>(\\d+)</col>.");
|
||||||
private static final Pattern VALUABLE_DROP_PATTERN = Pattern.compile(".*(Valuable|Untradeable) drop: ([^<>]+)(?:</col>)?");
|
private static final Pattern VALUABLE_DROP_PATTERN = Pattern.compile(".*Valuable drop: ([^<>]+)(?:</col>)?");
|
||||||
|
private static final Pattern UNTRADEABLE_DROP_PATTERN = Pattern.compile(".*Untradeable drop: ([^<>]+)(?:</col>)?");
|
||||||
private static final ImmutableList<String> PET_MESSAGES = ImmutableList.of("You have a funny feeling like you're being followed",
|
private static final ImmutableList<String> PET_MESSAGES = ImmutableList.of("You have a funny feeling like you're being followed",
|
||||||
"You feel something weird sneaking into your backpack",
|
"You feel something weird sneaking into your backpack",
|
||||||
"You have a funny feeling like you would have been followed");
|
"You have a funny feeling like you would have been followed");
|
||||||
@@ -375,9 +376,19 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
Matcher m = VALUABLE_DROP_PATTERN.matcher(chatMessage);
|
Matcher m = VALUABLE_DROP_PATTERN.matcher(chatMessage);
|
||||||
if (m.matches())
|
if (m.matches())
|
||||||
{
|
{
|
||||||
String valuableDropType = m.group(1);
|
String valuableDropName = m.group(1);
|
||||||
String valuableDropName = m.group(2);
|
String fileName = "Valuable drop " + valuableDropName + " " + format(new Date());
|
||||||
String fileName = valuableDropType + " drop " + valuableDropName + " " + format(new Date());
|
takeScreenshot(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.screenshotUntradeableDrop())
|
||||||
|
{
|
||||||
|
Matcher m = UNTRADEABLE_DROP_PATTERN.matcher(chatMessage);
|
||||||
|
if (m.matches())
|
||||||
|
{
|
||||||
|
String untradeableDropName = m.group(1);
|
||||||
|
String fileName = "Untradeable drop " + untradeableDropName + " " + format(new Date());
|
||||||
takeScreenshot(fileName);
|
takeScreenshot(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public class ScreenshotPluginTest
|
|||||||
when(screenshotConfig.screenshotRewards()).thenReturn(true);
|
when(screenshotConfig.screenshotRewards()).thenReturn(true);
|
||||||
when(screenshotConfig.screenshotLevels()).thenReturn(true);
|
when(screenshotConfig.screenshotLevels()).thenReturn(true);
|
||||||
when(screenshotConfig.screenshotValuableDrop()).thenReturn(true);
|
when(screenshotConfig.screenshotValuableDrop()).thenReturn(true);
|
||||||
|
when(screenshotConfig.screenshotUntradeableDrop()).thenReturn(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user