mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
- Replace `source ~/.zshrc` with `source "$REPO_ROOT/tools/mcc-env.sh"` in
ensure_offline_server.sh and run_full_spectrum_test.sh
- Convert both scripts from zsh to bash (#!/usr/bin/env bash) so mcc-env.sh
can be sourced natively; replace ${0:A:h} with portable SCRIPT_DIR expansion
- Update SKILL.md: drop ~/.zshrc references, point to tools/mcc-env.sh and
standalone tools/start-server.sh + tools/mc-rcon.sh; update server path
from ~/Minecraft/Servers/ to MinecraftOfficial/downloads/; replace
`mcc-build` with `dotnet build MinecraftClient.sln -c Release`
- Update evals.json expectation to match new workflow
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/1ff08b70-7be3-4211-9b77-a9e10ff1d157
85 lines
2 KiB
Bash
Executable file
85 lines
2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
# shellcheck source=tools/mcc-env.sh
|
|
source "$REPO_ROOT/tools/mcc-env.sh"
|
|
|
|
VERSION="${1:-1.21.11-Vanilla}"
|
|
SERVER_DIR="${MCC_SERVERS:?}/$VERSION"
|
|
PROPS_FILE="$SERVER_DIR/server.properties"
|
|
SESSION_NAME="mc-${VERSION//./_}"
|
|
|
|
if [[ ! -d "$SERVER_DIR" ]]; then
|
|
echo "Server directory not found: $SERVER_DIR" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -f "$SERVER_DIR/eula.txt" ]] || ! grep -Eq '^eula=true$' "$SERVER_DIR/eula.txt"; then
|
|
echo "Missing accepted EULA in $SERVER_DIR/eula.txt" >&2
|
|
exit 1
|
|
fi
|
|
|
|
server_running() {
|
|
mc-list | grep -Fq "$SESSION_NAME"
|
|
}
|
|
|
|
wait_for_server_ready() {
|
|
local timeout="${1:-60}"
|
|
local elapsed=0
|
|
while (( elapsed < timeout )); do
|
|
if mc-log "$VERSION" 200 2>/dev/null | grep -Fq "Done ("; then
|
|
return 0
|
|
fi
|
|
sleep 1
|
|
((elapsed += 1))
|
|
done
|
|
echo "Timed out waiting for $VERSION to become ready" >&2
|
|
return 1
|
|
}
|
|
|
|
wait_for_server_stop() {
|
|
local timeout="${1:-60}"
|
|
local elapsed=0
|
|
while (( elapsed < timeout )); do
|
|
if ! server_running; then
|
|
return 0
|
|
fi
|
|
sleep 1
|
|
((elapsed += 1))
|
|
done
|
|
echo "Timed out waiting for $VERSION to stop" >&2
|
|
return 1
|
|
}
|
|
|
|
upsert_property() {
|
|
local key="$1"
|
|
local value="$2"
|
|
|
|
if grep -Eq "^${key}=" "$PROPS_FILE"; then
|
|
sed -i "s#^${key}=.*#${key}=${value}#" "$PROPS_FILE"
|
|
else
|
|
printf '%s=%s\n' "$key" "$value" >> "$PROPS_FILE"
|
|
fi
|
|
}
|
|
|
|
if [[ ! -f "$PROPS_FILE" ]]; then
|
|
mc-start "$VERSION"
|
|
wait_for_server_ready
|
|
mc-stop "$VERSION"
|
|
wait_for_server_stop
|
|
fi
|
|
|
|
if server_running; then
|
|
mc-stop "$VERSION"
|
|
wait_for_server_stop
|
|
fi
|
|
|
|
upsert_property "online-mode" "false"
|
|
upsert_property "enforce-secure-profile" "false"
|
|
upsert_property "enable-rcon" "true"
|
|
upsert_property "rcon.port" "25575"
|
|
upsert_property "rcon.password" "test123"
|
|
|
|
echo "Configured $VERSION for persistent offline testing"
|