summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Birkett <anthony@a-birkett.com>2015-06-01 15:41:06 +0200
committerAnthony Birkett <anthony@a-birkett.com>2015-06-01 15:41:06 +0200
commit65a62601dc3088cc5b076a83963646358eff6b1e (patch)
tree30fa5e9a9c194153b17484a1ba496644dccd43d8
parentMerge pull request #2172 from mc-server/LightingCallbacks (diff)
downloadcuberite-65a62601dc3088cc5b076a83963646358eff6b1e.tar
cuberite-65a62601dc3088cc5b076a83963646358eff6b1e.tar.gz
cuberite-65a62601dc3088cc5b076a83963646358eff6b1e.tar.bz2
cuberite-65a62601dc3088cc5b076a83963646358eff6b1e.tar.lz
cuberite-65a62601dc3088cc5b076a83963646358eff6b1e.tar.xz
cuberite-65a62601dc3088cc5b076a83963646358eff6b1e.tar.zst
cuberite-65a62601dc3088cc5b076a83963646358eff6b1e.zip
Diffstat (limited to '')
-rw-r--r--CONTRIBUTORS1
-rw-r--r--MCServer/install_windows_service.cmd2
-rw-r--r--src/main.cpp19
3 files changed, 11 insertions, 11 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 3505d7155..4dc357ab3 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -3,6 +3,7 @@ Many people have contributed to MCServer, and this list attempts to broadcast at
BasedDoge (Donated AlchemistVillage prefabs)
bearbin (Alexander Harkness)
beeduck
+birkett (Anthony Birkett)
derouinw
Diusrex
Duralex
diff --git a/MCServer/install_windows_service.cmd b/MCServer/install_windows_service.cmd
index ba8a8c128..d6b6c15a3 100644
--- a/MCServer/install_windows_service.cmd
+++ b/MCServer/install_windows_service.cmd
@@ -3,5 +3,5 @@ rem Alter this if you need to install multiple instances.
set SERVICENAME="MCServer"
set CURRENTDIR=%CD%
-sc create %SERVICENAME% binPath= "%CURRENTDIR%\MCServer.exe /service" start= auto DisplayName= %SERVICENAME%
+sc create %SERVICENAME% binPath= "%CURRENTDIR%\MCServer.exe -d" start= auto DisplayName= %SERVICENAME%
sc description %SERVICENAME% "Minecraft server instance" \ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index 5cd057278..d5c39cecd 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -382,6 +382,10 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
TCLAP::SwitchArg noBufArg("", "no-output-buffering", "Disable output buffering", cmd);
+ TCLAP::SwitchArg runAsServiceArg("d", "run-as-service", "Run as a service on Windows", cmd);
+
+ cmd.ignoreUnmatched(true);
+
cmd.parse(argc, argv);
auto repo = cpp14::make_unique<cMemorySettingsRepository>();
@@ -420,6 +424,11 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
setvbuf(stdout, nullptr, _IONBF, 0);
}
+ if (runAsServiceArg.getValue())
+ {
+ cRoot::m_RunAsService = true;
+ }
+
repo->SetReadOnly();
return repo;
@@ -493,16 +502,6 @@ int main(int argc, char **argv)
auto argsRepo = parseArguments(argc, argv);
- // Check if comm logging is to be enabled:
- for (int i = 0; i < argc; i++)
- {
- AString Arg(argv[i]);
- if (NoCaseCompare(Arg, "/service") == 0)
- {
- cRoot::m_RunAsService = true;
- }
- } // for i - argv[]
-
#if defined(_WIN32)
// Attempt to run as a service
if (cRoot::m_RunAsService)