screenshot plugin: add friend/clan member death screenshotting

This commit is contained in:
HSJ-OSRS
2019-11-11 19:41:44 +00:00
committed by Adam
parent 3fd8fb79aa
commit b565f29049
2 changed files with 22 additions and 6 deletions

View File

@@ -153,11 +153,22 @@ public interface ScreenshotConfig extends Config
return false; return false;
} }
@ConfigItem(
keyName = "friendDeath",
name = "Screenshot Friend Deaths",
description = "Configures whether or not screenshots are automatically taken when friends or clan members die.",
position = 11
)
default boolean screenshotFriendDeath()
{
return false;
}
@ConfigItem( @ConfigItem(
keyName = "duels", keyName = "duels",
name = "Screenshot Duels", name = "Screenshot Duels",
description = "Configures whether or not screenshots are automatically taken of the duel end screen.", description = "Configures whether or not screenshots are automatically taken of the duel end screen.",
position = 11 position = 12
) )
default boolean screenshotDuels() default boolean screenshotDuels()
{ {
@@ -168,7 +179,7 @@ public interface ScreenshotConfig extends Config
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 drop.", description = "Configures whether or not screenshots are automatically taken when you receive a valuable drop.",
position = 12 position = 13
) )
default boolean screenshotValuableDrop() default boolean screenshotValuableDrop()
{ {
@@ -179,7 +190,7 @@ public interface ScreenshotConfig extends Config
keyName = "untradeableDrop", keyName = "untradeableDrop",
name = "Screenshot Untradeable drops", name = "Screenshot Untradeable drops",
description = "Configures whether or not screenshots are automatically taken when you receive an untradeable drop.", description = "Configures whether or not screenshots are automatically taken when you receive an untradeable drop.",
position = 13 position = 14
) )
default boolean screenshotUntradeableDrop() default boolean screenshotUntradeableDrop()
{ {
@@ -190,10 +201,10 @@ public interface ScreenshotConfig extends Config
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 = 14 position = 15
) )
default Keybind hotkey() default Keybind hotkey()
{ {
return Keybind.NOT_SET; return Keybind.NOT_SET;
} }
} }

View File

@@ -281,10 +281,15 @@ public class ScreenshotPlugin extends Plugin
@Subscribe @Subscribe
public void onPlayerDeath(PlayerDeath playerDeath) public void onPlayerDeath(PlayerDeath playerDeath)
{ {
if (playerDeath.getPlayer() == client.getLocalPlayer() && config.screenshotPlayerDeath()) Player player = playerDeath.getPlayer();
if (player == client.getLocalPlayer() && config.screenshotPlayerDeath())
{ {
takeScreenshot("Death " + format(new Date())); takeScreenshot("Death " + format(new Date()));
} }
else if ((player.isClanMember() || player.isFriend()) && config.screenshotFriendDeath() && player.getCanvasTilePoly() != null)
{
takeScreenshot("Death " + player.getName() + " " + format(new Date()));
}
} }
@Subscribe @Subscribe