aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHackOS <63157139+HackedOS@users.noreply.github.com>2022-05-15 18:52:56 +0530
committerGitHub <noreply@github.com>2022-05-15 15:22:56 +0200
commit7f7f8587d3e06354ef0cc80a1a06ef76ba0387ff (patch)
tree873f05b5676691a7684df5571d393881315f5987
parent01cf4007b7ab24937fb6c831be6ae7fc481d88ef (diff)
downloadCOFL-7f7f8587d3e06354ef0cc80a1a06ef76ba0387ff.tar.gz
COFL-7f7f8587d3e06354ef0cc80a1a06ef76ba0387ff.tar.bz2
COFL-7f7f8587d3e06354ef0cc80a1a06ef76ba0387ff.zip
Fix chat spam if chat regex is null and respect more privacy settings (#61)
* Fix chat spam if chat regex is null and respect more privacy settings * optimize * optimize regex
-rw-r--r--src/main/java/de/torui/coflsky/EventHandler.java4
-rw-r--r--src/main/java/de/torui/coflsky/EventRegistry.java4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/de/torui/coflsky/EventHandler.java b/src/main/java/de/torui/coflsky/EventHandler.java
index 6fac06a..55bd4ba 100644
--- a/src/main/java/de/torui/coflsky/EventHandler.java
+++ b/src/main/java/de/torui/coflsky/EventHandler.java
@@ -30,7 +30,7 @@ public class EventHandler {
private static String server = "";
public static void TabMenuData() {
- if (isInSkyblock && CoflSky.Wrapper.isRunning){
+ if (isInSkyblock && CoflSky.Wrapper.isRunning && Configuration.getInstance().collectTab){
List<String> tabdata = getTabList();
int size = tabdata.size() - 1;
for (int i = 0; i < tabdata.size(); i++) {
@@ -120,7 +120,7 @@ public class EventHandler {
return tabListAsString;
}
private static void ProcessTabMenu(String line) {
- if (line.contains("server:")) {
+ if (Configuration.getInstance().collectLobbyChanges && line.contains("server:")) {
String server_ = line.split("server: ")[1];
if (!server.equals(server_)) {
server = server_;
diff --git a/src/main/java/de/torui/coflsky/EventRegistry.java b/src/main/java/de/torui/coflsky/EventRegistry.java
index 43276db..9d82f14 100644
--- a/src/main/java/de/torui/coflsky/EventRegistry.java
+++ b/src/main/java/de/torui/coflsky/EventRegistry.java
@@ -39,7 +39,7 @@ import static de.torui.coflsky.EventHandler.ScoreboardData;
import static de.torui.coflsky.EventHandler.TabMenuData;
public class EventRegistry {
- public static Pattern chatpattern = Pattern.compile("", Pattern.CASE_INSENSITIVE);
+ public static Pattern chatpattern = Pattern.compile("a^", Pattern.CASE_INSENSITIVE);
public final ExecutorService chatThreadPool = Executors.newFixedThreadPool(2);
public final ExecutorService tickThreadPool = Executors.newFixedThreadPool(2);
@SubscribeEvent
@@ -134,7 +134,7 @@ public class EventRegistry {
@SubscribeEvent
public void HandleChatEvent(ClientChatReceivedEvent sce) {
- if(CoflSky.Wrapper.isRunning) {
+ if(CoflSky.Wrapper.isRunning && Configuration.getInstance().collectChat) {
chatThreadPool.submit(() -> {
String msg = sce.message.getUnformattedText();
Matcher matcher = chatpattern.matcher(msg);