From 72c087cfd335b015139cb73ae78f74105d855cf0 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 27 Sep 2014 14:28:14 +0100 Subject: Dropped support for <1.7.x --- src/Root.cpp | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index 966a9b4ba..aa3d43cba 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -42,7 +42,6 @@ cRoot* cRoot::s_Root = NULL; cRoot::cRoot(void) : - m_PrimaryServerVersion(cProtocolRecognizer::PROTO_VERSION_LATEST), m_pDefaultWorld(NULL), m_InputThread(NULL), m_Server(NULL), @@ -142,17 +141,6 @@ void cRoot::Start(void) IniFile.AddHeaderComment(" See: http://wiki.mc-server.org/doku.php?id=configure:settings.ini for further configuration help"); } - m_PrimaryServerVersion = IniFile.GetValueI("Server", "PrimaryServerVersion", 0); - if (m_PrimaryServerVersion == 0) - { - m_PrimaryServerVersion = cProtocolRecognizer::PROTO_VERSION_LATEST; - } - else - { - // Make a note in the log that the primary server version is explicitly set in the ini file - LOGINFO("Primary server version set explicitly to %d.", m_PrimaryServerVersion); - } - 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)) -- cgit v1.2.3 From 687752241f97599c932ab30da449d7b9dec632c4 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 17 Oct 2014 13:57:18 +0200 Subject: cMojangAPI: Don't update data if server is in offline mode. --- src/Root.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index aa3d43cba..2d08c2c70 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -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..."); -- cgit v1.2.3 From eb821ff240fabab6666705bd767e334c5220027a Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 18 Oct 2014 19:55:01 +0100 Subject: Fixed failure for cRankManager to restart --- src/Root.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index aa3d43cba..b866e2369 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -154,7 +154,8 @@ void cRoot::Start(void) m_WebAdmin->Init(); LOGD("Loading settings..."); - m_RankManager.Initialize(m_MojangAPI); + m_RankManager = new cRankManager(); + m_RankManager->Initialize(m_MojangAPI); m_CraftingRecipes = new cCraftingRecipes; m_FurnaceRecipe = new cFurnaceRecipe(); -- cgit v1.2.3 From a26541a7c3ced0569098edd0aae61c097c2912f4 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 20 Oct 2014 21:55:07 +0100 Subject: En masse NULL -> nullptr replace --- src/Root.cpp | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index 02455518c..6a91ec238 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -35,21 +35,21 @@ -cRoot* cRoot::s_Root = NULL; +cRoot* cRoot::s_Root = nullptr; cRoot::cRoot(void) : - m_pDefaultWorld(NULL), - m_InputThread(NULL), - m_Server(NULL), - m_MonsterConfig(NULL), - m_CraftingRecipes(NULL), - m_FurnaceRecipe(NULL), - m_WebAdmin(NULL), - m_PluginManager(NULL), + m_pDefaultWorld(nullptr), + m_InputThread(nullptr), + m_Server(nullptr), + m_MonsterConfig(nullptr), + m_CraftingRecipes(nullptr), + m_FurnaceRecipe(nullptr), + m_WebAdmin(nullptr), + m_PluginManager(nullptr), m_bStop(false), m_bRestart(false) { @@ -215,7 +215,7 @@ void cRoot::Start(void) } #if !defined(ANDROID_NDK) - delete m_InputThread; m_InputThread = NULL; + delete m_InputThread; m_InputThread = nullptr; #endif // Stop the server: @@ -230,21 +230,21 @@ void cRoot::Start(void) m_Authenticator.Stop(); LOGD("Freeing MonsterConfig..."); - delete m_MonsterConfig; m_MonsterConfig = NULL; - delete m_WebAdmin; m_WebAdmin = NULL; + delete m_MonsterConfig; m_MonsterConfig = nullptr; + delete m_WebAdmin; m_WebAdmin = nullptr; LOGD("Unloading recipes..."); - delete m_FurnaceRecipe; m_FurnaceRecipe = NULL; - delete m_CraftingRecipes; m_CraftingRecipes = NULL; + delete m_FurnaceRecipe; m_FurnaceRecipe = nullptr; + delete m_CraftingRecipes; m_CraftingRecipes = nullptr; LOGD("Unloading worlds..."); UnloadWorlds(); LOGD("Stopping plugin manager..."); - delete m_PluginManager; m_PluginManager = NULL; + delete m_PluginManager; m_PluginManager = nullptr; cItemHandler::Deinit(); LOG("Cleaning up..."); - delete m_Server; m_Server = NULL; + delete m_Server; m_Server = nullptr; LOG("Shutdown successful!"); } @@ -319,7 +319,7 @@ void cRoot::LoadWorlds(cIniFile & IniFile) cWorld * cRoot::CreateAndInitializeWorld(const AString & a_WorldName, eDimension a_Dimension, const AString & a_OverworldName) { cWorld * World = m_WorldsByName[a_WorldName]; - if (World != NULL) + if (World != nullptr) { return World; } @@ -364,7 +364,7 @@ void cRoot::StopWorlds(void) void cRoot::UnloadWorlds(void) { - m_pDefaultWorld = NULL; + m_pDefaultWorld = nullptr; for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr) { delete itr->second; @@ -397,7 +397,7 @@ cWorld * cRoot::GetWorld(const AString & a_WorldName, bool a_SearchForFolder) { return CreateAndInitializeWorld(a_WorldName); } - return NULL; + return nullptr; } @@ -409,7 +409,7 @@ bool cRoot::ForEachWorld(cWorldListCallback & a_Callback) for (WorldMap::iterator itr = m_WorldsByName.begin(), itr2 = itr; itr != m_WorldsByName.end(); itr = itr2) { ++itr2; - if (itr->second != NULL) + if (itr->second != nullptr) { if (a_Callback.Item(itr->second)) { @@ -544,7 +544,7 @@ void cRoot::BroadcastChat(const AString & a_Message, eMessageType a_ChatPrefix) { for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr) { - itr->second->BroadcastChat(a_Message, NULL, a_ChatPrefix); + itr->second->BroadcastChat(a_Message, nullptr, a_ChatPrefix); } // for itr - m_WorldsByName[] } @@ -614,7 +614,7 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac m_BestRating(0), m_NameLength(a_PlayerName.length()), m_PlayerName(a_PlayerName), - m_BestMatch(NULL), + m_BestMatch(nullptr), m_NumMatches(0) {} -- cgit v1.2.3 From 449d08cb3d1a8ef430430790fcea0ce36b713866 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 23 Oct 2014 15:15:10 +0200 Subject: Merged IniFile into main MCS sources. --- src/Root.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index 6a91ec238..24c1a4cc8 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -19,11 +19,10 @@ #include "OSSupport/Timer.h" #include "LoggerListeners.h" #include "BuildInfo.h" - -#include "inifile/iniFile.h" +#include "IniFile.h" #ifdef _WIN32 - #include "conio.h" + #include #include #elif defined(__linux__) #include -- cgit v1.2.3 From 9f71a4e7aec04c4c7fa57ac4b82f27a21044f798 Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Sun, 2 Nov 2014 21:01:23 +0100 Subject: Added FindAndDoWithUUID --- src/Root.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index 24c1a4cc8..539284665 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -633,6 +633,22 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac +bool cRoot::FindAndDoWithUUID(const AString & a_PlayerUUID, cPlayerListCallback & a_Callback) +{ + for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end();itr++) + { + if (itr->second->FindAndDoWithUUID(a_PlayerUUID, a_Callback)) + { + return true; + } + } + return false; +} + + + + + AString cRoot::GetProtocolVersionTextFromInt(int a_ProtocolVersion) { return cProtocolRecognizer::GetVersionTextFromInt(a_ProtocolVersion); -- cgit v1.2.3 From 13b20d6fe29ebccc60b6be0d3baa17e0353f4a06 Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Wed, 5 Nov 2014 21:57:38 +0100 Subject: renamed FindAndDoWithUUID to DoWithPlayerByUUID, fixed style and comments, added description to APIDump --- src/Root.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index 539284665..49d6117eb 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -633,11 +633,11 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac -bool cRoot::FindAndDoWithUUID(const AString & a_PlayerUUID, cPlayerListCallback & a_Callback) +bool cRoot::DoWithPlayerByUUID(const AString & a_PlayerUUID, cPlayerListCallback & a_Callback) { for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end();itr++) { - if (itr->second->FindAndDoWithUUID(a_PlayerUUID, a_Callback)) + if (itr->second->DoWithPlayerByUUID(a_PlayerUUID, a_Callback)) { return true; } -- cgit v1.2.3 From c9a3cb4d3f9fa9262b5adf775a8af0cc39234f5e Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 12 Nov 2014 21:59:42 +0100 Subject: Fixed trailing whitespace. --- src/Root.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index 49d6117eb..55e1c1156 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -634,7 +634,7 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac bool cRoot::DoWithPlayerByUUID(const AString & a_PlayerUUID, cPlayerListCallback & a_Callback) -{ +{ for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end();itr++) { if (itr->second->DoWithPlayerByUUID(a_PlayerUUID, a_Callback)) -- cgit v1.2.3