2021-04-22 01:29:52 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2021-04-22 02:57:00 +00:00
|
|
|
if [ ! -d "mosfet" ]
|
|
|
|
then
|
|
|
|
echo "You must run this from the mosfet-minecraft-bot directory."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-04-22 01:40:01 +00:00
|
|
|
if ! command -v virtualenv &> /dev/null
|
|
|
|
then
|
|
|
|
echo "virtualenv could not be found, please install with:"
|
|
|
|
echo "sudo apt install python3-virtualenv"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! command -v wget &> /dev/null
|
|
|
|
then
|
|
|
|
echo "wget could not be found, please install with:"
|
|
|
|
echo "sudo apt install wget"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! command -v unzip &> /dev/null
|
|
|
|
then
|
|
|
|
echo "unzip could not be found, please install with:"
|
|
|
|
echo "sudo apt install unzip"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! command -v python3 &> /dev/null
|
|
|
|
then
|
|
|
|
echo "python3 could not be found, please install with:"
|
|
|
|
echo "sudo apt install python3"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! command -v pip3 &> /dev/null
|
|
|
|
then
|
|
|
|
echo "pip3 could not be found, please install with:"
|
|
|
|
echo "sudo apt install pip3"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2021-04-22 01:29:52 +00:00
|
|
|
# download minecraft data
|
|
|
|
|
|
|
|
if [ ! -d "minecraft_data" ]
|
|
|
|
then
|
|
|
|
echo "Grabbing minecraft data..."
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
VERSION="1.16.4"
|
|
|
|
|
|
|
|
wget -Omcdata.zip "https://apimon.de/mcdata/$VERSION/$VERSION.zip"
|
|
|
|
mkdir minecraft_data
|
|
|
|
unzip mcdata.zip -d minecraft_data
|
|
|
|
rm mcdata.zip
|
|
|
|
fi
|
|
|
|
|
|
|
|
# create virtual environment
|
|
|
|
|
|
|
|
if [ ! -d "env" ]
|
|
|
|
then
|
|
|
|
echo "Installing Python requirements..."
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
virtualenv -p python3 env
|
|
|
|
source env/bin/activate
|
|
|
|
pip install -r requirements.txt
|
|
|
|
else
|
|
|
|
source env/bin/activate
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Running bot..."
|
|
|
|
|
|
|
|
python main.py
|