cMojangAPI: Don't update data if server is in offline mode.
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_NameToUUIDAddress = a_SettingsIni.GetValueSet("MojangAPI", "NameToUUIDAddress", DEFAULT_NAME_TO_UUID_ADDRESS);
|
||||
m_UUIDToProfileServer = a_SettingsIni.GetValueSet("MojangAPI", "UUIDToProfileServer", DEFAULT_UUID_TO_PROFILE_SERVER);
|
||||
m_UUIDToProfileAddress = a_SettingsIni.GetValueSet("MojangAPI", "UUIDToProfileAddress", DEFAULT_UUID_TO_PROFILE_ADDRESS);
|
||||
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.
|
||||
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.
|
||||
Checks Mojang certificates using the hard-coded Starfield root CA certificate.
|
||||
|
|
|
@ -142,8 +142,9 @@ void cRoot::Start(void)
|
|||
}
|
||||
|
||||
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
|
||||
if (!m_Server->InitServer(IniFile))
|
||||
bool ShouldAuthenticate = IniFile.GetValueSetB("Authentication", "Authenticate", true);
|
||||
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");
|
||||
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_MaxPlayers = a_SettingsIni.GetValueSetI("Server", "MaxPlayers", 100);
|
||||
|
@ -247,7 +247,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
|
|||
m_bIsConnected = true;
|
||||
|
||||
m_ServerID = "-";
|
||||
m_ShouldAuthenticate = a_SettingsIni.GetValueSetB("Authentication", "Authenticate", true);
|
||||
m_ShouldAuthenticate = a_ShouldAuth;
|
||||
if (m_ShouldAuthenticate)
|
||||
{
|
||||
MTRand mtrand1;
|
||||
|
|
|
@ -56,7 +56,7 @@ class cServer // tolua_export
|
|||
public: // tolua_export
|
||||
|
||||
virtual ~cServer() {}
|
||||
bool InitServer(cIniFile & a_SettingsIni);
|
||||
bool InitServer(cIniFile & a_SettingsIni, bool a_ShouldAuth);
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
|
Loading…
Reference in New Issue