aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gradle.properties2
-rw-r--r--src/main/java/cc/woverflow/chatting/mixin/ChatLineMixin.java36
2 files changed, 21 insertions, 17 deletions
diff --git a/gradle.properties b/gradle.properties
index 57d0e1e..647229e 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx2G
mod_name = Chatting
mod_id = chatting
-mod_version = 1.4.2-beta3
+mod_version = 1.4.2-beta4
loom.platform = forge
minecraft.version = "1.8.9-forge"
diff --git a/src/main/java/cc/woverflow/chatting/mixin/ChatLineMixin.java b/src/main/java/cc/woverflow/chatting/mixin/ChatLineMixin.java
index b739284..ab052ae 100644
--- a/src/main/java/cc/woverflow/chatting/mixin/ChatLineMixin.java
+++ b/src/main/java/cc/woverflow/chatting/mixin/ChatLineMixin.java
@@ -34,26 +34,30 @@ public class ChatLineMixin implements ChatLineHook {
private void onInit(int i, IChatComponent iChatComponent, int j, CallbackInfo ci) {
chatLines.add(new WeakReference<>((ChatLine) (Object) this));
NetHandlerPlayClient netHandler = Minecraft.getMinecraft().getNetHandler();
+ if (netHandler == null) return;
Map<String, NetworkPlayerInfo> nicknameCache = new HashMap<>();
- for (String word : iChatComponent.getFormattedText().split("(§.)|\\W")) {
- if (word.isEmpty()) continue;
- playerInfo = netHandler.getPlayerInfo(word);
- if (playerInfo == null) {
- playerInfo = getPlayerFromNickname(word, netHandler, nicknameCache);
- }
- if (playerInfo != null) {
- detectedPlayerInfo = playerInfo;
- detected = true;
- if (playerInfo == lastPlayerInfo) {
- first = false;
- if (ChattingConfig.INSTANCE.getHideChatHeadOnConsecutiveMessages()) {
- playerInfo = null;
+ try {
+ for (String word : iChatComponent.getFormattedText().split("(§.)|\\W")) {
+ if (word.isEmpty()) continue;
+ playerInfo = netHandler.getPlayerInfo(word);
+ if (playerInfo == null) {
+ playerInfo = getPlayerFromNickname(word, netHandler, nicknameCache);
+ }
+ if (playerInfo != null) {
+ detectedPlayerInfo = playerInfo;
+ detected = true;
+ if (playerInfo == lastPlayerInfo) {
+ first = false;
+ if (ChattingConfig.INSTANCE.getHideChatHeadOnConsecutiveMessages()) {
+ playerInfo = null;
+ }
+ } else {
+ lastPlayerInfo = playerInfo;
}
- } else {
- lastPlayerInfo = playerInfo;
+ break;
}
- break;
}
+ } catch (Exception ignored) {
}
}