mirror of
https://github.com/NATroutter/egg-hytale.git
synced 2026-03-01 11:21:13 +03:00
Added "Maximum Backups" option to egg
Added Checks for the errors while downloading the files with account that does not have access to server files Fixed formating errors in the messages
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
"version": "PLCN_v3",
|
||||
"update_url": "https://cdn.nat.gg/egg/egg-hytale.pelican.json"
|
||||
},
|
||||
"exported_at": "2026-01-14T00:44:52+00:00",
|
||||
"exported_at": "2026-01-14T09:33:33+00:00",
|
||||
"name": "Hytale",
|
||||
"author": "contact@natroutter.fi",
|
||||
"uuid": "6594b287-2d7b-4249-bc93-4d40283c57e3",
|
||||
@@ -182,6 +182,20 @@
|
||||
],
|
||||
"sort": 8
|
||||
},
|
||||
{
|
||||
"name": "Maximum Backups",
|
||||
"description": "The maximum number of backups to keep. When this limit is reached, the oldest backups will be deleted automatically.",
|
||||
"env_variable": "MAXIMUM_BACKUPS",
|
||||
"default_value": "5",
|
||||
"user_viewable": true,
|
||||
"user_editable": true,
|
||||
"rules": [
|
||||
"integer",
|
||||
"min:1",
|
||||
"required"
|
||||
],
|
||||
"sort": 14
|
||||
},
|
||||
{
|
||||
"name": "Memory overhead",
|
||||
"description": "The amount of RAM (in MB) kept aside for the system so the server doesn\u2019t use everything. Java will get the rest.",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"version": "PTDL_v2",
|
||||
"update_url": "https:\/\/raw.githubusercontent.com\/NATroutter\/egg-hytale\/refs\/heads\/main\/egg-hytale.pterodactyl.json"
|
||||
},
|
||||
"exported_at": "2026-01-14T02:45:29+02:00",
|
||||
"exported_at": "2026-01-14T11:33:06+02:00",
|
||||
"name": "Hytale",
|
||||
"author": "contact@natroutter.fi",
|
||||
"description": "Hytale is a block-based sandbox game that blends creative building with RPG adventure. Explore procedurally generated worlds filled with unique biomes, dungeons, and creatures. Build anything from simple homes to grand castles, craft items, and battle monsters. Create custom content with built-in modding tools, host your own servers, and shape the experience with plugins and mods. Play solo or with friends in a world designed for both creation and exploration.\r\n\r\nCredits:\r\n- Made by NATroutter\r\n- https:\/\/natroutter.fi\r\n- https:\/\/github.com\/NATroutter",
|
||||
@@ -159,6 +159,16 @@
|
||||
"user_editable": true,
|
||||
"rules": "required|integer|min:0",
|
||||
"field_type": "text"
|
||||
},
|
||||
{
|
||||
"name": "Maximum Backups",
|
||||
"description": "The maximum number of backups to keep. When this limit is reached, the oldest backups will be deleted automatically.",
|
||||
"env_variable": "MAXIMUM_BACKUPS",
|
||||
"default_value": "5",
|
||||
"user_viewable": true,
|
||||
"user_editable": true,
|
||||
"rules": "required|integer|min:1",
|
||||
"field_type": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
83
entry.sh
83
entry.sh
@@ -25,7 +25,7 @@ extract_server_files() {
|
||||
SERVER_ZIP="server.zip"
|
||||
|
||||
if [ -f "$SERVER_ZIP" ]; then
|
||||
echo "Found server archive: $SERVER_ZIP"
|
||||
echo "✓ Found server archive: $SERVER_ZIP"
|
||||
|
||||
# Extract to current directory
|
||||
unzip -o "$SERVER_ZIP"
|
||||
@@ -35,7 +35,7 @@ extract_server_files() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Extraction completed successfully."
|
||||
echo "✓ Extraction completed successfully."
|
||||
|
||||
# Move contents from Server folder to current directory
|
||||
if [ -d "Server" ]; then
|
||||
@@ -185,7 +185,7 @@ perform_authentication() {
|
||||
POLL_INTERVAL=$(echo "$AUTH_RESPONSE" | jq -r '.interval')
|
||||
|
||||
# Display authentication banner
|
||||
echo ""
|
||||
echo " "
|
||||
echo "╔═════════════════════════════════════════════════════════════════════════════╗"
|
||||
echo "║ HYTALE SERVER AUTHENTICATION REQUIRED ║"
|
||||
echo "╠═════════════════════════════════════════════════════════════════════════════╣"
|
||||
@@ -201,7 +201,7 @@ perform_authentication() {
|
||||
echo "║ Waiting for authentication... ║"
|
||||
echo "║ ║"
|
||||
echo "╚═════════════════════════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo " "
|
||||
|
||||
# Step 2: Poll for access token
|
||||
ACCESS_TOKEN=""
|
||||
@@ -221,7 +221,7 @@ perform_authentication() {
|
||||
echo "Still waiting for authentication..."
|
||||
continue
|
||||
elif [ -n "$ERROR" ]; then
|
||||
echo "Authentication error: $ERROR"
|
||||
echo "⨯ Authentication error: $ERROR"
|
||||
exit 1
|
||||
else
|
||||
# Successfully authenticated
|
||||
@@ -305,20 +305,42 @@ INITIAL_SETUP=0
|
||||
if [ ! -f ".hytale-downloader-credentials.json" ]; then
|
||||
INITIAL_SETUP=1
|
||||
echo "Credentials file not found, running initial setup..."
|
||||
echo "Starting Hytale downloader..."
|
||||
echo "Downloading server files..."
|
||||
|
||||
$DOWNLOADER -check-update
|
||||
$DOWNLOADER -patchline $PATCHLINE -download-path server.zip
|
||||
|
||||
echo " "
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " NOTE: You must own Hytale with the account you authenticate"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " "
|
||||
|
||||
if ! $DOWNLOADER -patchline $PATCHLINE -download-path server.zip; then
|
||||
echo ""
|
||||
echo "Error: Failed to download Hytale server files."
|
||||
echo "This may indicate:"
|
||||
echo " - You haven't purchased Hytale"
|
||||
echo " - Authentication credentials are invalid or expired"
|
||||
echo ""
|
||||
echo "Removing invalid credential file..."
|
||||
rm -f .hytale-downloader-credentials.json
|
||||
exit 1
|
||||
fi
|
||||
|
||||
extract_server_files
|
||||
|
||||
# Save version info after initial setup
|
||||
DOWNLOADER_VERSION=$($DOWNLOADER -print-version)
|
||||
echo "$DOWNLOADER_VERSION" > version.txt
|
||||
echo "Version info saved for later use!"
|
||||
DOWNLOADER_VERSION=$($DOWNLOADER -print-version 2>&1)
|
||||
|
||||
if [ $? -eq 0 ] && [ -n "$DOWNLOADER_VERSION" ]; then
|
||||
echo "$DOWNLOADER_VERSION" > version.txt
|
||||
echo "✓ Saved version info to version.txt!"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run automatic update if enabled
|
||||
if [ "${AUTOMATIC_UPDATE}" = "1" ] && [ "${INITIAL_SETUP}" = "0" ]; then
|
||||
echo "Starting Hytale downloader..."
|
||||
echo "Checking for updates..."
|
||||
|
||||
# Read local version from file
|
||||
if [ -f "version.txt" ]; then
|
||||
@@ -329,24 +351,31 @@ if [ "${AUTOMATIC_UPDATE}" = "1" ] && [ "${INITIAL_SETUP}" = "0" ]; then
|
||||
fi
|
||||
|
||||
# Get remote/downloader version
|
||||
DOWNLOADER_VERSION=$($DOWNLOADER -print-version)
|
||||
DOWNLOADER_VERSION=$($DOWNLOADER -print-version 2>&1)
|
||||
|
||||
echo "Local version: $LOCAL_VERSION"
|
||||
echo "Downloader version: $DOWNLOADER_VERSION"
|
||||
|
||||
# Compare versions
|
||||
if [ "$LOCAL_VERSION" != "$DOWNLOADER_VERSION" ]; then
|
||||
echo "Version mismatch, running update..."
|
||||
|
||||
$DOWNLOADER -check-update
|
||||
$DOWNLOADER -patchline $PATCHLINE -download-path server.zip
|
||||
extract_server_files
|
||||
|
||||
# Update version.txt after successful update
|
||||
echo "$DOWNLOADER_VERSION" > version.txt
|
||||
echo "Version info saved for later use!"
|
||||
# Check if version command failed
|
||||
if [ $? -ne 0 ] || [ -z "$DOWNLOADER_VERSION" ]; then
|
||||
echo "Error: Failed to get downloader version. This may indicate authentication issues."
|
||||
echo "Output: $DOWNLOADER_VERSION"
|
||||
exit 1
|
||||
else
|
||||
echo "Versions match, skipping update"
|
||||
echo "Local version: $LOCAL_VERSION"
|
||||
echo "Downloader version: $DOWNLOADER_VERSION"
|
||||
|
||||
# Compare versions
|
||||
if [ "$LOCAL_VERSION" != "$DOWNLOADER_VERSION" ]; then
|
||||
echo "⨯ Version mismatch, running update..."
|
||||
|
||||
$DOWNLOADER -check-update
|
||||
$DOWNLOADER -patchline $PATCHLINE -download-path server.zip
|
||||
extract_server_files
|
||||
|
||||
# Update version.txt after successful update
|
||||
echo "$DOWNLOADER_VERSION" > version.txt
|
||||
echo "✓ Saved version info to version.txt!"
|
||||
else
|
||||
echo "⨯ Versions match, skipping update"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
4
start.sh
4
start.sh
@@ -57,7 +57,7 @@ fi
|
||||
|
||||
# Add backup parameters if enabled
|
||||
if [ "${ENABLE_BACKUPS}" = "1" ]; then
|
||||
JAVA_CMD="${JAVA_CMD} --backup --backup-dir ./backup --backup-frequency ${BACKUP_FREQUENCY}"
|
||||
JAVA_CMD="${JAVA_CMD} --backup --backup-dir ./backup --backup-frequency ${BACKUP_FREQUENCY} --backup-max-count ${MAXIMUM_BACKUPS}"
|
||||
fi
|
||||
|
||||
# Add session tokens and owner UUID
|
||||
@@ -69,4 +69,4 @@ JAVA_CMD="${JAVA_CMD} --owner-uuid ${PROFILE_UUID}"
|
||||
JAVA_CMD="${JAVA_CMD} --bind 0.0.0.0:${SERVER_PORT}"
|
||||
|
||||
# Execute the command
|
||||
eval $JAVA_CMD
|
||||
eval $JAVA_CMD
|
||||
Reference in New Issue
Block a user