Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
ServerCommands.cpp: Add server version check
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Sep 25, 2021
1 parent 90ae385 commit d13d60f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions LiteLoader/ServerCommands.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "pch.h"

Logger<stdio_commit> LOG1(stdio_commit{"[LL] "});

void checkUpdate();
bool versionCommand(CommandOrigin const &, CommandOutput &outp) {
outp.success("The server is running Bedrock Dedicated Server " + loaderapi::getServerVersion() + " with LiteLoaderBDS " +
Expand All @@ -10,6 +12,12 @@ bool versionCommand(CommandOrigin const &, CommandOutput &outp) {
void registerCommands() {
Event::addEventListener([](RegCmdEV ev) { // Register commands
CMDREG::SetCommandRegistry(ev.CMDRg);
std::string server_version = loaderapi::getServerVersion();
if (server_version.find("1.17.1") != std::string::npos) {
LOG1("Are you sure you want to run LiteLoader" + loaderapi::getLoaderVersion() + " with BDS " + server_version + "?");
system("pause");
return;
}
MakeCommand("version", "Gets the version of this server", 0);
CmdOverload(version, versionCommand);
});
Expand Down

0 comments on commit d13d60f

Please sign in to comment.