FTBTeam / FTB-Mods-Issues

Any mod issues, be it FTB Teams, Quests or any other of our mods can be reported here!
23 stars 1 forks source link

[Feature Request]: Players who support offline mode use #785

Open QianMuu opened 1 year ago

QianMuu commented 1 year ago

Mod

FTB Teams

Description

Players in offline mode cannot use it.

Describe the solution you'd like

I hope that 'FTB Teams' can support players in both online and offline modes to use team functions normally

Describe alternatives you've considered

FTB Teams "is a great module, its features are really great, and it has been very helpful for me to build servers.

However, if it is not possible to support equal use of team functions for both online and offline players.

I may consider using an online mode where the server is turned off, but there is no way.

I am somewhat disappointed that the Minecraft account I purchased cannot access the server I built.

I can't use my skin either.

DJsushi commented 1 year ago

Has there been any progress towards this? I'm curious as to why this limitation even exists. Could someone please explain it to me with some technical details?

desht commented 1 year ago

No, this will never happen. The only reason to allow both online and offline mode players at the same time is to support players who haven't bought the game.

And we do not support software piracy in any way.

DJsushi commented 1 year ago

@desht but I wasn't asking about both online and offline players. I was asking about a purely offline server that runs on a LAN network without an internet connection. For some reason, it doesn't work for me, the data isn't received from the server and the message "Team data has not been received from the server! FTB Teams will not function correctly. Check server log for errors, and ensure your server is in online mode".

desht commented 1 year ago

Strange, since I just tested connecting to an offline server with my purchased account, and FTB Teams works fine.

DJsushi commented 1 year ago

Strange, since I just tested connecting to an offline server with my purchased account, and FTB Teams works fine.

@desht I don't know what's wrong. I use PrismLauncher (not the cracked version) to launch the game. I tried launching both in online and offline mode (and my local server is in offline mode) and it doesn't work either way. The funny thing is, that when I cloned the FTB Teams repo myself and built it using Gradle and then launched both a server and client, it worked. I don't know what can be causing this but it's messing a lot with my All of Fabric world. I don't want to have the server in online mode because we don't always have a stable internet connection when playing.

Edit: I also find worth noting that both the server and client I tested it on are fresh installs. Edit 2: After some tinkering, I found out this:

Scenario 1: The server is an external server and the client is launched through Gradle. This scenario works.

Scenario 2: The server is launched from Gradle and the client is launched through Prism Launcher. In this scenario, I get the error. This means that somehow the client launched through Prism Launcher (doesn't matter if online or offline mode) somehow cannot receive the info. It's worth noting that I bumped all the versions in the source code to the newest 1.19.2 versions (Fabric API, Architectury, Fabric Loader, FTB Library version.

I am attaching a screenshot of two Minecraft instances running simultaneously: one of them is a PrismLauncher one, the other one launched from the development environment of FTB Teams. Both of them connected to a server NOT launched through the dev environment (the server is a standalone Fabric server with only the mods required for FTB Teams mod).

image

I found this present in the NOT working client that's not present in the working client:

[13:49:16] [Render thread/WARN]: Local player id 48839309-819d-40bf-a3ef-1580fe6190c5 was not found in the known players list [4ef2c8ae-f327-362c-9965-7aefe13435d8,9ba8005a-2f55-38dd-9454-3d3b1d67bff1,0de52af9-02ff-3033-a9e5-ba9cb563491f,db36f3cc-8174-31c4-b4a5-9b3685ee0d21,ab110892-c6b2-3de5-8fa5-f01e37cd4065,eb662411-185a-3694-b480-0c259ae00075,da075988-6245-3890-84d4-251ff8c86547]! FTB Teams will not be able to function correctly!

After some investigation, I found the part of the source code responsible for generating the warning:

public void initSelfDetails(UUID selfTeamID) {
        selfTeam = teamMap.get(selfTeamID);
        UUID userId = Minecraft.getInstance().getUser().getGameProfile().getId();
        selfKnownPlayer = knownPlayers.get(userId);
        if (selfKnownPlayer == null) {
            FTBTeams.LOGGER.warn("Local player id {} was not found in the known players list [{}]! FTB Teams will not be able to function correctly!",
                    userId, String.join(",", knownPlayers.keySet().stream().map(UUID::toString).toList()));
        }
    }

It seems that the current player's UUID is not present in the knownPlayers map, but the map is filled with UUIDs on like 4 places and I don't quite understand where this thing could go wrong. The worst part is that in the development environment it works and in my Minecraft instance (which isn't debuggable) it doesn't. Please if any dev can see this and help, I would appreciate it a lot. I can send further logs or something if needed.

desht commented 1 year ago

Interesting, thanks for the detailed info. This does appear to be related (or the same as) to a long-standing issue we've seen where the client isn't getting the data it needs from the server. Long-standing since we've never been able to reliably reproduce for debugging.

I'll go over what you've posted and likely come back with some more requests for info. In the warning you got on the client about the UUID, it looks like 48839309-819d-40bf-a3ef-1580fe6190c5 is not a UUID known to Mojang, or your server - is your server in offline mode at this point?

DJsushi commented 1 year ago

Yes, the UUID is not known to Mojang, the server has only been running in offline mode and the connected client is also run in offline mode through the PrismLauncher. I can run the client in online mode to see if the warning is still there but I don't see how that would fix the issue. Since the local development environment is also running fully in offline mode, even without any purchased account it syncs the data correctly.

IceOfSummer commented 9 months ago

It seems that offline mode players do not have an uuid:

# decomplied code: Minecraft.getInstance().getUser().getGameProfile().getId();
[arthas@44608]$ ognl '@net.minecraft.client.Minecraft@func_71410_x().func_110432_I().func_148256_e()' -c 6fe337a5
@GameProfile[
    id=null,
    name=@String[IceBing],
    properties=@PropertyMap[{}],
    legacy=@Boolean[false],
]

[arthas@44608]$ ognl '@dev.ftb.mods.ftbteams.data.ClientTeamManager@INSTANCE' -c 6fe337a5
@ClientTeamManager[
    INSTANCE=@ClientTeamManager[dev.ftb.mods.ftbteams.data.ClientTeamManager@2e48b57b],
    invalid=@Boolean[false],
    id=@UUID[b1f1f861-8490-455c-9b33-6f4fe843d991],
    teamMap=@HashMap[isEmpty=false;size=1],
    knownPlayers=@HashMap[isEmpty=false;size=1],
    selfTeam=@ClientTeam[IceBing#33bc027a],
    selfKnownPlayer=null,
]

Maybe this can be replaced by using the username to get the corresponding user?