Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
13 changes: 10 additions & 3 deletions src/main/java/tomato/gui/chat/ChatGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ public ChatGUI(TomatoData data) {
loadChatPingMessages();
}

/**
* Schedules a recurring thread to request server phrases to be blocked by chat. Only the scheduler.
*/
private void scheduleLoadBlockedSpam() {
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);

// immediately run and then every 30 min after
scheduler.scheduleAtFixedRate(this::loadBlockedSpam, 0, 30, TimeUnit.MINUTES);
}

/**
* Creates a server request worker to request from server phrases to be blocked by chat. Phrases used by bots.
*/
Expand Down Expand Up @@ -110,9 +120,6 @@ private void loadBlockedSpam() {
System.err.println("Error during HTTP request: " + e.getMessage());
}
// System.out.println("Repopulating List\n" + blockedSpam);

ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(this::loadBlockedSpam, 30, 30, TimeUnit.MINUTES);
}

/**
Expand Down