Skip to content

Instantly share code, notes, and snippets.

@jasonk
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonk/9061794 to your computer and use it in GitHub Desktop.
Save jasonk/9061794 to your computer and use it in GitHub Desktop.
Setup script for Minecraft Bukkit, ScriptCraft, and MQTT
#!/bin/bash
cd "$(dirname "$0")"
# CraftBukkit download URL
CBURL="http://repo.bukkit.org/content/groups/public/org/bukkit/craftbukkit/1.7.2-R0.3/craftbukkit-1.7.2-R0.3.jar"
# ScriptCraft download URL
SCURL="http://scriptcraftjs.org/download/2014-02/v2.0.4/scriptcraft.jar"
# Install CraftBukkit
if [ ! -f craftbukkit.jar ]; then
curl -L -o craftbukkit.jar "$CBURL"
fi
# Make the plugins directory if it's missing
if [ ! -d plugins ]; then mkdir plugins; fi
# Install ScriptCraft
if [ ! -f plugins/scriptcraft.jar ]; then
curl -L -o plugins/scriptcraft.jar "$SCURL"
fi
# Install sc-mqtt.jar
if [ ! -f sc-mqtt.jar ]; then
curl -LO http://scriptcraftjs.org/download/extras/mqtt/sc-mqtt.jar
fi
# Install mosquitto
if [ ! -f mosquitto.conf ]; then
brew install mosquitto
touch mosquitto.conf
fi
# Make a handy link to the scriptcraft plugins directory
if [ ! -e sc-plugins ]; then
ln -s plugins/scriptcraft/plugins sc-plugins
fi
# Create a start script
if [ ! -f "start.sh" ]; then
cat <<'END' > start.sh
#!/bin/bash
cd "$(dirname "$0")"
mosquitto -c ./mosquitto.conf &
MOSQUITTO_PID=$!
java -Xmx1024M -cp sc-mqtt.jar:craftbukkit.jar org.bukkit.craftbukkit.Main
kill $MOSQUITTO_PID
END
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment