aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/cowtipper
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2020-12-18 17:27:19 +0100
committerCow <cow@volloeko.de>2020-12-18 17:27:19 +0100
commit741f65c9e44f61a458a28f1e2bbbf47401b144ab (patch)
tree46c38a707361a300f7532adc57ff12b7c2640e66 /src/main/java/de/cowtipper
parentca1cf885f9c7e2c6fcdf31c697a22f0e984d7525 (diff)
downloadCowlection-741f65c9e44f61a458a28f1e2bbbf47401b144ab.tar.gz
Cowlection-741f65c9e44f61a458a28f1e2bbbf47401b144ab.tar.bz2
Cowlection-741f65c9e44f61a458a28f1e2bbbf47401b144ab.zip
Fixed detection problems caused by other mods modifying chat messages
Diffstat (limited to 'src/main/java/de/cowtipper')
-rw-r--r--src/main/java/de/cowtipper/cowlection/listener/ChatListener.java4
-rw-r--r--src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java3
-rw-r--r--src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsPartyListener.java4
3 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java b/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java
index e7d2fdb..130c390 100644
--- a/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java
+++ b/src/main/java/de/cowtipper/cowlection/listener/ChatListener.java
@@ -19,6 +19,7 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
+import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.commons.lang3.CharUtils;
import org.lwjgl.input.Keyboard;
@@ -149,7 +150,8 @@ public class ChatListener {
}
}
- @SubscribeEvent
+ // priority = highest to ignore other mods modifying the chat output
+ @SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
public void onChatMsgReceive(ClientChatReceivedEvent e) {
if (e.type != 2) {
String messageSender = null;
diff --git a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java
index 6a0913b..998102d 100644
--- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java
+++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java
@@ -453,7 +453,8 @@ public class DungeonsListener {
}, 40); // 2 second delay, making sure scoreboard got sent
}
- @SubscribeEvent
+ // priority = highest to ignore other mods modifying the chat output
+ @SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
public void onMessageReceived(ClientChatReceivedEvent e) {
if (e.type != 2) { // normal chat or system msg (not above action bar)
String text = EnumChatFormatting.getTextWithoutFormattingCodes(e.message.getUnformattedText());
diff --git a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsPartyListener.java b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsPartyListener.java
index a37d546..ed6906a 100644
--- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsPartyListener.java
+++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsPartyListener.java
@@ -11,6 +11,7 @@ import de.cowtipper.cowlection.util.Utils;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.Map;
@@ -42,7 +43,8 @@ public class DungeonsPartyListener {
}
}
- @SubscribeEvent
+ // priority = highest to ignore other mods modifying the chat output
+ @SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
public void onMessageReceived(ClientChatReceivedEvent e) {
if (e.type != 2 && listenForChatMsgs) { // normal chat or system msg (not above action bar), and not stopped
if (msgCounter > 15) {