Difficulty cannot be inforced by the difficulty locker mod. Meaning it's not only not required by the server, but the difficulty needs to be manually set by server.properties. I added a second server.properties.expert that just sets difficulty to 0 initially. Obviously a user can change this but they should just know that expert is supposed to be peaceful at that point. I then updated the script to switch between the two configs, if and only if they exist, so it should still work on ssp just the same. This was made to address #241 Since it is impossible for a mod to enforce server difficulty (Source: Trust me and dig through the code yourself I suggest starting with Forge's DedicatedServer object) /* Commits: */ * Pack Mode Switcher changes to address 241 in the most roundabout way possible * pack mode switcher updates and changing server.properties * added the properties files * made the readme's more friendly * more readme-bility * Made README more tutorial * typofix/capitialization is my passion * readme updates * forced * repalace * expert mode, again * script disclaimer * Script disclaimer * hopefully fixed jank formatting * fixed jank formatting * beautify
58 lines
1012 B
Bash
58 lines
1012 B
Bash
#!/usr/bin/env sh
|
|
touch .mode
|
|
set -e
|
|
echo "Nomifactory GTCEu Port / Pack mode switcher"
|
|
|
|
NORMAL_CFG=config-overrides/normal
|
|
EXPERT_CFG=config-overrides/expert
|
|
TARGET=./config
|
|
CURRENT_MODE="$(head .mode)"
|
|
CURRENT_MODE=${CURRENT_MODE:="normal"}
|
|
|
|
echo "Current Mode: $CURRENT_MODE"
|
|
|
|
if [ -z "$1" ]; then
|
|
echo -n "Set pack mode (Normal / Expert): "
|
|
read MODE
|
|
else
|
|
MODE="$1"
|
|
fi
|
|
|
|
case $MODE in
|
|
N|n|normal)
|
|
|
|
cp -rf "$NORMAL_CFG/." ${TARGET}
|
|
|
|
# Only copy server.properties if it exists.
|
|
if [ -f "server.properties" ]; then
|
|
mv "${TARGET}/server.properties" ./
|
|
else
|
|
rm "${TARGET}/server.properties"
|
|
fi
|
|
|
|
# Update Mode
|
|
echo normal > .mode
|
|
;;
|
|
|
|
E|e|expert)
|
|
|
|
cp -rf "$EXPERT_CFG/." ${TARGET}
|
|
|
|
if [ -f "server.properties" ]; then
|
|
mv "${TARGET}/server.properties" ./
|
|
else
|
|
rm "${TARGET}/server.properties"
|
|
fi
|
|
|
|
# Update Mode
|
|
echo expert > .mode
|
|
;;
|
|
|
|
*)
|
|
echo -e "Error: Invalid input $MODE"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
echo "Done!"
|