Skip to content

Commit

Permalink
screenshot plugin: screenshot pvp kills
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Jun 4, 2018
1 parent f72071f commit 18ee215
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,15 @@ default boolean isScreenshotEnabled()
{
return false;
}

@ConfigItem(
keyName = "kills",
name = "Screenshot PvP Kills",
description = "Configures whether or not screenshots are automatically taken of PvP kills",
position = 9
)
default boolean screenshotKills()
{
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ public class ScreenshotPlugin extends Plugin
"You feel something weird sneaking into your backpack",
"You have a funny feeling like you would have been followed");

private static final ImmutableList<String> KILL_MESSAGES = ImmutableList.of("into tiny pieces and sat on them", "you have obliterated",
"falls before your might", "A humiliating defeat for", "With a crushing blow you", "thinking challenging you",
"Can anyone defeat you? Certainly", "was no match for you", "You were clearly a better fighter than", "RIP",
"You have defeated", "What an embarrassing performance by", "was no match for your awesomeness");

private String clueType;
private Integer clueNumber;

Expand Down Expand Up @@ -258,6 +263,12 @@ public void onChatMessage(ChatMessage event)
String fileName = "Pet " + TIME_FORMAT.format(new Date());
takeScreenshot(fileName);
}

if (config.screenshotKills() && KILL_MESSAGES.stream().anyMatch(chatMessage::contains))
{
String fileName = "Kill " + " " + LocalDate.now();
takeScreenshot(fileName);
}
}

@Subscribe
Expand Down

0 comments on commit 18ee215

Please sign in to comment.