World name in a replay is null (possibly?)
LindaJuffermans opened this issue ยท 2 comments
It seems some mods can croak when the world name is null:
java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:203) ~[?:1.8.0_51]
at com.ptsmods.morecommands.MoreCommandsClient.getWorldName(MoreCommandsClient.java:191) ~[MoreCommands-3.4.2_1.16.5.jar:?]
at com.ptsmods.morecommands.MoreCommandsClient.updatePresence(MoreCommandsClient.java:201) ~[MoreCommands-3.4.2_1.16.5.jar:?]
If the name is null, maybe RM can give it a dummy name? (For now I've asked them to remove the MoreCommands mod.)
There is not one way to get the world name.
Mods usually need to check in a bunch of places:
- Is an integrated server running? -> use the name of its save
- Are we connected to a server? -> use its name in the server list or its address if it is not in there (direct connect)
- Are we connected to realms? -> most (including RM itself) do not bother and just use a fallback because the realms lib can be updated independently from MC, so random breakages are likely and once a new MC version is released it's useless anyway
- None of the above? -> might be Replay Mod, or some other mod (I don't know of any cause I don't play much but I could imagine some; like e.g. ones which allow you to directly join a friend's world over the internet; or e.g. the Vivecraft main menu world depending on how that's implemented). mods should use some fallback here but some just assume this is impossible and do not properly handle this case
It is not clear what the best action on ReplayMod's end would be.
If we fake any of the above, those mods that do not consider 4 will stop failing there, but other mods (or even the same ones) might start misbehaving in other ways. Like, take bobby for example: It is not directly aware of the ReplayMod but it does have a sane fallback for case 4, so it behaves as you would expect. If the ReplayMod instead tried to fake case 2 for replays (using the same address as during recording), then bobby (and many minimap mods) would start overwriting their up-to-date chunks with old data every time you entered a replay, which is certainly not what you want cause it requires manually re-visiting those chunks on the server to correct.
I feel like going with case 4 will cause the least compatibility issues and generally only if the third-party mod is not written defensively (which they really should be, given that other mods are indeed a thing).
There have also been at least a few people who asked me if there is a way to check whether there is currently a replay playing from their mod (for whatever reason, I did not ask them), and I told them that they probably should not depend on the RM directly and instead check for case 4 cause that's a more general thing (and that solution seemed to satisfy most of them), so there may actually be mods out there now which actively prefer case 4 over us faking one of the other ones.
Therefore, imho, going with case 4 (as we currently do) makes the most sense.
TLDR: try to get it fixed in MoreCommands