summaryrefslogtreecommitdiff
path: root/bin/extra/gml
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-10-15 00:33:26 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-10-15 00:33:26 +0200
commit826ce094fecc4c6e07faf6e8b91387c2ae49842c (patch)
tree1820c843e4e260f6b51e8d269a972295a17e558c /bin/extra/gml
parentc032a9d071ee4b7eb2bfe79ec03d2a7dc4020f15 (diff)
parenta915b5ade1a47b9678e2f9963b13b49dbd406031 (diff)
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/extra/gml')
-rwxr-xr-xbin/extra/gml70
1 files changed, 70 insertions, 0 deletions
diff --git a/bin/extra/gml b/bin/extra/gml
new file mode 100755
index 0000000..0f2f143
--- /dev/null
+++ b/bin/extra/gml
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+minecraft()
+{
+ instance="$(
+ (
+ printf "default\n"
+ find ~/.local/share/multimc/instances \
+ -maxdepth 1 -mindepth 1 \
+ -type d \
+ -printf "%f\n" |
+ grep -v '_LAUNCHER_TEMP'
+ ) |
+ commander -d -c -x)"
+
+ [ "$instance" ] || exit 1
+ [ "$instance" = "default" ] && instance="1.20.1"
+
+ ips="none 192.168.178.79 192.168.178.52 10.7.0.1 mc.hypixel.net"
+ ip="$(for ip in $ips
+ do printf "%s\n" "$ip"
+ done | commander -d -c)"
+
+ if [ "$ip" != 'none' ]
+ then setsid multimc -l "$instance" -s "$ip" > /dev/null 2>&1
+ else
+
+ world="$(
+ (
+ printf "none\n"
+ find "$HOME"/.local/share/multimc/instances/"$instance"/.minecraft/saves/ \
+ -mindepth 1 -maxdepth 1 \
+ -type d \
+ -printf "%f\n"
+ ) | commander -d -c -s)"
+
+ [ -z "$world" ] && exit 1
+
+ if [ "$world" = 'none' ]
+ then setsid multimc -l "$instance" > /dev/null 2>&1
+ else setsid multimc -l "$instance" -w "$world" > /dev/null 2>&1
+ fi
+
+ fi
+}
+
+steam()
+{
+ choice="$(
+ cat <<-EOF | column -t -l 2 | commander -d -x -c | awk '{printf $1}'
+ 274190 broforce
+ 291550 brawlhalla
+ 1712840 tiny tina
+ 105600 terraria
+ kill
+EOF
+ )"
+ case "$choice" in
+ kill) pkill steam ;;
+ *) setsid steam steam://rungameid/"$choice" ;;
+ esac
+ exit
+}
+
+eval "$(
+ cat <<-EOF | commander -c -w 9 -y 2
+ minecraft
+ steam
+ EOF
+)"