Resolves https://github.com/fn2006/PollyMC/issues/150 If the game is launched in offline mode, pass invalid API servers via the -Dminecraft.api.* system properties. This workaround is mentioned here: https://github.com/FabricMC/fabric-loom/issues/915#issuecomment-1609154390 I think this change is appropriate to make here in PollyMC even though the Fabric developers decided against using it there. If a user wants to override the API servers back to the vanilla values (in order to use Auth Me or something), they can do so by setting the following custom JVM args on the instance: -Dminecraft.api.env=PROD -Dminecraft.api.auth.host=https://authserver.mojang.com -Dminecraft.api.account.host=https://api.mojang.com -Dminecraft.api.session.host=https://sessionserver.mojang.com -Dminecraft.api.services.host=https://api.minecraftservices.com Previously, auth args would override any user-specified args, but this patch also changes that behavior so user-specified args are now passed last.
39 lines
851 B
C++
39 lines
851 B
C++
#include "AuthSession.h"
|
|
#include <QJsonArray>
|
|
#include <QJsonDocument>
|
|
#include <QJsonObject>
|
|
#include <QStringList>
|
|
|
|
QString AuthSession::serializeUserProperties()
|
|
{
|
|
QJsonObject userAttrs;
|
|
/*
|
|
for (auto key : u.properties.keys())
|
|
{
|
|
auto array = QJsonArray::fromStringList(u.properties.values(key));
|
|
userAttrs.insert(key, array);
|
|
}
|
|
*/
|
|
QJsonDocument value(userAttrs);
|
|
return value.toJson(QJsonDocument::Compact);
|
|
}
|
|
|
|
bool AuthSession::MakeOffline(QString offline_playername)
|
|
{
|
|
if (status != PlayableOffline && status != PlayableOnline) {
|
|
return false;
|
|
}
|
|
session = "-";
|
|
access_token = "0";
|
|
player_name = offline_playername;
|
|
status = PlayableOffline;
|
|
wants_online = false;
|
|
return true;
|
|
}
|
|
|
|
void AuthSession::MakeDemo()
|
|
{
|
|
player_name = "Player";
|
|
demo = true;
|
|
}
|