Skip to content

Commit

Permalink
Added check to verify if datapack name is correct
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Nov 8, 2022
1 parent 4daa017 commit 281ddaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
-- Core settings
-- Note: If you want to use datapack canary (custom), put only "data"
-- If you want to use the global datapack, pute "data-global"
datapackFolderName = "data-global"

-- Combat settings
Expand Down
9 changes: 7 additions & 2 deletions src/otserv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ void toggleForceCloseButton() {

void startupErrorMessage() {
SPDLOG_ERROR("The program will close after pressing the enter key...");
g_loaderSignal.notify_all();
getchar();
exit(-1);
g_loaderSignal.notify_all();
}

void mainLoader(int argc, char* argv[], ServiceManager* servicer);
Expand All @@ -98,6 +97,12 @@ void modulesLoadHelper(bool loaded, std::string moduleName) {
void loadModules() {
modulesLoadHelper(g_configManager().load(), g_configManager().getConfigFileLua());

auto datapackName = g_configManager().getString(DATAPACK_FOLDER_NAME);
if (datapackName != "data" && datapackName != "data-global" || datapackName != "data-global" && datapackName != "data") {
SPDLOG_ERROR("The datapack folder name '{}' is wrong, please select valid datapack name 'data' or 'data-global", datapackName);
startupErrorMessage();
}

SPDLOG_INFO("Server protocol: {}.{}",
CLIENT_VERSION_UPPER, CLIENT_VERSION_LOWER);

Expand Down

0 comments on commit 281ddaf

Please sign in to comment.