mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-10-19 17:28:14 +00:00
Escape unicode in server.properties by default when less than 1.20 (#2480)
This commit is contained in:
1 parent
f5c332736d
commit
aba27ad444
2 files changed
+9
-2
No files matched your search
@@ -26,7 +26,7 @@ renders
|
|||||||
|
|
||||||
!!! note "Escape unicode"
|
!!! note "Escape unicode"
|
||||||
|
|
||||||
Some Minecraft versions and server types do not support unicode characters, such as §, in `server.properties`. In those cases, an extra "\u00C2" will appear in the file and the client will render those as  characters. Unicode characters can be written as escaped codes by setting the environment variable `SERVER_PROPERTIES_ESCAPE_UNICODE` to "true".
|
For Minecraft versions less than 1.20, unicode characters in `server.properties` will be escaped as `\uXXXX`, by default. That behavior can be altered by setting `SERVER_PROPERTIES_ESCAPE_UNICODE` to "true" or "false".
|
||||||
|
|
||||||
To produce a multi-line MOTD, embed a newline character as `\n` in the string, such as
|
To produce a multi-line MOTD, embed a newline character as `\n` in the string, such as
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ function customizeServerProps {
|
|||||||
# normalize MOTD
|
# normalize MOTD
|
||||||
if [[ ${TYPE^^} = LIMBO ]]; then
|
if [[ ${TYPE^^} = LIMBO ]]; then
|
||||||
if [[ $MOTD ]] && ! [[ $MOTD =~ ^{ ]]; then
|
if [[ $MOTD ]] && ! [[ $MOTD =~ ^{ ]]; then
|
||||||
|
# shellcheck disable=SC2089
|
||||||
MOTD="{\"text\":\"${MOTD}\"}"
|
MOTD="{\"text\":\"${MOTD}\"}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -110,11 +111,17 @@ function customizeServerProps {
|
|||||||
|
|
||||||
setPropertiesArgs=(
|
setPropertiesArgs=(
|
||||||
--definitions "/image/property-definitions.json"
|
--definitions "/image/property-definitions.json"
|
||||||
--escape-unicode="${SERVER_PROPERTIES_ESCAPE_UNICODE:-false}"
|
|
||||||
)
|
)
|
||||||
if [[ -v CUSTOM_SERVER_PROPERTIES ]]; then
|
if [[ -v CUSTOM_SERVER_PROPERTIES ]]; then
|
||||||
setPropertiesArgs+=(--custom-properties "$CUSTOM_SERVER_PROPERTIES")
|
setPropertiesArgs+=(--custom-properties "$CUSTOM_SERVER_PROPERTIES")
|
||||||
fi
|
fi
|
||||||
|
if [[ -v SERVER_PROPERTIES_ESCAPE_UNICODE ]]; then
|
||||||
|
if isTrue "$SERVER_PROPERTIES_ESCAPE_UNICODE"; then
|
||||||
|
setPropertiesArgs+=(--escape-unicode)
|
||||||
|
fi
|
||||||
|
elif versionLessThan '1.20'; then
|
||||||
|
setPropertiesArgs+=(--escape-unicode)
|
||||||
|
fi
|
||||||
|
|
||||||
handleDebugMode
|
handleDebugMode
|
||||||
if ! mc-image-helper set-properties "${setPropertiesArgs[@]}" "$SERVER_PROPERTIES"; then
|
if ! mc-image-helper set-properties "${setPropertiesArgs[@]}" "$SERVER_PROPERTIES"; then
|
||||||
|
|||||||
Reference in new issue
Block a user