classAndrew/anode

Crash in conjunction with Wynntils

Closed this issue · 3 comments

Hi, I am a developer of Wynntils. We are seeing multiple crashes that involve your mod. I believe it might be due to a bad interaction between our respective mods (or possibly that one of your assumptions about Wynncraft do not hold.)

The crash stack trace looks like this:

java.util.NoSuchElementException
	at java.base/java.util.concurrent.ConcurrentHashMap$KeyIterator.next(ConcurrentHashMap.java:3460)
	at xyz.andw.anode.listener.WarChatListener.lambda$init$3(WarChatListener.java:49)
	at xyz.andw.anode.event.ChatCallback.lambda$static$0(ChatCallback.java:12)
	at net.minecraft.class_338.handler$zzb000$anode$addMessage(class_338.java:560)
	at net.minecraft.class_338.method_1812(class_338.java)

In WarChatListener, you have the following piece of code that is causing trouble:

UUID bossbarID = uuidIter.next(); // there should always be two
                String barString = Untext.unText(bars.get(bossbarID).getName().getString());
                
                if (!barString.contains("❤")) { // it's the guild level thing, so the next bar should have a heart in it
                    bossbarID = uuidIter.next(); 

This assumption that the boss bars always come in pairs do not hold. We do boss bar manipulations in Wynntils; I can't say in the particular cases that the crash has occurred if there were more bars that has been removed/blocked by us, or if it is Wynncraft that did not create two bars (and thus your assumption is invalid).

In any case, you can make your mod more robust by checking if there really is an additional bar before trying to get it from the iterator.

To be fair, the crashes we see can also come from someone running the fork at https://github.com/PhoenixOrigin/anode-fabric; unfortunately we cannot tell.

FWIW, there is also two other separate crashes we have seen:

java.lang.NumberFormatException: For input string: "❤"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Long.parseLong(Long.java:711)
	at java.base/java.lang.Long.parseLong(Long.java:836)
	at xyz.andw.anode.war.Tower.fromBossString(Tower.java:67)
	at xyz.andw.anode.listener.WarChatListener.lambda$init$3(WarChatListener.java:59)
	at xyz.andw.anode.event.ChatCallback.lambda$static$0(ChatCallback.java:12)
	at net.minecraft.class_338.handler$zzb000$anode$addMessage(class_338.java:560)

and

java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at xyz.andw.anode.war.Tower.fromBossString(Tower.java:66)
	at xyz.andw.anode.listener.WarChatListener.lambda$init$3(WarChatListener.java:59)
	at xyz.andw.anode.event.ChatCallback.lambda$static$0(ChatCallback.java:12)
	at net.minecraft.class_338.handler$zzb000$anode$addMessage(class_338.java:560)

Hey magicus, you're correct. The client will see two boss bars only when they are in a war.
However, the code was being run even when the player is not in a war whenever a "war has begun" message is received.

This is fixed now in the latest release.

Let me know if you are seeing anymore related crashes.