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 <business@l4zs.de>
This commit is contained in:
@@ -3,21 +3,21 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
val githubRepo = "jakobkmar/KSpigot"
|
||||
|
||||
group = "net.axay"
|
||||
version = "1.18.2"
|
||||
version = "1.19.0"
|
||||
|
||||
description = "A Kotlin API for Minecraft plugins using the Spigot or Paper toolchain"
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.6.10"
|
||||
kotlin("jvm") version "1.7.0"
|
||||
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
signing
|
||||
|
||||
id("org.jetbrains.dokka") version "1.6.10"
|
||||
kotlin("plugin.serialization") version "1.6.10"
|
||||
id("org.jetbrains.dokka") version "1.6.21"
|
||||
kotlin("plugin.serialization") version "1.6.21"
|
||||
|
||||
id("io.papermc.paperweight.userdev") version "1.3.5"
|
||||
id("io.papermc.paperweight.userdev") version "1.3.6"
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -25,11 +25,11 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
paperDevBundle("1.18.2-R0.1-SNAPSHOT")
|
||||
paperDevBundle("1.19-R0.1-SNAPSHOT")
|
||||
|
||||
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.0")
|
||||
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3")
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.2")
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
@@ -11,7 +11,9 @@ val sword = itemStack(Material.GOLDEN_SWORD) {
|
||||
amount = 3
|
||||
addEnchantment(Enchantment.KNOCKBACK, 2)
|
||||
meta {
|
||||
name = "${KColors.GOLD}Magic Sword"
|
||||
name = literalText("Magic Sword") {
|
||||
color = KColors.GOLD
|
||||
}
|
||||
isUnbreakable = true
|
||||
addLore {
|
||||
+"This sword is truly special."
|
||||
@@ -20,7 +22,7 @@ val sword = itemStack(Material.GOLDEN_SWORD) {
|
||||
customModel = 1001
|
||||
flag(ItemFlag.HIDE_UNBREAKABLE)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
### This creates the following item
|
||||
|
||||
|
@@ -14,7 +14,7 @@ The event instance will be passed in as `it`, but you can change this:
|
||||
|
||||
```kotlin
|
||||
listen<PlayerMoveEvent> { moveEvent ->
|
||||
moveEvent.player.kick("Do not move!")
|
||||
moveEvent.player.kick(literalText("Do not move!"))
|
||||
broadcast("${moveEvent.player} moved :/")
|
||||
}
|
||||
```
|
||||
@@ -25,7 +25,7 @@ For example you could listen to a specific event temporarily:
|
||||
|
||||
```kotlin
|
||||
val moveEventListener = listen<PlayerMoveEvent> {
|
||||
it.player.kick("Do not move!")
|
||||
it.player.kick(literalText("Do not move!"))
|
||||
}
|
||||
|
||||
// e.g. unregister the listener after some time
|
||||
|
@@ -42,8 +42,7 @@ Color:
|
||||
|
||||
```kotlin
|
||||
literalText("base text") {
|
||||
color = col(0xFF7463)
|
||||
color = col("#FF7463")
|
||||
color = TextColor.color(255, 116, 99)
|
||||
color = KColors.INDIANRED
|
||||
}
|
||||
```
|
||||
@@ -56,7 +55,7 @@ literalText("base text") {
|
||||
|
||||
```kotlin
|
||||
literalText("base text") {
|
||||
hoverEvent = HoverEvent(action, content)
|
||||
hoverEvent = HoverEvent.hoverEvent(action, value)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -70,13 +69,29 @@ literalText("base text") {
|
||||
}
|
||||
```
|
||||
|
||||
#### Show hover Item
|
||||
|
||||
```kotlin
|
||||
literalText("base text") {
|
||||
hoverItem(item)
|
||||
}
|
||||
```
|
||||
|
||||
#### Show hover Entity
|
||||
|
||||
```kotlin
|
||||
literalText("base text") {
|
||||
hoverEntity(entity)
|
||||
}
|
||||
```
|
||||
|
||||
### Click event
|
||||
|
||||
#### General click event
|
||||
|
||||
```kotlin
|
||||
literalText("base text") {
|
||||
clickEvent = ClickEvent(action, value)
|
||||
clickEvent = ClickEvent.clickEvent(action, value)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -96,6 +111,14 @@ literalText("base text") {
|
||||
}
|
||||
```
|
||||
|
||||
#### Open a URL
|
||||
|
||||
```kotlin
|
||||
literalText("base text") {
|
||||
onClickOpenURL("https://github.com/bluefireoly/KSpigot")
|
||||
}
|
||||
```
|
||||
|
||||
## Special
|
||||
|
||||
```kotlin
|
||||
@@ -107,12 +130,12 @@ literalText("base text") {
|
||||
}
|
||||
```
|
||||
|
||||
## Add bungee components
|
||||
## Add paper components
|
||||
|
||||
```kotlin
|
||||
literalText("base text") {
|
||||
// e.g. add a TranslatableComponent
|
||||
text(TranslatableComponent("translation.key")) {
|
||||
component(Component.translatable("translation.key")) {
|
||||
// optional text body
|
||||
}
|
||||
}
|
||||
|
@@ -2,19 +2,19 @@ Configuring the Java version is nothing specific to KSpigot, it should always be
|
||||
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.
|
||||
**Java 17** 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
|
||||
// set the Java version you are using, Java 17 is the minimum required version for Minecraft
|
||||
|
||||
tasks {
|
||||
compileJava {
|
||||
options.release.set(16)
|
||||
options.release.set(17)
|
||||
}
|
||||
compileKotlin {
|
||||
kotlinOptions.jvmTarget = "16"
|
||||
kotlinOptions.jvmTarget = "17"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@@ -7,8 +7,8 @@ An example for a Gradle build script of a project using KSpigot would be:
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.6.0"
|
||||
id("io.papermc.paperweight.userdev") version "1.3.1"
|
||||
kotlin("jvm") version "1.7.0"
|
||||
id("io.papermc.paperweight.userdev") version "1.3.6"
|
||||
}
|
||||
|
||||
group = "your.group"
|
||||
@@ -19,8 +19,8 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
paperDevBundle("1.18.1-R0.1-SNAPSHOT")
|
||||
implementation("net.axay:kspigot:1.18.0")
|
||||
paperDevBundle("1.19-R0.1-SNAPSHOT")
|
||||
implementation("net.axay:kspigot:1.19.0")
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
@@ -3,6 +3,6 @@ rootProject.name = "KSpigot"
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ object BrigardierSupport {
|
||||
}
|
||||
|
||||
@Suppress("HasPlatformType")
|
||||
fun resolveCommandManager() = (server as org.bukkit.craftbukkit.v1_18_R2.CraftServer)
|
||||
fun resolveCommandManager() = (server as org.bukkit.craftbukkit.v1_19_R1.CraftServer)
|
||||
.server.vanillaCommandDispatcher
|
||||
|
||||
internal fun registerAll() {
|
||||
@@ -52,7 +52,7 @@ object BrigardierSupport {
|
||||
fun updateCommandTree() {
|
||||
onlinePlayers.forEach {
|
||||
// send the command tree
|
||||
resolveCommandManager().sendCommands((it as org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer).handle)
|
||||
resolveCommandManager().sendCommands((it as org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer).handle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@ package net.axay.kspigot.data
|
||||
|
||||
import net.axay.kspigot.annotations.NMS_General
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity
|
||||
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity
|
||||
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack
|
||||
import org.bukkit.entity.Entity
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
|
@@ -138,7 +138,7 @@ fun Player.showOnlinePlayers() {
|
||||
@Deprecated("This function is unstable and it cannot be guaranteed that it will work at any time in the future.")
|
||||
@NMS_General
|
||||
fun Location.spawnCleanEntity(entityType: EntityType): Entity? {
|
||||
val craftWorld = world as? org.bukkit.craftbukkit.v1_18_R2.CraftWorld ?: return null
|
||||
val craftWorld = world as? org.bukkit.craftbukkit.v1_19_R1.CraftWorld ?: return null
|
||||
return craftWorld.createEntity(this, entityType.entityClass)?.let {
|
||||
craftWorld.handle.addFreshEntity(it)
|
||||
return@let it.bukkitEntity
|
||||
|
@@ -10,7 +10,7 @@ import org.bukkit.Location
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.block.Block
|
||||
import org.bukkit.block.data.BlockData
|
||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity
|
||||
import org.bukkit.entity.Entity
|
||||
import org.bukkit.entity.EntityType
|
||||
|
||||
|
Reference in New Issue
Block a user