Last active
May 13, 2020 20:48
-
-
Save consoleSkunk/73660a090699d36712d3991eaf0acd0f to your computer and use it in GitHub Desktop.
ClassiCube mc:// protocol launcher for Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Name=ClassiCube Protocol Handler | |
Comment=Launch ClassiCube from mc:// links online | |
Exec=/path/to/classicube-protocol.sh %u | |
Type=Application | |
MimeType=x-scheme-handler/mc; | |
NoDisplay=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Path to the ClassiCube executable | |
CLASSICUBE_PATH=./ClassiCube | |
# Enable this to always launch via Steam even if $CLASSICUBE_PATH exists | |
USE_STEAM=false | |
if [[ $1 == "mc://"* ]]; then | |
string=$(echo "$1" | sed -e 's/mc:\/\///g') | |
tokens=($(IFS='/'; echo $string )) | |
IPPORT=${tokens[0]} | |
IPPORT=($(IFS=':'; echo $IPPORT)) | |
IP=${IPPORT[0]} | |
PORT=${IPPORT[1]} | |
USER=${tokens[1]} | |
MPPASS=${tokens[2]} | |
echo "Joining ClassiCube server $IP:$PORT as $USER" | |
cd $(dirname "$(realpath $0)") | |
if [ "$USE_STEAM" = false ] && [ -f $CLASSICUBE_PATH ]; then | |
$CLASSICUBE_PATH $USER $MPPASS $IP $PORT | |
else | |
steam -applaunch 1065710 $USER $MPPASS $IP $PORT | |
fi | |
else | |
echo "Missing protocol argument, launching ClassiCube normally" | |
cd $(dirname "$(realpath $0)") | |
if [ "$USE_STEAM" = false ] && [ -f $CLASSICUBE_PATH ]; then | |
$CLASSICUBE_PATH | |
else | |
steam -applaunch 1065710 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment