Update the setup guide for the new release
This commit is contained in:
@@ -7,14 +7,14 @@ The following code snippets can be used in your `build.gradle.kts` file.
|
||||
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.
|
||||
|
||||
```kotlin
|
||||
val javaVersion = 8 // change this to your Java version
|
||||
// set the Java version you are using, Java 16 is the minimum required version for Minecraft
|
||||
|
||||
tasks.compileJava {
|
||||
options.release.set(javaVersion)
|
||||
options.release.set(16)
|
||||
}
|
||||
|
||||
tasks.compileKotlin {
|
||||
kotlinOptions.jvmTarget = if (javaVersion < 9) "1.$javaVersion" else "$javaVersion"
|
||||
kotlinOptions.jvmTarget = "16"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -41,7 +41,7 @@ Add the Spigot API dependency to your `dependencies` scope:
|
||||
|
||||
```kotlin
|
||||
dependencies {
|
||||
compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT")
|
||||
compileOnly("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -49,7 +49,7 @@ Replace the given version at the end of the dependency notation with the version
|
||||
|
||||
### **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` 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/))
|
||||
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:
|
||||
|
||||
@@ -63,7 +63,7 @@ Add the regular Spigot dependency to your `dependencies` scope:
|
||||
|
||||
```kotlin
|
||||
dependencies {
|
||||
compileOnly("org.spigotmc:spigot:1.16.5-R0.1-SNAPSHOT")
|
||||
compileOnly("org.spigotmc:spigot:1.17-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -78,7 +78,6 @@ Add the following repository to your `repositories` scope:
|
||||
```kotlin
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.codemc.io/repository/maven-snapshots/")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,7 +85,7 @@ Add the KSpigot dependency to your `dependencies` scope:
|
||||
|
||||
```kotlin
|
||||
dependencies {
|
||||
implementation("net.axay", "kspigot", "VERSION")
|
||||
implementation("net.axay:kspigot:VERSION")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -95,35 +94,18 @@ Replace `VERSION` with the version you want to use.
|
||||
Latest version (without the `v`): <br>
|
||||

|
||||
|
||||
### Shade KSpigot into your jar file
|
||||
### Add KSpigot to your plugins libraries
|
||||
|
||||
Add the widely used shadow plugin:
|
||||
Add KSpigot as a library to the libraries list on your `plugin.yml`. Make sure that you are always using the same string
|
||||
you where using when defining the dependency in Gradle.
|
||||
|
||||
```kotlin
|
||||
plugins {
|
||||
id("com.github.johnrengelman.shadow") version "VERSION"
|
||||
}
|
||||
```yaml
|
||||
libraries:
|
||||
- "net.axay:kspigot:VERSION"
|
||||
```
|
||||
|
||||
Replace `VERSION` with the version number from the following badge (without the `v`): <br>
|
||||

|
||||
|
||||
#### Relocate KSpigot during the shadow process
|
||||
|
||||
In order to avoid conflicts with other plugins, you should relocate KSpigot. This can be done using the shadow plugin from the previous step.
|
||||
|
||||
Configure it like this:
|
||||
|
||||
```kotlin
|
||||
tasks {
|
||||
shadowJar {
|
||||
relocate("net.axay.kspigot", "YOURMAINGROUP.shadow.net.axay.kspigot")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Replace `YOURMAINGROUP` with the main package structure you use (e.g. `org.example.`)
|
||||
|
||||
## Build your final plugin
|
||||
|
||||
Run the Gradle task called `shadowJar`. Using IntelliJ IDEA, this can be done using the Gradle sidebar, where you can find the task under `Tasks > Shadow > shadowJar`. Alternatively, you can also run `./gradlew shadowJar` in your terminal.
|
||||
Run the Gradle task called `build`. Using IntelliJ IDEA, this can be done using the Gradle sidebar, where you can find the task under `Tasks > build > build`. Alternatively, you can also run `./gradlew build` in your terminal.
|
||||
|
||||
The final .jar file of your plugin will then be at the following location: `build/libs/yourplugin.jar`
|
||||
|
Reference in New Issue
Block a user