aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/cc/woverflow/chatting/mixin/ChatLineMixin.java36
1 files changed, 20 insertions, 16 deletions
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) {
}
}