Initial commit + scripts from sportpaper

This commit is contained in:
virtualWinter 2023-07-21 04:52:21 +03:00
commit 3db356d228
20 changed files with 696 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
/.idea/
/.vscode/
/base/mc-dev/
/mSpigot-API/
/mSpigot-Server/
*.iml
*.DS_Store

7
.gitmodules vendored Normal file
View File

@ -0,0 +1,7 @@
[submodule "base/Paper"]
path = base/Paper
url = https://git.sigmagaming.net/CatMC-Network/PaperSpigot-Parent.git
branch = ver/1.8.8
[submodule "builddata"]
path = builddata
url = https://hub.spigotmc.org/stash/scm/spigot/builddata.git

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# mSpigot
mSpigot but 1.8.8

1
base/.upstream-state Normal file
View File

@ -0,0 +1 @@
1.8.8--0af73b26380e0d6aab8b18e9f740e8a33ecec98b

1
base/Paper Submodule

@ -0,0 +1 @@
Subproject commit 2894af04dc378d6a61e55e37a8c0b1a478c09c3d

1
builddata Submodule

@ -0,0 +1 @@
Subproject commit faff587dcbe915bc565bf01f2d54c6af86039414

80
mspigot Normal file
View File

@ -0,0 +1,80 @@
#!/usr/bin/env bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
basedir=$(dirname "$SOURCE")
. "$basedir/scripts/init.sh"
paperstash() {
STASHED=$(git stash)
}
paperunstash() {
if [[ "$STASHED" != "No local changes to save" ]] ; then
git stash pop
fi
}
buildpaperclipjar() {
cp -f scripts/basepaperclip.sh base/Paper/paperclip.sh
cd base/Paper
./paperclip.sh
cd "$basedir"
}
case "$1" in
"setup")
cd "$basedir"
scripts/upstream.sh
;;
"build")
log_info "Preparing to build mSpigot"
cd "$basedir"
scripts/upstream.sh
scripts/apply.sh "$basedir"
mvn --batch-mode clean install
# buildpaperclipjar
;;
"rb" | "rbp" | "rebuild")
(
set -e
cd "$basedir"
scripts/rebuildpatches.sh "$basedir"
)
;;
"p" | "patch" | "apply")
(
set -e
cd "$basedir"
scripts/apply.sh "$basedir"
log_info " Run './mspigot jar' to create a runnable JAR."
)
;;
"j" | "jar")
(
set -e
mvn --batch-mode clean install
# buildpaperclipjar
)
;;
*)
echo "mSpigot build tool."
echo ""
echo " Commands:"
echo " * setup | Setup the build environment"
echo " * build | Setup the build environment, apply patches, and create a runnable JAR"
echo " * p, patch | Apply patches"
echo " * rb, rebuild | Rebuild patches"
echo " * j, jar | Create a runnable JAR"
;;
esac
unset -f paperstash
unset -f paperunstash

0
patches/api/.gitkeep Normal file
View File

0
patches/server/.gitkeep Normal file
View File

33
pom.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.hylist</groupId>
<artifactId>spigot-parent</artifactId>
<version>dev-SNAPSHOT</version>
<packaging>pom</packaging>
<description>Production version of Spigot for Hylist servers. Ported to 1.8.8</description>
<repositories>
<repository>
<id>sonatype-repo</id>
<url>https://oss.sonatype.org/content/groups/public</url>
</repository>
<repository>
<id>spigotmc-public</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public</url>
</repository>
<repository>
<id>md_5-releases</id>
<url>http://repo.md-5.net/content/repositories/releases/</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>mSpigot-API</module>
<module>mSpigot-Server</module>
</modules>
</project>

62
scripts/apply.sh Normal file
View File

@ -0,0 +1,62 @@
#!/bin/bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
initScript=$(dirname "$SOURCE")/init.sh
. "$initScript"
PS1="$"
paperVer=$(cat base/.upstream-state)
log_info "Applying mSpigot patches"
function applyPatch {
what=$1
what_name=$(dirname "$what")
target=$2
branch=$3
patch_folder=$4
cd "$basedir/$what"
git fetch --all
git branch -f upstream "$branch" >/dev/null 2>&1
cd "$basedir"
if [ ! -d "$basedir/$target" ]; then
mkdir "$basedir/$target"
cd "$basedir/$target"
git init
cd "$basedir"
fi
cd "$basedir/$target"
echo "Resetting $target to $what_name..."
git remote rm upstream > /dev/null 2>&1
git remote add upstream "$basedir/$what" >/dev/null 2>&1
git checkout master 2>/dev/null || git checkout -b master
git fetch upstream >/dev/null 2>&1
git reset --hard upstream/upstream
echo " Applying patches to $target..."
git am --abort >/dev/null 2>&1
for patchFile in "$basedir/patches/$patch_folder/"*.patch
do
git am --3way --ignore-whitespace "$patchFile"
done
#git am --3way --ignore-whitespace "$basedir/patches/$patch_folder/*.patch"
if [ "$?" != "0" ]; then
echo " Something did not apply cleanly to $target."
echo " Please review above details and finish the apply then"
echo " save the changes with rebuildPatches.sh"
exit 1
else
echo " Patches applied cleanly to $target"
fi
}
log_info "Applying mSpigot API patches"
applyPatch base/Paper/PaperSpigot-API mSpigot-API HEAD api
log_info "Applying mSpigot server patches"
applyPatch base/Paper/PaperSpigot-Server mSpigot-Server HEAD server
log_info "Patches successfully applied."

39
scripts/basedecompile.sh Normal file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
basedir=$(dirname "$SOURCE")
PS1="$"
workdir="$basedir/work"
minecraftversion="$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)"
decompiledir="$workdir/$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 BuildData/bin/fernflower.jar -dgs=1 -hdc=0 -rbr=0 -asc=1 -udv=0 "$classdir" "$decompiledir"
if [ "$?" != "0" ]; then
echo "Failed to decompile classes."
exit 1
fi
fi

44
scripts/baseinit.sh Normal file
View File

@ -0,0 +1,44 @@
#!/usr/bin/env bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
basedir=$(dirname "$SOURCE")
PS1="$"
workdir="$basedir/work"
minecraftversion="$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)"
decompiledir="$workdir/$minecraftversion"
nms="$decompiledir/net/minecraft/server"
cb=src/main/java/net/minecraft/server
patch="$(which patch 2>/dev/null)"
if [ "x$patch" == "x" ]; then
patch="$basedir/hctap.exe"
fi
echo "Applying CraftBukkit patches to NMS..."
cd "$basedir/CraftBukkit"
git checkout -B patched HEAD >/dev/null 2>&1
rm -rf "$cb"
mkdir -p "$cb"
for file in $(ls nms-patches)
do
patchFile="nms-patches/$file"
file="$(echo $file | cut -d. -f1).java"
echo "Patching $file < $patchFile"
sed -i'' -e 's/\r//' "$nms/$file" > /dev/null
cp "$nms/$file" "$cb/$file"
"$patch" -s -d src/main/java/ "net/minecraft/server/$file" < "$patchFile"
done
git add src >/dev/null 2>&1
git commit -m "CraftBukkit $ $(date)" >/dev/null 2>&1
git checkout -f HEAD^ >/dev/null 2>&1

View File

@ -0,0 +1,57 @@
#!/usr/bin/env bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
basedir=$(dirname "$SOURCE")
PS1="$"
applycmd="git am --3way --ignore-whitespace"
# Windows detection to workaround ARG_MAX limitation
windows="$([[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]] && echo "true" || echo "false")"
echo "Rebuilding Forked projects.... "
function applyPatch {
what="$1"
target="$2"
branch="$3"
cd "$basedir/$what"
git fetch
git branch -f upstream "$branch" >/dev/null
cd "$basedir"
if [ ! -d "$basedir/$target" ]; then
git clone "$what" "$target"
fi
cd "$basedir/$target"
echo "Resetting $target to $what..."
git remote add -f upstream ../$what >/dev/null 2>&1
git checkout master >/dev/null 2>&1
git fetch upstream >/dev/null 2>&1
git reset --hard upstream/upstream
echo " Applying patches to $target..."
git am --abort >/dev/null 2>&1
# Special case Windows handling because of ARG_MAX constraint
if [[ $windows == "true" ]]; then
echo " Using workaround for Windows ARG_MAX constraint"
find "$basedir/${what}-Patches/"*.patch -print0 | xargs -0 $applycmd
else
$applycmd "$basedir/${what}-Patches/"*.patch
fi
if [ "$?" != "0" ]; then
echo " Something did not apply cleanly to $target."
echo " Please review above details and finish the apply then"
echo " save the changes with rebuildPatches.sh"
exit 1
else
echo " Patches applied cleanly to $target"
fi
}
applyPatch Bukkit Spigot-API HEAD && applyPatch CraftBukkit Spigot-Server patched
applyPatch Spigot-API PaperSpigot-API HEAD && applyPatch Spigot-Server PaperSpigot-Server HEAD

79
scripts/baseremap.sh Normal file
View File

@ -0,0 +1,79 @@
#!/usr/bin/env bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
basedir=$(dirname "$SOURCE")
PS1="$"
workdir="$basedir/work"
minecraftversion="$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)"
minecrafthash="$(cat BuildData/info.json | grep minecraftHash | cut -d '"' -f 4)"
accesstransforms="BuildData/mappings/$(cat BuildData/info.json | grep accessTransforms | cut -d '"' -f 4)"
classmappings="BuildData/mappings/$(cat BuildData/info.json | grep classMappings | cut -d '"' -f 4)"
membermappings="BuildData/mappings/$(cat BuildData/info.json | grep memberMappings | cut -d '"' -f 4)"
packagemappings="BuildData/mappings/$(cat BuildData/info.json | grep packageMappings | cut -d '"' -f 4)"
jarpath="$workdir/$minecraftversion/$minecraftversion"
echo "Downloading unmapped vanilla jar..."
if [ ! -f "$jarpath.jar" ]; then
mkdir -p "$workdir/$minecraftversion"
curl -s -o "$jarpath.jar" "https://launcher.mojang.com/v1/objects/5fafba3f58c40dc51b5c3ca72a98f62dfdae1db7/server.jar"
if [ "$?" != "0" ]; then
echo "Failed to download the vanilla server jar. Check connectivity or try again later."
exit 1
fi
fi
# OS X doesn't have md5sum, just md5 -r
if [[ "$OSTYPE" == "darwin"* ]]; then
shopt -s expand_aliases
alias md5sum='md5 -r'
echo "Using an alias for md5sum on OS X"
fi
checksum="$(md5sum "$jarpath.jar" | cut -d ' ' -f 1)"
if [ "$checksum" != "$minecrafthash" ]; then
echo "The MD5 checksum of the downloaded server jar does not match the BuildData hash."
exit 1
fi
echo "Applying class mappings..."
if [ ! -f "$jarpath-cl.jar" ]; then
java -jar BuildData/bin/SpecialSource-2.jar map -i "$jarpath.jar" -m "$classmappings" -o "$jarpath-cl.jar" 1>/dev/null
if [ "$?" != "0" ]; then
echo "Failed to apply class mappings."
exit 1
fi
fi
echo "Applying member mappings..."
if [ ! -f "$jarpath-m.jar" ]; then
java -jar BuildData/bin/SpecialSource-2.jar map -i "$jarpath-cl.jar" -m "$membermappings" -o "$jarpath-m.jar" 1>/dev/null
if [ "$?" != "0" ]; then
echo "Failed to apply member mappings."
exit 1
fi
fi
echo "Creating remapped jar..."
if [ ! -f "$jarpath-mapped.jar" ]; then
java -jar BuildData/bin/SpecialSource.jar --kill-lvt -i "$jarpath-m.jar" --access-transformer "$accesstransforms" -m "$packagemappings" -o "$jarpath-mapped.jar" 1>/dev/null
if [ "$?" != "0" ]; then
echo "Failed to create remapped jar."
exit 1
fi
fi
echo "Installing remapped jar..."
cd CraftBukkit # Need to be in a directory with a valid POM at the time of install.
mvn --batch-mode install:install-file -q -Dfile="$jarpath-mapped.jar" -Dpackaging=jar -DgroupId=org.spigotmc -DartifactId=minecraft-server -Dversion="$minecraftversion-SNAPSHOT"
if [ "$?" != "0" ]; then
echo "Failed to install remapped jar."
exit 1
fi

View File

@ -0,0 +1,45 @@
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
initScript=$(dirname "$SOURCE")/init.sh
. "$initScript"
cd "$basedir"
paperVer=$(cat base/.upstream-state)
minecraftversion=$(cat "$basedir/base/Paper/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
decompile="base/Paper/work/$minecraftversion/"
mkdir -p base/mc-dev/src/net/minecraft/server
cd base/mc-dev
if [ ! -d ".git" ]; then
git init
fi
#cp $(sed 's/ /\\ /g' <<< $basedir)/$decompile/net/minecraft/server/*.java src/net/minecraft/server
for nmsFile in "$basedir/$decompile/net/minecraft/server/"*.java
do
cp "$nmsFile" "src/net/minecraft/server"
done
base="$basedir/base/Paper/PaperSpigot-Server/src/main/java/net/minecraft/server"
cd "$basedir/base/mc-dev/src/net/minecraft/server/"
for file in $(/bin/ls "$base")
do
if [ -f "$file" ]; then
rm -f "$file"
fi
done
cd "$basedir/base/mc-dev"
git add . -A
git commit . -m "mc-dev"
git tag -a "$paperVer" -m "$paperVer" 2>/dev/null

68
scripts/importmcdev.sh Normal file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env bash
(
set -e
nms="net/minecraft/server"
export MODLOG=""
PS1="$"
basedir="$(cd "$1" && pwd -P)"
workdir="$basedir/base/Paper/work"
minecraftversion=$(cat "$basedir/base/Paper/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
decompiledir="$workdir/$minecraftversion"
export importedmcdev=""
function import {
export importedmcdev="$importedmcdev $1"
file="${1}.java"
target="$basedir/base/Paper/PaperSpigot-Server/src/main/java/$nms/$file"
base="$decompiledir/$nms/$file"
if [[ ! -f "$target" ]]; then
export MODLOG="$MODLOG Imported $file from mc-dev\n";
echo "Copying $base to $target"
cp "$base" "$target"
else
echo "UN-NEEDED IMPORT: $file"
fi
}
(
cd "$basedir/base/Paper/PaperSpigot-Server/"
lastlog=$(git log -1 --oneline)
if [[ "$lastlog" = *"mc-dev Imports"* ]]; then
git reset --hard HEAD^
fi
)
import BlockBeacon
import ChunkCache
import ChunkCoordIntPair
import EntityTypes
import ItemFireworks
import PacketPlayInUseEntity
import PacketPlayOutEntityMetadata
import PacketPlayOutPlayerInfo
import PacketPlayOutScoreboardTeam
import PacketPlayOutNamedEntitySpawn
import PacketPlayOutSpawnEntityLiving
import PacketPlayOutAttachEntity
import PersistentScoreboard
import SlotResult
import StatisticList
import PacketPlayOutSpawnEntity
import ItemGoldenApple
import ItemPotion
import ServerPing
import WorldGenCaves
import WorldSettings
import BlockCarpet
import MerchantRecipeList
import ServerNBTManager
import IChunkLoader
cd "$basedir/base/Paper/PaperSpigot-Server/"
rm -rf nms-patches applyPatches.sh makePatches.sh >/dev/null 2>&1
git add . -A >/dev/null 2>&1
echo -e "mc-dev Imports\n\n$MODLOG" | git commit . -F -
)

46
scripts/init.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/bash
sourceBase=$(dirname "$SOURCE")/../
cd "${basedir:-$sourceBase}"
basedir="$(pwd -P)"
log_info() {
echo -e "\033[32m-------\033[0m $1"
}
log_warning() {
echo -e "\033[33m!!!!!!!\033[0m $1"
}
log_error() {
echo -e "\033[31m#######\033[0m $1"
}
function cleanupPatches {
cd "$1"
for patch in *.patch; do
gitver=$(tail -n 2 $patch | grep -ve "^$" | tail -n 1)
diffs=$(git diff --staged $patch | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index|Date\: )")
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
if [ "x$testver" != "x" ]; then
diffs=$(echo "$diffs" | tail -n +3)
fi
if [ "x$diffs" == "x" ] ; then
git reset HEAD $patch >/dev/null
git checkout -- $patch >/dev/null
fi
done
}
function basedir {
cd "$basedir"
}
function gethead {
(
cd "$1"
git log -1 --oneline
)
}

52
scripts/rebuildpatches.sh Normal file
View File

@ -0,0 +1,52 @@
#!/bin/bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
initScript=$(dirname "$SOURCE")/init.sh
. "$initScript"
PS1="$"
log_info "Rebuilding patches from current state..."
function savePatches {
what=$1
cd "$basedir/$what/"
mkdir -p "$basedir/patches/$2"
if [ -d ".git/rebase-apply" ]; then
# in middle of a rebase, be smarter
echo "REBASE DETECTED - PARTIAL SAVE"
last=$(cat ".git/rebase-apply/last")
next=$(cat ".git/rebase-apply/next")
for i in $(seq -f "%04g" 1 1 $last)
do
if [ $i -lt $next ]; then
for patchFile in "$basedir/patches/$2/${i}-"*.patch
do
rm "$patchFile"
done
#rm $basedir/patches/$2/${i}-*.patch
fi
done
else
#rm $(sed 's/ /\\ /g' <<< $basedir)/patches/$2/*.patch
for patchFile in "$basedir/patches/$2/"*.patch
do
rm "$patchFile"
done
fi
git format-patch --quiet --no-stat -N -o "$basedir/patches/$2" upstream/upstream
cd "$basedir"
git add -A "$basedir/patches/$2"
cleanupPatches "$basedir/patches/$2/"
echo " Patches saved for $what to patches/$2"
}
savePatches mSpigot-API api
savePatches mSpigot-Server server
log_info "Patches successfully rebuilt"

71
scripts/upstream.sh Normal file
View File

@ -0,0 +1,71 @@
#!/bin/bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
initScript=$(dirname "$SOURCE")/init.sh
. "$initScript"
if [[ "$1" == up* ]]; then
(
cd "$basedir/base/Paper/"
git fetch && git reset --hard origin/master
cd ../
git add Paper
)
fi
log_info "Setting up build environment"
git submodule update --init --recursive
log_info "Preparing upstream..."
paperVer=$(gethead base/Paper)
cd "$basedir"
cp -f scripts/baseremap.sh base/Paper/remap.sh
cp -f scripts/basedecompile.sh base/Paper/decompile.sh
cp -f scripts/baseinit.sh base/Paper/init.sh
cp -f scripts/basenewApplyPatches.sh base/Paper/newApplyPatches.sh
cd "$basedir/base/Paper/"
git submodule update --init
./remap.sh && ./decompile.sh && ./init.sh && ./newApplyPatches.sh
cd "PaperSpigot-Server"
mcVer=$(mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=minecraft_version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }')
basedir
. scripts/importmcdev.sh
scripts/generatesources.sh
minecraftversion=$(cat "$basedir/base/Paper/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
cd base/Paper/
version=$(echo -e "Paper: $paperVer\nmc-dev:$importedmcdev")
tag="${minecraftversion}-${mcVer}-$(echo -e $version | shasum | awk '{print $1}')"
function tag {
(
cd "$1"
if [ "$2" == "1" ]; then
git tag -d "$tag" 2>/dev/null
fi
echo -e "$(date)\n\n$version" | git tag -a "$tag" -F - 2>/dev/null
)
}
forcetag=0
upstreamState=$(cat "$basedir/base/.upstream-state")
if [ "$upstreamState" != "$tag" ]; then
forcetag=1
fi
tag PaperSpigot-API $forcetag
tag PaperSpigot-Server $forcetag
echo "$tag" > "$basedir/base/.upstream-state"
log_info "Build environment prepared. Run './mspigot apply' to apply patches."