From f8a466a95595e6a9ae06ea2188f2f9fcfe3a891b Mon Sep 17 00:00:00 2001 From: Niklas Date: Sun, 28 Jun 2020 15:08:12 +0200 Subject: [PATCH] improved dev stuff. Local server and build --- .gitignore | 2 ++ .idea/runConfigurations/Attach.xml | 15 +++++++++++++++ README.md | 7 +++++++ dev/buildSpigot.sh | 15 +++++++++++++++ dev/{ => docker}/docker-compose.yml | 4 ++-- dev/docker/insertPlugin.sh | 5 +++++ dev/docker/log.sh | 2 ++ dev/docker/restartServer.sh | 2 ++ dev/insertPlugin.sh | 2 +- dev/log.sh | 2 -- dev/restartServer.sh | 2 -- dev/startServer.sh | 7 +++++++ 12 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 .idea/runConfigurations/Attach.xml create mode 100755 dev/buildSpigot.sh rename dev/{ => docker}/docker-compose.yml (78%) create mode 100755 dev/docker/insertPlugin.sh create mode 100755 dev/docker/log.sh create mode 100755 dev/docker/restartServer.sh delete mode 100755 dev/log.sh delete mode 100755 dev/restartServer.sh create mode 100755 dev/startServer.sh diff --git a/.gitignore b/.gitignore index b92f8fb..009a176 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ **/build/ !src/**/build/ dev/container +dev/server +dev/build # Ignore Gradle GUI config gradle-app.setting diff --git a/.idea/runConfigurations/Attach.xml b/.idea/runConfigurations/Attach.xml new file mode 100644 index 0000000..bc82e12 --- /dev/null +++ b/.idea/runConfigurations/Attach.xml @@ -0,0 +1,15 @@ + + + + \ No newline at end of file diff --git a/README.md b/README.md index dd0abcd..6a212ec 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,13 @@ Running gradle from Intellij works fine but from the terminal i had to use # Dev tools +## Local Server +You can compile the spigot server on your own by running `./buildSpigot.sh 1.16.1` inside the dev directory. The first +parameter is the version. If no version is given the `latest` tag is used which is not always the newest minecraft +version. + +After that you can start the server and it will run inside the `server` directory. + ## Server You can run a spigot server for development. Run `sudo docker-compose up` inside of `dev`. To make inserting the plugin easier change the `SPIGOT_UID` to your UID (run the `id` command). The only problem is diff --git a/dev/buildSpigot.sh b/dev/buildSpigot.sh new file mode 100755 index 0000000..8029b69 --- /dev/null +++ b/dev/buildSpigot.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") + +mkdir $SCRIPTPATH/build +mkdir $SCRIPTPATH/server + +cd $SCRIPTPATH/build +curl -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar + +java -jar BuildTools.jar --rev ${1:-latest} + +cd $SCRIPTPATH/server +echo "eula=true" > eula.txt + diff --git a/dev/docker-compose.yml b/dev/docker/docker-compose.yml similarity index 78% rename from dev/docker-compose.yml rename to dev/docker/docker-compose.yml index 0e2effd..9e16209 100644 --- a/dev/docker-compose.yml +++ b/dev/docker/docker-compose.yml @@ -3,7 +3,7 @@ version: "3" services: spigot-dev: image: "nimmis/spigot" - container_name: "spigot-dev-hc-revive" + container_name: "spigot-dev" environment: - EULA=true - MC_MAXMEM=4g @@ -13,4 +13,4 @@ services: - "./container:/minecraft" restart: "no" ports: - - "25565:25565" + - "25565:25565" \ No newline at end of file diff --git a/dev/docker/insertPlugin.sh b/dev/docker/insertPlugin.sh new file mode 100755 index 0000000..22a0e81 --- /dev/null +++ b/dev/docker/insertPlugin.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") + +cp $SCRIPTPATH/../../build/libs/* $SCRIPTPATH/container/plugins diff --git a/dev/docker/log.sh b/dev/docker/log.sh new file mode 100755 index 0000000..842941c --- /dev/null +++ b/dev/docker/log.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +sudo docker exec spigot-dev mc_log \ No newline at end of file diff --git a/dev/docker/restartServer.sh b/dev/docker/restartServer.sh new file mode 100755 index 0000000..800c199 --- /dev/null +++ b/dev/docker/restartServer.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +sudo docker exec spigot-dev mc_restart \ No newline at end of file diff --git a/dev/insertPlugin.sh b/dev/insertPlugin.sh index ff73a7d..a5d424d 100755 --- a/dev/insertPlugin.sh +++ b/dev/insertPlugin.sh @@ -2,4 +2,4 @@ SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") -cp $SCRIPTPATH/../build/libs/* $SCRIPTPATH/container/plugins +cp $SCRIPTPATH/../build/libs/* $SCRIPTPATH/server/plugins diff --git a/dev/log.sh b/dev/log.sh deleted file mode 100755 index 27a21e9..0000000 --- a/dev/log.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -sudo docker exec spigot-dev-hc-revive mc_log \ No newline at end of file diff --git a/dev/restartServer.sh b/dev/restartServer.sh deleted file mode 100755 index 3d6f998..0000000 --- a/dev/restartServer.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -sudo docker exec spigot-dev-hc-revive mc_restart \ No newline at end of file diff --git a/dev/startServer.sh b/dev/startServer.sh new file mode 100755 index 0000000..72abe63 --- /dev/null +++ b/dev/startServer.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") + +cd $SCRIPTPATH/server +java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:5005 -jar $SCRIPTPATH/build/spigot-*.jar nogui +