-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprotocol.sh
More file actions
59 lines (47 loc) · 1.03 KB
/
protocol.sh
File metadata and controls
59 lines (47 loc) · 1.03 KB
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
plugins=("Floodgate" "HolographicDisplays" "ProtocolLib" "ViaBackwards" "ViaRewind" "ViaRewind-Legacy-Support" "ViaVersion")
function loop {
for plugin in ${plugins[@]}; do
cd $plugin
projectDir=../$plugin
#if we have uncomitted changes, most likely already patched
if [ -n "$(git status --porcelain)" ]
then
echo "Uncomitted changes detected for $plugin (skipping)"
cd ..
continue
fi
pluginDir=../Patches/$plugin
# if the project is not initialized
if [ ! -d "$projectDir/.git" ]
then
git submodule update --init --recursive
fi
patchFile=$pluginDir/protocol.patch
if [[ $1 -eq 1 ]]
then
mkdir $pluginDir
echo "Creating $patchFile for $plugin"
git diff master > $patchFile
else
echo "Applying $patchFile to $plugin"
git apply --reject --whitespace=fix $patchFile
fi
cd ".."
done
echo "Complete."
}
case $1 in
"patch")
loop 0
;;
"create")
echo "Removing old patches..."
rm -r "Patches/"
mkdir Patches
loop 1
;;
*)
echo "Unknown command."
exit
;;
esac