summaryrefslogtreecommitdiffstats
path: root/src/Root.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-01-02 15:11:49 +0100
committerMattes D <github@xoft.cz>2020-01-07 06:53:17 +0100
commitb63bb2f694af8a0d6ef698534b1cf02a62514940 (patch)
treec9b300f0bbfc438514857c16484fa922d8c1e026 /src/Root.cpp
parentmain: Terminate if an exception is thrown. (diff)
downloadcuberite-b63bb2f694af8a0d6ef698534b1cf02a62514940.tar
cuberite-b63bb2f694af8a0d6ef698534b1cf02a62514940.tar.gz
cuberite-b63bb2f694af8a0d6ef698534b1cf02a62514940.tar.bz2
cuberite-b63bb2f694af8a0d6ef698534b1cf02a62514940.tar.lz
cuberite-b63bb2f694af8a0d6ef698534b1cf02a62514940.tar.xz
cuberite-b63bb2f694af8a0d6ef698534b1cf02a62514940.tar.zst
cuberite-b63bb2f694af8a0d6ef698534b1cf02a62514940.zip
Diffstat (limited to '')
-rw-r--r--src/Root.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Root.cpp b/src/Root.cpp
index 1df7cfff4..0869192b8 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -39,6 +39,7 @@
#include "OverridesSettingsRepository.h"
#include "Logger.h"
#include "ClientHandle.h"
+#include "BlockTypePalette.h"
@@ -192,6 +193,24 @@ void cRoot::Start(std::unique_ptr<cSettingsRepositoryInterface> a_OverridesRepo)
// cClientHandle::FASTBREAK_PERCENTAGE = settingsRepo->GetValueSetI("AntiCheat", "FastBreakPercentage", 97) / 100.0f;
cClientHandle::FASTBREAK_PERCENTAGE = 0; // AntiCheat disabled due to bugs. We will enabled it once they are fixed. See #3506.
+ // Load the UpgradeBlockTypePalette:
+ LOG("Loading UpgradeBlockTypePalette...");
+ try
+ {
+ auto paletteStr = cFile::ReadWholeFile("Protocol/UpgradeBlockTypePalette.txt");
+ if (paletteStr.empty())
+ {
+ throw std::runtime_error("File is empty");
+ }
+ m_UpgradeBlockTypePalette.reset(new BlockTypePalette);
+ m_UpgradeBlockTypePalette->loadFromString(paletteStr);
+ }
+ catch (const std::exception & exc)
+ {
+ LOGERROR("Failed to load the Upgrade block type palette from Protocol/UpgradeBlockTypePalette.txt: %s\nAborting", exc.what());
+ throw;
+ }
+
m_MojangAPI = new cMojangAPI;
bool ShouldAuthenticate = settingsRepo->GetValueSetB("Authentication", "Authenticate", true);
m_MojangAPI->Start(*settingsRepo, ShouldAuthenticate); // Mojang API needs to be started before plugins, so that plugins may use it for DB upgrades on server init