Gradle Run Task
BlueDragon projects currently have a lot of moving parts. You can automate most of the repetitive file copying with Gradle tasks. This guide provides a few examples to help you get a development environment up and running quickly.
Copy JARs to a central location
Here is an example of a Gradle task that will copy your subprojects’ JARs after building. Use this in conjunction with the Subprojects section of the Gradle Setup guide.
Runnning a development server
The easiest way to run a dev server is using a Gradle task to copy the JARs and start the server for you.
Developing the Server
project
After adding the copyJars
task from the prior section, add the following tasks to your Gradle build script.
This assumes you have cloned the BlueDragonMC/Server project in a sibling directory to your games Gradle project.
Then, whenever you want to start a dev server, you can run gradle runDev
or add it as an IntelliJ run configuration.
Using the prebuilt Server
project
If you want to use the prebuilt Server
project instead of cloning it locally, take the code from the last section and make the following modifications:
- Delete the
buildServerDev
andcopyServerDev
task definitions - Remove the
dependsOn
call forcopyServerDev
in therunDev
task definition. - In the
cleanRunFolder
task definition, remove"${projectDir}/run/server.jar"
from thedelete
call. - Copy a compiled BlueDragonMC/Server JAR into the
run
directory in your project. Rename it toserver.jar
. - You can now run
gradle runDev
to start a dev server using a precompiled BlueDragonMC/Server JAR!
Runtime requirements
When you run the development server, you will need to start up two external services:
- MongoDB for storing player data and permissions
- LuckPerms for querying and updating player permissions
The easiest way to do this is with Docker. Follow this guide to start them up, and make sure they are running when you use the runDev
Gradle task. If not, the development server will fail to start.
If you do not have any permissions, follow this guide to give them to yourself.