mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Convert default server txt files to json
This commit changes the default server files from txt to json. The only exception is ops.txt which is still populated with users from DEFAULT_OPS_LIST on server creation. Until msm is updated to correctly populate ops.json on startup, msm relies on minecraft server's mechanism to convert ops.txt. Fixes issue #404
This commit is contained in:
parent
5b69c6a63f
commit
4022d5a816
22
init/msm
22
init/msm
@ -1301,15 +1301,19 @@ server_create() {
|
|||||||
else
|
else
|
||||||
printf "Creating server directory... "
|
printf "Creating server directory... "
|
||||||
as_user "$SETTINGS_USERNAME" "mkdir -p '$SETTINGS_SERVER_STORAGE_PATH/$1'"
|
as_user "$SETTINGS_USERNAME" "mkdir -p '$SETTINGS_SERVER_STORAGE_PATH/$1'"
|
||||||
as_user "$SETTINGS_USERNAME" "touch '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_WHITELIST_PATH'"
|
as_user "$SETTINGS_USERNAME" "echo '[]' > '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_WHITELIST_PATH'"
|
||||||
as_user "$SETTINGS_USERNAME" "touch '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_BANNED_IPS_PATH'"
|
as_user "$SETTINGS_USERNAME" "echo '[]' > '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_BANNED_IPS_PATH'"
|
||||||
as_user "$SETTINGS_USERNAME" "touch '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_BANNED_PLAYERS_PATH'"
|
as_user "$SETTINGS_USERNAME" "echo '[]' > '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_BANNED_PLAYERS_PATH'"
|
||||||
as_user "$SETTINGS_USERNAME" "touch '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_OPS_PATH'"
|
as_user "$SETTINGS_USERNAME" "echo '[]' > '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_OPS_PATH'"
|
||||||
|
|
||||||
# Set default ops users as appropriate
|
# Set default ops users as appropriate
|
||||||
|
# Adding usernames to ops.txt means on first startup minecraft server will
|
||||||
|
# fetch UUIDs for the users and add them to ops.json in the correct format.
|
||||||
|
# Relying on minecraft server to convert isn't ideal in the long term since
|
||||||
|
# it could deprecate the conversion.
|
||||||
if [ ! -z "$SETTINGS_DEFAULT_OPS_LIST" ]; then
|
if [ ! -z "$SETTINGS_DEFAULT_OPS_LIST" ]; then
|
||||||
IFS=","; for default_ops_user in $SETTINGS_DEFAULT_OPS_LIST; do
|
IFS=","; for default_ops_user in $SETTINGS_DEFAULT_OPS_LIST; do
|
||||||
as_user "$SETTINGS_USERNAME" "echo $default_ops_user | tr -d ' ' >> '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_OPS_PATH'"
|
as_user "$SETTINGS_USERNAME" "echo $default_ops_user | tr -d ' ' >> '$SETTINGS_SERVER_STORAGE_PATH/$1/ops.txt'"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -3304,10 +3308,10 @@ register_settings() {
|
|||||||
register_server_setting WORLD_STORAGE_PATH "worldstorage"
|
register_server_setting WORLD_STORAGE_PATH "worldstorage"
|
||||||
register_server_setting WORLD_STORAGE_INACTIVE_PATH "worldstorage_inactive"
|
register_server_setting WORLD_STORAGE_INACTIVE_PATH "worldstorage_inactive"
|
||||||
register_server_setting LOG_PATH "server.log"
|
register_server_setting LOG_PATH "server.log"
|
||||||
register_server_setting WHITELIST_PATH "white-list.txt"
|
register_server_setting WHITELIST_PATH "whitelist.json"
|
||||||
register_server_setting BANNED_PLAYERS_PATH "banned-players.txt"
|
register_server_setting BANNED_PLAYERS_PATH "banned-players.json"
|
||||||
register_server_setting BANNED_IPS_PATH "banned-ips.txt"
|
register_server_setting BANNED_IPS_PATH "banned-ips.json"
|
||||||
register_server_setting OPS_PATH "ops.txt"
|
register_server_setting OPS_PATH "ops.json"
|
||||||
register_server_setting OPS_LIST ""
|
register_server_setting OPS_LIST ""
|
||||||
register_server_setting JAR_PATH "server.jar"
|
register_server_setting JAR_PATH "server.jar"
|
||||||
|
|
||||||
|
8
msm.conf
8
msm.conf
@ -139,10 +139,10 @@ DEFAULT_COMPLETE_BACKUP_FOLLOW_SYMLINKS="false"
|
|||||||
# server directory
|
# server directory
|
||||||
DEFAULT_LOG_PATH="logs/latest.log"
|
DEFAULT_LOG_PATH="logs/latest.log"
|
||||||
DEFAULT_PROPERTIES_PATH="server.properties"
|
DEFAULT_PROPERTIES_PATH="server.properties"
|
||||||
DEFAULT_WHITELIST_PATH="white-list.txt"
|
DEFAULT_WHITELIST_PATH="whitelist.json"
|
||||||
DEFAULT_BANNED_PLAYERS_PATH="banned-players.txt"
|
DEFAULT_BANNED_PLAYERS_PATH="banned-players.json"
|
||||||
DEFAULT_BANNED_IPS_PATH="banned-ips.txt"
|
DEFAULT_BANNED_IPS_PATH="banned-ips.json"
|
||||||
DEFAULT_OPS_PATH="ops.txt"
|
DEFAULT_OPS_PATH="ops.json"
|
||||||
|
|
||||||
# List of comma-separated users that are added by default to ops.txt on server
|
# List of comma-separated users that are added by default to ops.txt on server
|
||||||
# creation.
|
# creation.
|
||||||
|
Loading…
Reference in New Issue
Block a user