forked from NATroutter/egg-hytale
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
108 lines (85 loc) · 2.96 KB
/
Copy pathstart.sh
File metadata and controls
108 lines (85 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/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.
################################################################################
echo "Starting Hytale server..."
# 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 if set and greater than MEMORY_OVERHEAD
if [ -n "${SERVER_MEMORY}" ] && [ "${SERVER_MEMORY}" -gt "${MEMORY_OVERHEAD}" ] 2>/dev/null; then
JAVA_MEMORY=$((SERVER_MEMORY - MEMORY_OVERHEAD))
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}" ] && [[ "${ASSET_PACK}" == *.zip ]]; 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 and owner UUID
if [ -n "${SESSION_TOKEN}" ]; then
JAVA_CMD="${JAVA_CMD} --session-token ${SESSION_TOKEN}"
else
echo "Warning: SESSION_TOKEN is not set"
fi
if [ -n "${IDENTITY_TOKEN}" ]; then
JAVA_CMD="${JAVA_CMD} --identity-token ${IDENTITY_TOKEN}"
else
echo "Warning: IDENTITY_TOKEN is not set"
fi
# Add bind address
JAVA_CMD="${JAVA_CMD} --bind 0.0.0.0:${SERVER_PORT}"
# Execute the command
# echo $JAVA_CMD
eval $JAVA_CMD