Home > Software design >  Weird return values of net.minecraft.util.Session.getToken() and net.minecraft.util.Session.getProfi
Weird return values of net.minecraft.util.Session.getToken() and net.minecraft.util.Session.getProfi

Time:10-17

Today I was writing an minecraft 1.12.2 forge mod, that is supposed to print session data to the logs, and when I run it I get such output:

[12:22:30] [Client thread/INFO] [getsessionid]: getSessionID(): token:<ACCESS TOKEN>:<PROFILE ID>
[12:22:30] [Client thread/INFO] [getsessionid]: getPlayerID(): <PROFILE ID>
[12:22:30] [Client thread/INFO] [getsessionid]: getUsername(): _Blay_
[12:22:30] [Client thread/INFO] [getsessionid]: getToken(): <ACCESS TOKEN>

The problem is, that I didn't censor the data, it gives literal output like this. Does anyone know why net.minecraft.util.Session.getToken() always returns <ACCESS TOKEN> string, and net.minecraft.util.Session.getPlayerID() always returns <PROFILE ID> string?

There's the source code:

Minecraft minecraft = Minecraft.getMinecraft();
logger.info("getSessionID(): {}", minecraft.getSession().getSessionID());
logger.info("getPlayerID(): {}", minecraft.getSession().getPlayerID());
logger.info("getUsername(): {}", minecraft.getSession().getUsername());
logger.info("getToken(): {}", minecraft.getSession().getToken());

CodePudding user response:

Minecraft itself is printing the actual values of those things to the log. Your launcher, MultiMC, is then censoring them: https://github.com/MultiMC/Launcher/blob/518568b803c8afec29dd4ca068d3a0a6ede2da36/launcher/minecraft/MinecraftInstance.cpp#L685-L711

  • Related