-
Notifications
You must be signed in to change notification settings - Fork 114
/
pack-mode-switcher.bat
65 lines (52 loc) · 1.72 KB
/
pack-mode-switcher.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@echo off
color 9
echo Monifactory Pack Mode Switcher
setlocal
set normalCfgPath=%~dp0config-overrides\normal
set hardCfgPath=%~dp0config-overrides\hardmode
set expertCfgPath=%~dp0config-overrides\expert
set targetPath=%~dp0config
rem handle cmdline args
if "%1"=="N" goto copyNormal
if "%1"=="H" goto copyHard
if "%1"=="E" goto copyExpert
rem handle the case where no parameter is supplied
if [%1]==[] goto getChoice
rem handle the case where an invalid parameter is supplied
echo Incorrect parameter! Supply N, H, E, or none at all.
exit 1
:getChoice
echo Set pack mode:
echo N: Normal
echo H: Hardmode
echo E: Expert
choice /c NHE /m "Selection:"
if "%errorlevel%" == "1" goto copyNormal
if "%errorlevel%" == "2" goto copyHard
if "%errorlevel%" == "3" goto copyExpert
:copyNormal
robocopy "%normalCfgPath%" "%targetPath%" *.* /e /nfl /ndl
rem If server.properties exists, update server config
IF EXIST server.properties (move "%targetPath%\server.properties" .\)
echo normal > .mode
goto end
:copyHard
robocopy "%hardCfgPath%" "%targetPath%" *.* /e /nfl /ndl
rem If server.properties exists, update server config
IF EXIST server.properties (move "%targetPath%\server.properties" .\)
echo hard > .mode
goto end
:copyExpert
robocopy "%hardCfgPath%" "%targetPath%" *.* /e /nfl /ndl
robocopy "%expertCfgPath%" "%targetPath%" *.* /e /nfl /ndl
rem If server.properties exists, update server config
IF EXIST server.properties (move "%targetPath%\server.properties" .\)
echo expert > .mode
goto end
:end
rem if server.properties is left over in the config path, remove it
IF EXIST "%targetPath%/server.properties" DEL "%targetPath%\server.properties"
echo Switch completed
rem only pause if the user didn't supply a parameter
if [%1]==[] pause
exit 0