Switch from Spigot to Paper in docs

This commit is contained in:
Jakob K
2021-12-12 03:47:33 +01:00
parent 17c1f79341
commit 73ddd73c27
7 changed files with 39 additions and 70 deletions

View File

@@ -1,6 +1,7 @@
# KSpigot
KSpigot extends Spigot (and all of its forks) with additional functionality. This reaches from small extension functions, to features making use of Kotlin's language features and finally to bigger APIs (e.g. the GUI API).
KSpigot extends Paper (and all of its forks) with additional functionality. This reaches from small extension functions,
to features making use of Kotlin's language features and finally to bigger APIs (e.g. the GUI API).
KSpigot is [at home on GitHub](https://github.com/bluefireoly/KSpigot). Feel free to contribute to the project.
@@ -12,4 +13,5 @@ In order to get started, follow the [setup guide](setup/gradle.md).
Contributions to the documentation are welcome, as it is written by the community itself.
Create a fork of KSpigot and add new markdown files to `guide/docs/`, commit and push the changes and then create a pull request to the main project.
Create a fork of KSpigot and add new markdown files to `guide/docs/`, commit and push the changes and then create a pull
request to the main project.

View File

@@ -6,14 +6,15 @@ There are several things required to get started with KSpigot.
Kotlin is requirement for using KSpigot, as it is made for use with the Kotlin programming language.
You can start learning Kotlin with [the official docs](https://kotlinlang.org/docs/home.html) or by using the [Kotlin Playground](https://play.kotlinlang.org/byExample/overview).
You can start learning Kotlin with [the official docs](https://kotlinlang.org/docs/home.html) or by using
the [Kotlin Playground](https://play.kotlinlang.org/byExample/overview).
## Gradle
You should be able to use Gradle as your build system, although you do not have to understand to much of it. Probably it will even work if you just copy and paste the snippets this guide provides.
You should be able to use Gradle as your build system, although you do not have to understand to much of it. Probably it
will even work if you just copy and paste the snippets this guide provides.
## Spigot
## Paper
Spigot is just an API, meaning that if you are able to use Kotlin, you will be able to use an API like Spigot and KSpigot. Nevertheless, it is good to know at least something about the Spigot API.
The Spigot API documentation can be found [here](https://hub.spigotmc.org/javadocs/bukkit/).
Paper is just an API, meaning that if you are able to use Kotlin, you will be able to use an API like Paper and KSpigot.
Nevertheless, it is good to know at least something about the Paper API.

View File

@@ -1,50 +0,0 @@
# 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.

View File

@@ -17,7 +17,7 @@ class InternalMainClass : KSpigot() {
}
```
??? info "Coming from spigot?"
??? info "Coming from Paper or Spigot?"
When using KSpigot **do not inherit from `JavaPlugin`**, inherit from `KSpigot` instead.
Also, please note that:

View File

@@ -8,10 +8,9 @@ An example of a final configuration file [is also available](gradle_example.md).
Make sure that you have [configured the Java version](beginners/java_version.md) correctly.
### Add the Spigot dependency
### Add paper (via paperweight)
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 the paperweight Gradle plugin. Have a look at [the example](gradle_example.md).
## Add KSpigot

View File

@@ -1,10 +1,14 @@
An example for a `build.gradle.kts` file of a project using KSpigot would be:
An example for a Gradle build script of a project using KSpigot would be:
*(please note that the version in the following examples might be outdated)*
`build.gradle.kts`
```kotlin
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.5.21"
kotlin("jvm") version "1.6.0"
id("io.papermc.paperweight.userdev") version "1.3.1"
}
group = "your.group"
@@ -12,21 +16,35 @@ version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots")
}
dependencies {
compileOnly("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT")
implementation("net.axay:kspigot:1.17.2")
paperDevBundle("1.18.1-R0.1-SNAPSHOT")
implementation("net.axay:kspigot:1.18.0")
}
tasks {
build {
dependsOn(reobfJar)
}
compileJava {
options.release.set(16)
options.encoding = "UTF-8"
options.release.set(17)
}
compileKotlin {
kotlinOptions.jvmTarget = "16"
kotlinOptions.jvmTarget = "17"
}
}
```
`settings.gradle.kts`
```kotlin
rootProject.name = "projectname"
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://papermc.io/repo/repository/maven-public/")
}
}
```

View File

@@ -33,7 +33,6 @@ nav:
- 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