ConvertBase64toServerProfile.py

This commit is contained in:
Jonathan Jara 2025-04-17 17:11:30 -07:00
parent 5260bd6a24
commit 5ef0734d5e
2 changed files with 14 additions and 4 deletions

View File

@ -0,0 +1,9 @@
import base64
import sys
base64_data = open(sys.argv[1], "r").read()
output_file = sys.argv[1].replace(".txt", ".png")
with open(output_file, "wb") as f:
f.write(base64.b64decode(base64_data.strip()))

View File

@ -1,23 +1,24 @@
# Andromeda
This repository contains two scripts, chooseIcon.sh and motd.sh, that dynamically randomize the Minecraft server's icon and message of the day (MOTD) on startup.
## Purpose
- chooseIcon.sh: Randomly selects a PNG icon (icon*.png) from /home/minecraft/icons and sets it as the server-icon.png.
- motd.sh: Randomly selects a line from one of the motd*.txt files in /home/minecraft/motd and updates the motd field in your server.properties.
- ConvertBase64toServerProfile.py: Converts Base64 encoded image from old server info found in NBT files and converts it back to an image for a server icon.
Requirements
- The icons must be stored in: /home/minecraft/icons
- The icons must be stored in: ./icons
- The MOTD text files must be stored in: /home/minecraft/motd
- The MOTD text files must be stored in: ./motd
- The Minecraft server.properties file must be located within the server directory or a subdirectory of where the script is called.
## Usage
To use these scripts, call them from your Minecraft server's start.sh script before the server starts.
To use chooseIcon.sh and motd.sh scripts, call them from your Minecraft server's start.sh script before the server starts.
If your start.sh file is outside the server directory (i.e., the server is in a subdirectory), you must provide the server directory as a parameter when calling motd.sh.
Example start.sh (located one level above the server folder):