summaryrefslogtreecommitdiff
path: root/bin/extra/gml
blob: 0f2f14320e4db1c5dc902f58480fa718bc770735 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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
)"