screenshotplugin: fix screenshot button ignoring displayDate setting

This commit is contained in:
Lotto
2018-05-04 00:48:13 +02:00
parent b8e090b098
commit c4fb92cd5d
2 changed files with 6 additions and 9 deletions

View File

@@ -60,7 +60,7 @@ public class ScreenshotInput implements KeyListener
if (event.getKeyCode() == KeyEvent.VK_INSERT) if (event.getKeyCode() == KeyEvent.VK_INSERT)
{ {
plugin.takeScreenshot(TIME_FORMAT.format(new Date()), config.displayDate()); plugin.takeScreenshot(TIME_FORMAT.format(new Date()));
} }
} }

View File

@@ -174,9 +174,7 @@ public class ScreenshotPlugin extends Plugin
titleBarButton = NavigationButton.builder() titleBarButton = NavigationButton.builder()
.tooltip("Take screenshot") .tooltip("Take screenshot")
.icon(iconImage) .icon(iconImage)
.onClick(() -> takeScreenshot( .onClick(() -> takeScreenshot(TIME_FORMAT.format(new Date())))
TIME_FORMAT.format(new Date()),
client.getLocalPlayer() != null))
.popup(ImmutableMap .popup(ImmutableMap
.<String, Runnable>builder() .<String, Runnable>builder()
.put("Open screenshot folder...", () -> .put("Open screenshot folder...", () ->
@@ -261,7 +259,7 @@ public class ScreenshotPlugin extends Plugin
if (event.getGroupId() == WidgetID.KINGDOM_GROUP_ID) if (event.getGroupId() == WidgetID.KINGDOM_GROUP_ID)
{ {
String fileName = "Kingdom " + LocalDate.now(); String fileName = "Kingdom " + LocalDate.now();
takeScreenshot(fileName, config.displayDate()); takeScreenshot(fileName);
} }
} }
@@ -366,7 +364,7 @@ public class ScreenshotPlugin extends Plugin
return; return;
} }
takeScreenshot(fileName, config.displayDate()); takeScreenshot(fileName);
} }
/** /**
@@ -401,9 +399,8 @@ public class ScreenshotPlugin extends Plugin
* and optionally uploads it to an image-hosting service. * and optionally uploads it to an image-hosting service.
* *
* @param fileName Filename to use, without file extension. * @param fileName Filename to use, without file extension.
* @param displayDate Whether to show today's date on the report button as the screenshot is taken.
*/ */
void takeScreenshot(String fileName, boolean displayDate) void takeScreenshot(String fileName)
{ {
if (client.getGameState() == GameState.LOGIN_SCREEN) if (client.getGameState() == GameState.LOGIN_SCREEN)
{ {
@@ -473,7 +470,7 @@ public class ScreenshotPlugin extends Plugin
}); });
}; };
if (displayDate) if (config.displayDate())
{ {
screenshotOverlay.queueForTimestamp(screenshotConsumer); screenshotOverlay.queueForTimestamp(screenshotConsumer);
} }