Skip to content

Commit ed338a7

Browse files
mooziiil4zs
andauthored
KSpigot 1.19 (#50)
* Use new papermc repo url * Update gradle plugins * Update paper dependencies to 1.19 and bump version * Package renames * Update to kotlin 1.7.0 * Update kotlinx-serialization-json to 1.3.3 * Update kotlinx-coroutines to 1.6.2 * Correct version bump * Update versions in gradle_example.md * update some guide stuff Co-authored-by: l4zs <[email protected]>
1 parent 2db6b93 commit ed338a7

File tree

11 files changed

+59
-34
lines changed

11 files changed

+59
-34
lines changed

build.gradle.kts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,33 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33
val githubRepo = "jakobkmar/KSpigot"
44

55
group = "net.axay"
6-
version = "1.18.2"
6+
version = "1.19.0"
77

88
description = "A Kotlin API for Minecraft plugins using the Spigot or Paper toolchain"
99

1010
plugins {
11-
kotlin("jvm") version "1.6.10"
11+
kotlin("jvm") version "1.7.0"
1212

1313
`java-library`
1414
`maven-publish`
1515
signing
1616

17-
id("org.jetbrains.dokka") version "1.6.10"
18-
kotlin("plugin.serialization") version "1.6.10"
17+
id("org.jetbrains.dokka") version "1.6.21"
18+
kotlin("plugin.serialization") version "1.6.21"
1919

20-
id("io.papermc.paperweight.userdev") version "1.3.5"
20+
id("io.papermc.paperweight.userdev") version "1.3.6"
2121
}
2222

2323
repositories {
2424
mavenCentral()
2525
}
2626

2727
dependencies {
28-
paperDevBundle("1.18.2-R0.1-SNAPSHOT")
28+
paperDevBundle("1.19-R0.1-SNAPSHOT")
2929

30-
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
31-
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
32-
api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.0")
30+
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3")
31+
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
32+
api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.2")
3333
}
3434

3535
tasks {

guide/docs/extensions/itembuilder.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ val sword = itemStack(Material.GOLDEN_SWORD) {
1111
amount = 3
1212
addEnchantment(Enchantment.KNOCKBACK, 2)
1313
meta {
14-
name = "${KColors.GOLD}Magic Sword"
14+
name = literalText("Magic Sword") {
15+
color = KColors.GOLD
16+
}
1517
isUnbreakable = true
1618
addLore {
1719
+"This sword is truly special."
@@ -20,7 +22,7 @@ val sword = itemStack(Material.GOLDEN_SWORD) {
2022
customModel = 1001
2123
flag(ItemFlag.HIDE_UNBREAKABLE)
2224
}
23-
}
25+
}
2426
```
2527
### This creates the following item
2628

guide/docs/extensions/listener.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The event instance will be passed in as `it`, but you can change this:
1414

1515
```kotlin
1616
listen<PlayerMoveEvent> { moveEvent ->
17-
moveEvent.player.kick("Do not move!")
17+
moveEvent.player.kick(literalText("Do not move!"))
1818
broadcast("${moveEvent.player} moved :/")
1919
}
2020
```
@@ -25,7 +25,7 @@ For example you could listen to a specific event temporarily:
2525

2626
```kotlin
2727
val moveEventListener = listen<PlayerMoveEvent> {
28-
it.player.kick("Do not move!")
28+
it.player.kick(literalText("Do not move!"))
2929
}
3030

3131
// e.g. unregister the listener after some time

guide/docs/extensions/literal_text.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ Color:
4242

4343
```kotlin
4444
literalText("base text") {
45-
color = col(0xFF7463)
46-
color = col("#FF7463")
45+
color = TextColor.color(255, 116, 99)
4746
color = KColors.INDIANRED
4847
}
4948
```
@@ -56,7 +55,7 @@ literalText("base text") {
5655

5756
```kotlin
5857
literalText("base text") {
59-
hoverEvent = HoverEvent(action, content)
58+
hoverEvent = HoverEvent.hoverEvent(action, value)
6059
}
6160
```
6261

@@ -70,13 +69,29 @@ literalText("base text") {
7069
}
7170
```
7271

72+
#### Show hover Item
73+
74+
```kotlin
75+
literalText("base text") {
76+
hoverItem(item)
77+
}
78+
```
79+
80+
#### Show hover Entity
81+
82+
```kotlin
83+
literalText("base text") {
84+
hoverEntity(entity)
85+
}
86+
```
87+
7388
### Click event
7489

7590
#### General click event
7691

7792
```kotlin
7893
literalText("base text") {
79-
clickEvent = ClickEvent(action, value)
94+
clickEvent = ClickEvent.clickEvent(action, value)
8095
}
8196
```
8297

@@ -96,6 +111,14 @@ literalText("base text") {
96111
}
97112
```
98113

114+
#### Open a URL
115+
116+
```kotlin
117+
literalText("base text") {
118+
onClickOpenURL("https://github.com/bluefireoly/KSpigot")
119+
}
120+
```
121+
99122
## Special
100123

101124
```kotlin
@@ -107,12 +130,12 @@ literalText("base text") {
107130
}
108131
```
109132

110-
## Add bungee components
133+
## Add paper components
111134

112135
```kotlin
113136
literalText("base text") {
114137
// e.g. add a TranslatableComponent
115-
text(TranslatableComponent("translation.key")) {
138+
component(Component.translatable("translation.key")) {
116139
// optional text body
117140
}
118141
}

guide/docs/setup/beginners/java_version.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ Configuring the Java version is nothing specific to KSpigot, it should always be
22
anyways, because a lot of beginners forget to do this - and then get confused about not being able to use inline
33
functions.
44

5-
**Java 16** is the minimum required Java version by Minecraft, therefore KSpigot requires it as well.
5+
**Java 17** is the minimum required Java version by Minecraft, therefore KSpigot requires it as well.
66

77
You can configure the Java version using Gradle:
88

99
```kotlin
10-
// set the Java version you are using, Java 16 is the minimum required version for Minecraft
10+
// set the Java version you are using, Java 17 is the minimum required version for Minecraft
1111

1212
tasks {
1313
compileJava {
14-
options.release.set(16)
14+
options.release.set(17)
1515
}
1616
compileKotlin {
17-
kotlinOptions.jvmTarget = "16"
17+
kotlinOptions.jvmTarget = "17"
1818
}
1919
}
2020
```

guide/docs/setup/gradle_example.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ An example for a Gradle build script of a project using KSpigot would be:
77
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
88

99
plugins {
10-
kotlin("jvm") version "1.6.0"
11-
id("io.papermc.paperweight.userdev") version "1.3.1"
10+
kotlin("jvm") version "1.7.0"
11+
id("io.papermc.paperweight.userdev") version "1.3.6"
1212
}
1313

1414
group = "your.group"
@@ -19,8 +19,8 @@ repositories {
1919
}
2020

2121
dependencies {
22-
paperDevBundle("1.18.1-R0.1-SNAPSHOT")
23-
implementation("net.axay:kspigot:1.18.0")
22+
paperDevBundle("1.19-R0.1-SNAPSHOT")
23+
implementation("net.axay:kspigot:1.19.0")
2424
}
2525

2626
tasks {

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ rootProject.name = "KSpigot"
33
pluginManagement {
44
repositories {
55
gradlePluginPortal()
6-
maven("https://papermc.io/repo/repository/maven-public/")
6+
maven("https://repo.papermc.io/repository/maven-public/")
77
}
88
}

src/main/kotlin/net/axay/kspigot/commands/internal/BrigardierSupport.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object BrigardierSupport {
3333
}
3434

3535
@Suppress("HasPlatformType")
36-
fun resolveCommandManager() = (server as org.bukkit.craftbukkit.v1_18_R2.CraftServer)
36+
fun resolveCommandManager() = (server as org.bukkit.craftbukkit.v1_19_R1.CraftServer)
3737
.server.vanillaCommandDispatcher
3838

3939
internal fun registerAll() {
@@ -52,7 +52,7 @@ object BrigardierSupport {
5252
fun updateCommandTree() {
5353
onlinePlayers.forEach {
5454
// send the command tree
55-
resolveCommandManager().sendCommands((it as org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer).handle)
55+
resolveCommandManager().sendCommands((it as org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer).handle)
5656
}
5757
}
5858
}

src/main/kotlin/net/axay/kspigot/data/NBTDataLoader.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ package net.axay.kspigot.data
44

55
import net.axay.kspigot.annotations.NMS_General
66
import net.minecraft.nbt.CompoundTag
7-
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity
8-
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack
7+
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity
8+
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack
99
import org.bukkit.entity.Entity
1010
import org.bukkit.inventory.ItemStack
1111

src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fun Player.showOnlinePlayers() {
138138
@Deprecated("This function is unstable and it cannot be guaranteed that it will work at any time in the future.")
139139
@NMS_General
140140
fun Location.spawnCleanEntity(entityType: EntityType): Entity? {
141-
val craftWorld = world as? org.bukkit.craftbukkit.v1_18_R2.CraftWorld ?: return null
141+
val craftWorld = world as? org.bukkit.craftbukkit.v1_19_R1.CraftWorld ?: return null
142142
return craftWorld.createEntity(this, entityType.entityClass)?.let {
143143
craftWorld.handle.addFreshEntity(it)
144144
return@let it.bukkitEntity

src/main/kotlin/net/axay/kspigot/structures/Structure.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import org.bukkit.Location
1010
import org.bukkit.Material
1111
import org.bukkit.block.Block
1212
import org.bukkit.block.data.BlockData
13-
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity
13+
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity
1414
import org.bukkit.entity.Entity
1515
import org.bukkit.entity.EntityType
1616

0 commit comments

Comments
 (0)