Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/Game/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
import javax.swing.JPanel;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Callable;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

/**
* This class prepares the client for login, handles chat messages, and performs player related
Expand All @@ -75,6 +80,9 @@ public class Client {
// Game's client instance
public static Object instance;

// Create an executor for scheduling future actions. (Pool size of 1 for a single-threaded scheduler)
public static ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);

public static Map<String, LinkedList<String>> tracerInstructions =
new LinkedHashMap<String, LinkedList<String>>();

Expand Down Expand Up @@ -503,6 +511,13 @@ public static void adaptLoginInfo() {
}
}

public static Callable<Void> takeLevelUpScreenshot = () -> {
// Add the screenshot to the queue
Renderer.takeScreenshot(true);

return null;
};

public static int shadowSleepCount;

/*
Expand Down Expand Up @@ -3395,7 +3410,8 @@ public static String colorizeMessage(String colorMessage, int type) {
if (screenshotMessage
&& Settings.AUTO_SCREENSHOT.get(Settings.currentProfile)
&& !Replay.isPlaying) {
Renderer.takeScreenshot(true);
// Take the screenshot after a 1 second delay
executor.schedule(takeLevelUpScreenshot, 1, TimeUnit.SECONDS);
}

if (blueMessage) { // this is one of the messages which we must overwrite expected color for
Expand Down