cMojangAPI: Don't update data if server is in offline mode.
This commit is contained in:
parent
803666d480
commit
687752241f
@ -214,14 +214,17 @@ cMojangAPI::~cMojangAPI()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cMojangAPI::Start(cIniFile & a_SettingsIni)
|
void cMojangAPI::Start(cIniFile & a_SettingsIni, bool a_ShouldAuth)
|
||||||
{
|
{
|
||||||
m_NameToUUIDServer = a_SettingsIni.GetValueSet("MojangAPI", "NameToUUIDServer", DEFAULT_NAME_TO_UUID_SERVER);
|
m_NameToUUIDServer = a_SettingsIni.GetValueSet("MojangAPI", "NameToUUIDServer", DEFAULT_NAME_TO_UUID_SERVER);
|
||||||
m_NameToUUIDAddress = a_SettingsIni.GetValueSet("MojangAPI", "NameToUUIDAddress", DEFAULT_NAME_TO_UUID_ADDRESS);
|
m_NameToUUIDAddress = a_SettingsIni.GetValueSet("MojangAPI", "NameToUUIDAddress", DEFAULT_NAME_TO_UUID_ADDRESS);
|
||||||
m_UUIDToProfileServer = a_SettingsIni.GetValueSet("MojangAPI", "UUIDToProfileServer", DEFAULT_UUID_TO_PROFILE_SERVER);
|
m_UUIDToProfileServer = a_SettingsIni.GetValueSet("MojangAPI", "UUIDToProfileServer", DEFAULT_UUID_TO_PROFILE_SERVER);
|
||||||
m_UUIDToProfileAddress = a_SettingsIni.GetValueSet("MojangAPI", "UUIDToProfileAddress", DEFAULT_UUID_TO_PROFILE_ADDRESS);
|
m_UUIDToProfileAddress = a_SettingsIni.GetValueSet("MojangAPI", "UUIDToProfileAddress", DEFAULT_UUID_TO_PROFILE_ADDRESS);
|
||||||
LoadCachesFromDisk();
|
LoadCachesFromDisk();
|
||||||
m_UpdateThread->Start();
|
if (a_ShouldAuth)
|
||||||
|
{
|
||||||
|
m_UpdateThread->Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
|
|
||||||
/** Initializes the API; reads the settings from the specified ini file.
|
/** Initializes the API; reads the settings from the specified ini file.
|
||||||
Loads cached results from disk. */
|
Loads cached results from disk. */
|
||||||
void Start(cIniFile & a_SettingsIni);
|
void Start(cIniFile & a_SettingsIni, bool a_ShouldAuth);
|
||||||
|
|
||||||
/** Connects to the specified server using SSL, sends the given request and receives the response.
|
/** Connects to the specified server using SSL, sends the given request and receives the response.
|
||||||
Checks Mojang certificates using the hard-coded Starfield root CA certificate.
|
Checks Mojang certificates using the hard-coded Starfield root CA certificate.
|
||||||
|
@ -142,8 +142,9 @@ void cRoot::Start(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG("Starting server...");
|
LOG("Starting server...");
|
||||||
m_MojangAPI.Start(IniFile); // Mojang API needs to be started before plugins, so that plugins may use it for DB upgrades on server init
|
bool ShouldAuthenticate = IniFile.GetValueSetB("Authentication", "Authenticate", true);
|
||||||
if (!m_Server->InitServer(IniFile))
|
m_MojangAPI.Start(IniFile, ShouldAuthenticate); // Mojang API needs to be started before plugins, so that plugins may use it for DB upgrades on server init
|
||||||
|
if (!m_Server->InitServer(IniFile, ShouldAuthenticate))
|
||||||
{
|
{
|
||||||
IniFile.WriteFile("settings.ini");
|
IniFile.WriteFile("settings.ini");
|
||||||
LOGERROR("Failure starting server, aborting...");
|
LOGERROR("Failure starting server, aborting...");
|
||||||
|
@ -196,7 +196,7 @@ void cServer::PlayerDestroying(const cPlayer * a_Player)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cServer::InitServer(cIniFile & a_SettingsIni)
|
bool cServer::InitServer(cIniFile & a_SettingsIni, bool a_ShouldAuth)
|
||||||
{
|
{
|
||||||
m_Description = a_SettingsIni.GetValueSet("Server", "Description", "MCServer - in C++!");
|
m_Description = a_SettingsIni.GetValueSet("Server", "Description", "MCServer - in C++!");
|
||||||
m_MaxPlayers = a_SettingsIni.GetValueSetI("Server", "MaxPlayers", 100);
|
m_MaxPlayers = a_SettingsIni.GetValueSetI("Server", "MaxPlayers", 100);
|
||||||
@ -247,7 +247,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
|
|||||||
m_bIsConnected = true;
|
m_bIsConnected = true;
|
||||||
|
|
||||||
m_ServerID = "-";
|
m_ServerID = "-";
|
||||||
m_ShouldAuthenticate = a_SettingsIni.GetValueSetB("Authentication", "Authenticate", true);
|
m_ShouldAuthenticate = a_ShouldAuth;
|
||||||
if (m_ShouldAuthenticate)
|
if (m_ShouldAuthenticate)
|
||||||
{
|
{
|
||||||
MTRand mtrand1;
|
MTRand mtrand1;
|
||||||
|
@ -56,7 +56,7 @@ class cServer // tolua_export
|
|||||||
public: // tolua_export
|
public: // tolua_export
|
||||||
|
|
||||||
virtual ~cServer() {}
|
virtual ~cServer() {}
|
||||||
bool InitServer(cIniFile & a_SettingsIni);
|
bool InitServer(cIniFile & a_SettingsIni, bool a_ShouldAuth);
|
||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user