mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
0ade5595ad
not sure if this is source of #1365, but doesn't hurt to make this a non fatal error if the symlink command fails.
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
(
|
|
set -e
|
|
PS1="$"
|
|
basedir="$(cd "$1" && pwd -P)"
|
|
workdir="$basedir/work"
|
|
minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
|
windows="$([[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]] && echo "true" || echo "false")"
|
|
decompiledir="$workdir/Minecraft/$minecraftversion"
|
|
classdir="$decompiledir/classes"
|
|
echo "Extracting NMS classes..."
|
|
if [ ! -d "$classdir" ]; then
|
|
mkdir -p "$classdir"
|
|
cd "$classdir"
|
|
jar xf "$decompiledir/$minecraftversion-mapped.jar" net/minecraft/server
|
|
if [ "$?" != "0" ]; then
|
|
cd "$basedir"
|
|
echo "Failed to extract NMS classes."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "Decompiling classes..."
|
|
if [ ! -d "$decompiledir/net/minecraft/server" ]; then
|
|
cd "$basedir"
|
|
java -jar "$workdir/BuildData/bin/fernflower.jar" -dgs=1 -hdc=0 -asc=1 -udv=0 "$classdir" "$decompiledir"
|
|
if [ "$?" != "0" ]; then
|
|
echo "Failed to decompile classes."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# set a symlink to current
|
|
currentlink="$workdir/Minecraft/current"
|
|
if ([ ! -e "$currentlink" ] || [ -L "$currentlink" ]) && [ "$windows" == "false" ]; then
|
|
set +e
|
|
echo "Pointing $currentlink to $minecraftversion"
|
|
rm -rf "$currentlink" || true
|
|
ln -sfn "$minecraftversion" "$currentlink" || echo "Failed to set current symlink"
|
|
fi
|
|
|
|
)
|