#!/bin/bash

# Check if minicraft.jar exists
if [ -f "minicraft.jar" ]; then
    echo "minicraft.jar found."
else
    echo "minicraft.jar not found. Downloading the latest version..."

    # Fetch the latest release information from GitHub
    latest_release=$(curl -s https://api.github.com/repos/MinicraftPlus/minicraft-plus-online/releases/latest | grep "browser_download_url.*minicraft_plus-.*\.jar" | cut -d '"' -f 4)

    # Download the latest version of minicraft_plus.jar
    wget -O minicraft.jar $latest_release

    echo "Download complete."
fi

# Run minicraft.jar
java -jar minicraft.jar
