Files
egg-hytale/start.sh
NATroutter 98ed85cef1 Moved start.sh copying to later state of the entry
Moved token exporting inside the if statments
2026-01-25 20:25:54 +02:00

107 lines
2.9 KiB
Bash

#!/bin/bash
################################################################################
# WARNING: DO NOT EDIT THIS FILE MANUALLY!
#
# This file is automatically managed by the egg-hytale.
# Any manual changes you make will be overwritten on the next update.
#
# To customize server settings, use the egg configuration variables in your
# Pelican or Pterodactyl panel instead.
################################################################################
# Build the Java command
JAVA_CMD="java"
# Add AOT cache if enabled
if [ "${LEVERAGE_AHEAD_OF_TIME_CACHE}" = "1" ]; then
JAVA_CMD="${JAVA_CMD} -XX:AOTCache=HytaleServer.aot"
fi
# Add max memory (only if SERVER_MEMORY is set and non-zero)
MEMORY_OVERHEAD=${MEMORY_OVERHEAD:-0}
if [ -n "${SERVER_MEMORY}" ] && [ "${SERVER_MEMORY}" != "0" ]; then
if [ "${SERVER_MEMORY}" -gt "${MEMORY_OVERHEAD}" ] 2>/dev/null; then
JAVA_MEMORY=$((SERVER_MEMORY - MEMORY_OVERHEAD))
else
JAVA_MEMORY=${SERVER_MEMORY}
fi
JAVA_CMD="${JAVA_CMD} -Xmx${JAVA_MEMORY}M"
fi
# Add JVM arguments if set
if [ -n "${JVM_ARGS}" ]; then
JAVA_CMD="${JAVA_CMD} ${JVM_ARGS}"
fi
JAVA_CMD="${JAVA_CMD} -jar HytaleServer.jar"
# Add assets parameter if set and ends with .zip
if [ -n "${ASSET_PACK}" ]; then
JAVA_CMD="${JAVA_CMD} --assets ${ASSET_PACK}"
fi
# Add accept-early-plugins flag if variable is set
if [ "${ACCEPT_EARLY_PLUGINS}" = "1" ]; then
JAVA_CMD="${JAVA_CMD} --accept-early-plugins"
fi
JAVA_CMD="${JAVA_CMD} --auth-mode ${AUTH_MODE}"
if [ -n "${LOGGER_LEVEL}" ]; then
JAVA_CMD="${JAVA_CMD} --log ${LOGGER_LEVEL}"
fi
if [ "${VALIDATE_WORLD_GENERATION}" = "1" ]; then
JAVA_CMD="${JAVA_CMD} --validate-world-gen"
fi
if [ "${VALIDATE_ASSETS}" = "1" ]; then
JAVA_CMD="${JAVA_CMD} --validate-assets"
fi
if [ -n "${VALIDATE_PREFABS}" ]; then
JAVA_CMD="${JAVA_CMD} --validate-prefabs ${VALIDATE_PREFABS}"
fi
# Add allow-op flag if variable is set
if [ "${ALLOW_OP}" = "1" ]; then
JAVA_CMD="${JAVA_CMD} --allow-op"
fi
# Add disable-sentry flag if enabled
if [ "${DISABLE_SENTRY}" = "1" ]; then
JAVA_CMD="${JAVA_CMD} --disable-sentry"
fi
if [ -n "${BOOT_COMMANDS}" ]; then
JAVA_CMD="${JAVA_CMD} --boot-command ${BOOT_COMMANDS}"
fi
if [ "${FORCE_NETWORK_FLUSH}" = "1" ]; then
JAVA_CMD="${JAVA_CMD} --force-network-flush"
fi
if [ "${EVENT_DEBUG}" = "1" ]; then
JAVA_CMD="${JAVA_CMD} --event-debug"
fi
# Add backup parameters if enabled
if [ "${ENABLE_BACKUPS}" = "1" ]; then
JAVA_CMD="${JAVA_CMD} --backup --backup-dir ./backup --backup-frequency ${BACKUP_FREQUENCY} --backup-max-count ${MAXIMUM_BACKUPS}"
fi
# Add session tokens
if [ -n "${SESSION_TOKEN}" ]; then
JAVA_CMD="${JAVA_CMD} --session-token ${SESSION_TOKEN}"
fi
if [ -n "${IDENTITY_TOKEN}" ]; then
JAVA_CMD="${JAVA_CMD} --identity-token ${IDENTITY_TOKEN}"
fi
# Add bind address
JAVA_CMD="${JAVA_CMD} --bind 0.0.0.0:${SERVER_PORT}"
# Execute the command
#echo "$JAVA_CMD"
eval $JAVA_CMD