Skip to content

Commit

Permalink
Update Paper to 1.20.6, Java to 21 and use native Brigadier API
Browse files Browse the repository at this point in the history
  • Loading branch information
Sytm committed Jun 11, 2024
1 parent 5a5ef21 commit 3819a69
Show file tree
Hide file tree
Showing 18 changed files with 399 additions and 333 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

### Changed
- **CommandAPI is no longer required**

## 4.5.1

### Changed
Expand Down
15 changes: 4 additions & 11 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[versions]
kotlin = "1.9.24"
kotlin = "2.0.0"
coroutines = "1.8.1"
jvmToolchain = "17"
paper = "1.20.4-R0.1-SNAPSHOT"
commandApi = "9.4.1"
jvmToolchain = "21"
paper = "1.20.6-R0.1-SNAPSHOT"

dynmap = "3.5-SNAPSHOT"

Expand All @@ -14,24 +13,21 @@ coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core"
annotations = { group = "org.jetbrains", name = "annotations", version = "24.0.1" }

paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
spigot = { group = "org.spigotmc", name = "spigot-api", version.ref = "paper" }

# Required dependencies
# (own)
md5Commons = { group = "de.md5lukas", name = "md5-commons", version = "3.0.0-SNAPSHOT" }
kinvs = { group = "de.md5lukas", name = "kinvs", version = "1.1.0" }
sqliteHelper = { group = "de.md5lukas", name = "sqlite-kotlin-helper", version = "1.2.2" }
konfig = { group = "de.md5lukas", name = "spigot-konfig", version = "1.0.1" }
paperBrigadier = { group = "de.md5lukas.paper", name = "paper-brigadier", version = "1.0.0" }
pathfinder = { group = "de.md5lukas", name = "pathfinder", version = "1.0.0-SNAPSHOT" }

# (external)
schedulers = { group = "de.md5lukas", name = "schedulers", version = "1.0.1" }
skedule = { group = "de.md5lukas", name = "skedule", version = "2.0.0" }
anvilGui = { group = "de.md5lukas", name = "anvilgui", version = "2.0.0-SNAPSHOT" }
bStats = { group = "org.bstats", name = "bstats-bukkit", version = "3.0.2" }
commandapi-core = { group = "dev.jorel", name = "commandapi-bukkit-core", version.ref = "commandApi" }
commandapi-kotlin = { group = "dev.jorel", name = "commandapi-bukkit-kotlin", version.ref = "commandApi" }
brigadier = { group = "com.mojang", name = "brigadier", version = "1.1.8" }

# Optional dependencies
vaultApi = { group = "com.github.MilkBowl", name = "VaultAPI", version = "1.7.1" }
Expand Down Expand Up @@ -67,6 +63,3 @@ minotaur = { id = "com.modrinth.minotaur", version = "2.+" }
runPaper = { id = "xyz.jpenilla.run-paper", version = "2.+" }
spotless = { id = "com.diffplug.spotless", version = "6.+" }
changelog = { id = "org.jetbrains.changelog", version = "2.1.0" }

[bundles]
commandApi = ["commandapi-core", "commandapi-kotlin", "brigadier"]
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class PointerManager(
* @param player The player to load the enabled pointers for
* @return The enabled pointers
*/
fun loadEnabledPointers(player: Player): CompletableFuture<Map<PointerVariant, Boolean>> {
fun loadEnabledPointers(player: Player): CompletableFuture<out Map<PointerVariant, Boolean>> {
return CompletableFuture.completedFuture(emptyMap())
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.md5lukas.waypoints.util

import de.md5lukas.commons.paper.editMeta
import java.net.URL
import java.net.URI
import java.util.*
import org.bukkit.Location
import org.bukkit.Material
Expand Down Expand Up @@ -46,7 +46,9 @@ fun createCustomPlayerHead(plugin: Plugin, textureId: String): ItemStack {
val profile = plugin.server.createProfile(UUID.randomUUID(), "CUSTOM_HEAD")

profile.setTextures(
profile.textures.also { it.skin = URL("https://textures.minecraft.net/texture/$textureId") })
profile.textures.also {
it.skin = URI.create("https://textures.minecraft.net/texture/$textureId").toURL()
})

val stack = ItemStack(Material.PLAYER_HEAD)
stack.editMeta<SkullMeta> { playerProfile = profile }
Expand Down
24 changes: 15 additions & 9 deletions waypoints/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ dependencies {
implementation(libs.md5Commons)
implementation(libs.kinvs)
implementation(libs.konfig)
implementation(libs.paperBrigadier) { this.isChanging = true }

// Required dependencies
implementation(libs.schedulers)
implementation(libs.skedule)
implementation(libs.anvilGui)
implementation(libs.bStats)
implementation(libs.bundles.commandApi)

// Optional dependencies
implementation(libs.vaultApi)
Expand All @@ -64,6 +64,13 @@ dependencies {
testRuntimeOnly(libs.junitLauncher)
}

configurations.all {
resolutionStrategy {
cacheChangingModulesFor(10, TimeUnit.MINUTES)
cacheDynamicVersionsFor(10, TimeUnit.MINUTES)
}
}

tasks {
register<ResourceIndexTask>("createResourceIndex")

Expand All @@ -73,8 +80,7 @@ tasks {
val properties =
mapOf(
"version" to project.version,
"apiVersion" to
libs.versions.paper.get().substringBefore('-').split('.').take(2).joinToString("."),
"apiVersion" to libs.versions.paper.get().substringBefore('-'),
"kotlinVersion" to libs.versions.kotlin.get(),
"coroutinesVersion" to libs.versions.coroutines.get(),
)
Expand Down Expand Up @@ -114,15 +120,16 @@ tasks {
include(dependency(libs.md5Commons.get()))
include(dependency(libs.kinvs.get()))
include(dependency(libs.konfig.get()))
include(dependency(libs.paperBrigadier.get()))

include(dependency(libs.schedulers.get()))
include(dependency(libs.skedule.get()))
include(dependency(libs.anvilGui.get()))
include(dependency("org.bstats::"))
}

arrayOf("commons", "kinvs", "konfig", "schedulers", "signgui").forEach {
relocate("de.md5lukas.$it", "de.md5lukas.waypoints.libs.$it")
arrayOf("commons", "kinvs", "konfig", "schedulers", "signgui", "paper.brigadier").forEach {
relocate("de.md5lukas.$it", "de.md5lukas.waypoints.libs.${it.substringAfterLast('.')}")
}
arrayOf("com.okkero.skedule", "net.wesjd.anvilgui", "org.bstats").forEach {
relocate(it, "de.md5lukas.waypoints.libs.${it.substringAfterLast('.')}")
Expand All @@ -136,8 +143,8 @@ tasks {
minecraftVersion(libs.versions.paper.get().substringBefore('-'))

downloadPlugins {
modrinth("commandapi", libs.versions.commandApi.get())
github("dmulloy2", "ProtocolLib", "5.2.0", "ProtocolLib.jar")
url(
"https://ci.dmulloy2.net/job/ProtocolLib/lastSuccessfulBuild/artifact/build/libs/ProtocolLib.jar")
}
}

Expand All @@ -159,7 +166,7 @@ modrinth {
versionType = "release"
uploadFile.set(tasks.shadowJar)

gameVersions.addAll("1.20.2", "1.20.4", "1.20.6")
gameVersions.addAll(libs.versions.paper.get().substringBefore('-'))
loaders.addAll("paper", "folia")

syncBodyFrom = provider { rootProject.file("README.md").readText() }
Expand All @@ -169,7 +176,6 @@ modrinth {
}

dependencies {
with(required) { project("commandapi") }
with(optional) {
project("pl3xmap")
project("bluemap")
Expand Down
12 changes: 10 additions & 2 deletions waypoints/src/main/kotlin/de/md5lukas/waypoints/WaypointsPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import de.md5lukas.waypoints.tasks.CleanDatabaseTask
import de.md5lukas.waypoints.util.APIExtensions
import de.md5lukas.waypoints.util.TeleportManager
import de.md5lukas.waypoints.util.UpdateChecker
import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents
import java.io.File
import java.util.concurrent.TimeUnit
import java.util.logging.Level
Expand Down Expand Up @@ -222,9 +223,16 @@ class WaypointsPlugin : JavaPlugin() {
}
}

@Suppress("UnstableApiUsage")
private fun registerCommands() {
WaypointsCommand(this).register()
WaypointsScriptCommand(this).register()
lifecycleManager.registerEventHandler(LifecycleEvents.COMMANDS) {
val registrar = it.registrar()
registrar.register(
WaypointsCommand(this).buildCommand(), waypointsConfig.general.commands.waypointsAliases)
registrar.register(
WaypointsScriptCommand(this).buildCommand(),
waypointsConfig.general.commands.waypointsScriptAliases)
}
}

private fun registerEvents() {
Expand Down
Loading

0 comments on commit 3819a69

Please sign in to comment.