Stop screenshotPlugin from overwriting previous screenshots
This commit is contained in:
committed by
Jordan Atwood
parent
46811b52eb
commit
23413bf0b3
@@ -648,6 +648,14 @@ public class ScreenshotPlugin extends Plugin
|
||||
{
|
||||
File screenshotFile = new File(playerFolder, fileName + ".png");
|
||||
|
||||
// To make sure that screenshots don't get overwritten, check if file exists,
|
||||
// and if it does create file with same name and suffix.
|
||||
int i = 1;
|
||||
while (screenshotFile.exists())
|
||||
{
|
||||
screenshotFile = new File(playerFolder, fileName + String.format("(%d)", i++) + ".png");
|
||||
}
|
||||
|
||||
ImageIO.write(screenshot, "PNG", screenshotFile);
|
||||
|
||||
if (config.uploadScreenshot())
|
||||
|
||||
Reference in New Issue
Block a user