Project Set-Up
Page version: 5.4 build 1760
-
Install JDK for Java 17 so that you can compile the project. If you want to develop the React part of the project install node.js 16.14.2 or above. (node.js is not required for building the project)
-
Fork the Plan repository & Clone that repository to your workstation.
Here is a Tutorial. -
Open
/Plan/
project folder inside the repository you just downloaded in your favorite IDE.
Most IDEs will sync the workspace and you can start working on the project.
If you're having issues join Discord or open an issue and I'll help you out.
Building and testing
To build a new plugin artifact to use on servers, use
./gradlew build
The artifact will be placed in /repo_root/Plan/builds/
To skip tests and only build new jar, use
./gradlew shadowJar
To run CheckStyle checks run
./gradlew checkstyleMain checkstyleTest
Maven Local Dependencies
mavenLocal()
is not included in the repositories of main build.gradle.
If you need locally installed dependencies, add it to the main build.gradle for test builds.
Testing
To run tests, use
./gradlew test
- If you want to run MySQL tests, set up MySQL on localhost and set following environment variables:
MYSQL_DB
: Database name,MYSQL_USER
: username,MYSQL_PASS
: password,MYSQL_PORT
: port of mysql server - If you want to run Selenium tests, set up Chromedriver and set
CHROMEDRIVER
environment variable as the absolute file path to the chromedriver executable (C:\chromedriver.exe
for example).
Modules
The project is split into 8 modules.
Module | Description | Java Version |
---|---|---|
api |
Easily available API that is distributed via a maven repository | Java 8 |
extension |
Module for registering built in extensions that use DataExtension API | Java 11 |
common |
System related abstractions and main logic is in this package. Most work is done here. | Java 11 |
bukkit |
Bukkit/Spigot/Paper related classes | Java 11 |
bungee |
BungeeCord related classes | Java 11 |
sponge |
Sponge related classes | Java 11 |
velocity |
Velocity related classes | Java 11 |
plugin |
Module for shading all other modules into a single jar | Java 11 |
fabric |
Fabric related classes, independent jar from other platforms | Java 17 |
Plan uses Dagger for dependency injection.
Your IDE may be complaining about DaggerPlanBukkitComponent
or another Dagger###Component
class not being available.
Make sure that /<module>/build/generated/
is included as a Generated Sources root.
Web Dev
React project used for frontend is in /repo_root/Plan/react/dashboard
. Node 20 is used. You can set up the project with
yarn install
Install Plan on a game/proxy server and change package.json
"proxy"
property to match the address to the Plan webserver (so that backend requests go there). After that you can start React dev-server with
yarn start
Plan builds the React project with yarn via gradle-node-plugin during the build process and includes it in the jar automatically when you run ./gradlew build
or ./gradlew shadowJar
.
If you need new endpoints from Plan Webserver build a new jar, install it and restart the game/proxy server.
Swagger documentation is available at <plan address>/docs
when everything is running
More
If you would like to know a bit more how the project is put together before diving in, you can check out Project Architecture
The following sections are documentation for different one-time set-up steps for the project, written down in case I need to do it again years after I forgot about it.
CI set-up
Some tests need additional resources to be run, such as MySQL test or Selenium tests. It is not expected for devs to set these up on their own machines, but they should run on the CI.
The resource information is set using environmental variables. Those can be found from https://github.com/plan-player-analytics/Plan/blob/master/Plan/common/src/test/java/utilities/CIProperties.java
Reposilite publish set-up
In order to publish artifacts to https://repo.playeranalytics.net
use environment variable REPOSILITE_TOKEN
.
- How to generate new tokens https://v2.reposilite.com/docs/authorization
Bintray publish set-up (Bintray has shut down)
In order to publish artifacts to Bintray, following environmental variables need to be set
BINTRAY_KEY
: get from https://bintray.com/profile/edit > API KeysBINTRAY_USER
: Bintray username
build gradle config for bintray (At the time of writing this is in the API module)
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
pkg {
repo = 'Plan-repository'
name = 'Plan-API'
licenses = ['LGPL-v3.0']
vcsUrl = 'https://github.com/plan-player-analytics/Plan'
issueTrackerUrl = 'https://github.com/plan-player-analytics/Plan/issues'
version {
name = "$apiVersion"
desc = "Plan API version $apiVersion"
}
publications = ['BintrayPublication']
}
}
publishing {
publications {
BintrayPublication(MavenPublication) {
groupId = 'com.djrapitops'
artifactId = 'Plan-api'
version = "$apiVersion"
artifact jar
}
mavenJava(MavenPublication) {
groupId = 'com.djrapitops'
artifactId = 'Plan-api'
version = "$apiVersion"
artifact jar
}
}
}
Documentation
Tutorials
Configuration
- Game server Set-up
- Network Set-up
- Game server Configuration
- Network Configuration
- Login / HTTPS Set-Up
- Commands & Permissions
- Database management
- PlaceholderAPI