diff --git a/guide/docs/setup/beginners.md b/guide/docs/setup/beginners/beginners.md similarity index 100% rename from guide/docs/setup/beginners.md rename to guide/docs/setup/beginners/beginners.md diff --git a/guide/docs/setup/beginners/java_version.md b/guide/docs/setup/beginners/java_version.md new file mode 100644 index 00000000..e7083731 --- /dev/null +++ b/guide/docs/setup/beginners/java_version.md @@ -0,0 +1,19 @@ +Configuring the Java version is nothing specific to KSpigot, it should always be done. It is listed in this guide +anyways, because a lot of beginners forget to do this - and then get confused about not being able to use inline +functions. + +**Java 16** is the minimum required Java version by Minecraft, therefore KSpigot requires it as well. + +You can configure the Java version using Gradle: + +```kotlin +// set the Java version you are using, Java 16 is the minimum required version for Minecraft + +tasks.compileJava { + options.release.set(16) +} + +tasks.compileKotlin { + kotlinOptions.jvmTarget = "16" +} +``` diff --git a/guide/docs/setup/beginners/spigot_dependency.md b/guide/docs/setup/beginners/spigot_dependency.md new file mode 100644 index 00000000..6acf1c51 --- /dev/null +++ b/guide/docs/setup/beginners/spigot_dependency.md @@ -0,0 +1,50 @@ +# Add the Spigot dependency + +You have two options: + +- **A** add just the Spigot API, if you wish to have a stable API which is built for users +- **B** use the regular Spigot dependency which contains the whole Minecraft server code (often called "nms" (net.minecraft.server)), as well as the underlying CraftBukkit code - this option gives you a lot more possibilities, but it can also be dangerous + +### **A** Just the Spigot API + +KSpigot is an extension for Spigot, you still need the regular Spigot dependency. + +Add the Spigot Maven repository to your `repositories` scope: + +```kotlin +repositories { + maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots") +} +``` + +Add the Spigot API dependency to your `dependencies` scope: + +```kotlin +dependencies { + compileOnly("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT") +} +``` + +Replace the given version at the end of the dependency notation with the version you want to use. [See all versions](https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/) in the Spigot Maven repository. + +### **B** The regular Spigot dependency + +Download the [BuildTools](https://hub.spigotmc.org/jenkins/job/BuildTools/) to a separate directory, navigate to this directory using your terminal and run `java -jar BuildTools.jar --rev MINECRAFT_VERSION` in order to generate the .jar file of the Spigot server. This file will be installed to your Maven Local repository automatically, so you can add it as dependency to your project. Additionally, you can copy it to anywhere else and use it to create a server. (More information can be found in the [Spigot Wiki](https://www.spigotmc.org/wiki/buildtools/)) + +Add your Maven Local repository to your `repositories` scope: + +```kotlin +repositories { + mavenLocal() +} +``` + +Add the regular Spigot dependency to your `dependencies` scope: + +```kotlin +dependencies { + compileOnly("org.spigotmc:spigot:1.17-R0.1-SNAPSHOT") +} +``` + +Make sure that the version number before `-R0.1-SNAPSHOT` matches the version you have just built using the BuildTools. \ No newline at end of file diff --git a/guide/docs/setup/gradle.md b/guide/docs/setup/gradle.md index 02940b78..fa4f89c2 100644 --- a/guide/docs/setup/gradle.md +++ b/guide/docs/setup/gradle.md @@ -2,74 +2,16 @@ The following code snippets can be used in your `build.gradle.kts` file. An example of a final configuration file [is also available](gradle_example.md). -## Gradle configuration +## Prerequisites ### Java version -Configuring the Java version is nothing specific to KSpigot, it should always be done. It is listed in this guide anyways, because a lot of beginners forget to do this - and then get confused about not being able to use inline functions. +Make sure that you have [configured the Java version](beginners/java_version.md) correctly. -```kotlin -// set the Java version you are using, Java 16 is the minimum required version for Minecraft +### Add the Spigot dependency -tasks.compileJava { - options.release.set(16) -} - -tasks.compileKotlin { - kotlinOptions.jvmTarget = "16" -} -``` - -## Add the Spigot dependency - -You have two options: - -- **A** add just the Spigot API, if you wish to have a stable API which is built for users -- **B** use the regular Spigot dependency which contains the whole Minecraft server code (often called "nms" (net.minecraft.server)), as well as the underlying CraftBukkit code - this option gives you a lot more possibilities, but it can also be dangerous - -### **A** Just the Spigot API - -KSpigot is an extension for Spigot, you still need the regular Spigot dependency. - -Add the Spigot Maven repository to your `repositories` scope: - -```kotlin -repositories { - maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots") -} -``` - -Add the Spigot API dependency to your `dependencies` scope: - -```kotlin -dependencies { - compileOnly("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT") -} -``` - -Replace the given version at the end of the dependency notation with the version you want to use. [See all versions](https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/) in the Spigot Maven repository. - -### **B** The regular Spigot dependency - -Download the [BuildTools](https://hub.spigotmc.org/jenkins/job/BuildTools/) to a separate directory, navigate to this directory using your terminal and run `java -jar BuildTools.jar --rev MINECRAFT_VERSION` in order to generate the .jar file of the Spigot server. This file will be installed to your Maven Local repository automatically, so you can add it as dependency to your project. Additionally, you can copy it to anywhere else and use it to create a server. (More information can be found in the [Spigot Wiki](https://www.spigotmc.org/wiki/buildtools/)) - -Add your Maven Local repository to your `repositories` scope: - -```kotlin -repositories { - mavenLocal() -} -``` - -Add the regular Spigot dependency to your `dependencies` scope: - -```kotlin -dependencies { - compileOnly("org.spigotmc:spigot:1.17-R0.1-SNAPSHOT") -} -``` - -Make sure that the version number before `-R0.1-SNAPSHOT` matches the version you have just built using the BuildTools. +KSpigot does not replace Spigot, it is just an API which you can use together with Spigot. Therefore, please make sure +that you have [added Spigot to your project as well](beginners/spigot_dependency.md). ## Add KSpigot diff --git a/guide/mkdocs.yml b/guide/mkdocs.yml index 5373a1bb..02842b7b 100644 --- a/guide/mkdocs.yml +++ b/guide/mkdocs.yml @@ -30,8 +30,10 @@ nav: - Home: index.md - Setup: - For absolute beginners: - - Requirements: setup/beginners.md - - Starting a new project: setup/project.md + - Requirements: setup/beginners/beginners.md + - Starting a new project: setup/beginners/project.md + - Configure Java version: setup/beginners/java_version.md + - Add the Spigot dependency: setup/beginners/spigot_dependency.md - Setup using Gradle: setup/gradle.md - Build script example: setup/gradle_example.md - Entrypoint to your plugin: setup/entrypoint.md