Skip to content

Commit 91b4b05

Browse files
committed
fix compile
1 parent 7dfb3a2 commit 91b4b05

File tree

81 files changed

+985
-730
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+985
-730
lines changed

build.gradle.kts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import com.diffplug.gradle.spotless.SpotlessExtension
22
import com.diffplug.gradle.spotless.SpotlessPlugin
3-
import com.diffplug.gradle.spotless.SpotlessTask
43
import net.kyori.indra.IndraCheckstylePlugin
54
import net.kyori.indra.IndraPlugin
65
import net.kyori.indra.IndraPublishingPlugin
7-
import net.kyori.indra.repository.sonatypeSnapshots
8-
import xyz.jpenilla.runpaper.task.RunServerTask
6+
import xyz.jpenilla.runpaper.task.RunServer
97

108
plugins {
119
alias(libs.plugins.indra)
@@ -15,8 +13,8 @@ plugins {
1513
alias(libs.plugins.runPaper) apply false
1614

1715
// Kotlin plugin prefers to be applied to parent when it's used in multiple sub-modules.
18-
kotlin("jvm") version "1.8.21" apply false
19-
id("com.diffplug.spotless") version "6.18.0"
16+
kotlin("jvm") version "2.2.10" apply false
17+
id("com.diffplug.spotless") version "7.2.1"
2018
}
2119

2220
group = "org.incendo.interfaces"
@@ -35,8 +33,8 @@ subprojects {
3533

3634
repositories {
3735
mavenCentral()
38-
sonatypeSnapshots()
39-
maven("https://papermc.io/repo/repository/maven-public/")
36+
sonatype.snapshots()
37+
maven("https://repo.papermc.io/repository/maven-public/")
4038
}
4139

4240
dependencies {
@@ -69,12 +67,12 @@ subprojects {
6967

7068
configure<SpotlessExtension> {
7169
kotlin {
72-
ktlint("0.47.1")
70+
ktlint("1.7.1")
7371
}
7472
}
7573

7674
// Configure any existing RunServerTasks
77-
tasks.withType<RunServerTask> {
75+
tasks.withType<RunServer> {
7876
minecraftVersion("1.19.4")
7977
jvmArgs("-Dio.papermc.paper.suppress.sout.nags=true")
8078
}

examples/example-next/build.gradle.kts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
13
plugins {
24
kotlin("jvm")
35
alias(libs.plugins.dokka)
46
alias(libs.plugins.shadow)
57
alias(libs.plugins.runPaper)
68
}
79

8-
tasks {
9-
compileKotlin {
10-
kotlinOptions.jvmTarget = "17"
11-
}
12-
13-
compileTestKotlin {
14-
kotlinOptions.jvmTarget = "17"
10+
kotlin {
11+
compilerOptions {
12+
jvmTarget = JvmTarget.JVM_17
1513
}
1614
}
1715

examples/example-next/src/main/kotlin/org/incendo/interfaces/example/next/CatalogueExampleInterface.kt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@ import org.incendo.interfaces.next.interfaces.buildCombinedInterface
1010
public class CatalogueExampleInterface : RegistrableInterface {
1111
override val subcommand: String = "catalogue"
1212

13-
override fun create(): Interface<*> = buildCombinedInterface {
14-
rows = 1
13+
override fun create(): Interface<*> =
14+
buildCombinedInterface {
15+
rows = 1
1516

16-
withTransform { pane, _ ->
17-
pane[3, 3] = StaticElement(
18-
Drawable.drawable(Material.STICK)
19-
) { (player) ->
20-
runBlocking {
21-
ChangingTitleExampleInterface().create().open(player)
22-
}
17+
withTransform { pane, _ ->
18+
pane[3, 3] =
19+
StaticElement(
20+
Drawable.drawable(Material.STICK),
21+
) { (player) ->
22+
runBlocking {
23+
ChangingTitleExampleInterface().create().open(player)
24+
}
25+
}
2326
}
2427
}
25-
}
2628
}

examples/example-next/src/main/kotlin/org/incendo/interfaces/example/next/ChangingTitleExampleInterface.kt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,26 @@ import org.incendo.interfaces.next.interfaces.buildCombinedInterface
1010
import org.incendo.interfaces.next.properties.interfaceProperty
1111

1212
public class ChangingTitleExampleInterface : RegistrableInterface {
13-
1413
override val subcommand: String = "changing-title"
1514

16-
override fun create(): Interface<*> = buildCombinedInterface {
17-
rows = 1
15+
override fun create(): Interface<*> =
16+
buildCombinedInterface {
17+
rows = 1
1818

19-
val numberProperty = interfaceProperty(0)
20-
var number by numberProperty
19+
val numberProperty = interfaceProperty(0)
20+
var number by numberProperty
2121

22-
withTransform(numberProperty) { pane, view ->
23-
view.title(Component.text(number))
22+
withTransform(numberProperty) { pane, view ->
23+
view.title(Component.text(number))
2424

25-
val item = ItemStack(Material.STICK)
26-
.name("number -> $number")
25+
val item =
26+
ItemStack(Material.STICK)
27+
.name("number -> $number")
2728

28-
pane[0, 4] = StaticElement(Drawable.drawable(item)) {
29-
number += 1
29+
pane[0, 4] =
30+
StaticElement(Drawable.drawable(item)) {
31+
number += 1
32+
}
3033
}
3134
}
32-
}
3335
}

examples/example-next/src/main/kotlin/org/incendo/interfaces/example/next/DelayedRequestExampleInterface.kt

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,39 @@ import org.incendo.interfaces.next.interfaces.buildCombinedInterface
1313
import kotlin.time.Duration.Companion.seconds
1414

1515
public class DelayedRequestExampleInterface : RegistrableInterface {
16-
1716
private companion object {
1817
private val BACKING_ELEMENT = StaticElement(Drawable.drawable(Material.GRAY_CONCRETE))
1918
}
2019

2120
override val subcommand: String = "delayed"
2221

2322
@OptIn(DelicateCoroutinesApi::class)
24-
override fun create(): Interface<*> = buildCombinedInterface {
25-
initialTitle = text(subcommand)
26-
rows = 2
27-
28-
withTransform { pane, _ ->
29-
suspendingData().forEachIndexed { index, material ->
30-
pane[0, index] = StaticElement(Drawable.drawable(material))
31-
}
32-
}
33-
34-
withTransform { pane, _ ->
35-
for (index in 0..8) {
36-
pane[1, index] = BACKING_ELEMENT
23+
override fun create(): Interface<*> =
24+
buildCombinedInterface {
25+
initialTitle = text(subcommand)
26+
rows = 2
27+
28+
withTransform { pane, _ ->
29+
suspendingData().forEachIndexed { index, material ->
30+
pane[0, index] = StaticElement(Drawable.drawable(material))
31+
}
3732
}
3833

39-
pane[0, 8] = StaticElement(Drawable.drawable(Material.ENDER_PEARL)) {
40-
// This is very unsafe, it's up to you to set up a way to reliably
41-
// launch coroutines per player in a click handler.
42-
GlobalScope.launch {
43-
it.view.back()
34+
withTransform { pane, _ ->
35+
for (index in 0..8) {
36+
pane[1, index] = BACKING_ELEMENT
4437
}
38+
39+
pane[0, 8] =
40+
StaticElement(Drawable.drawable(Material.ENDER_PEARL)) {
41+
// This is very unsafe, it's up to you to set up a way to reliably
42+
// launch coroutines per player in a click handler.
43+
GlobalScope.launch {
44+
it.view.back()
45+
}
46+
}
4547
}
4648
}
47-
}
4849

4950
private suspend fun suspendingData(): List<Material> {
5051
delay(3.seconds)

examples/example-next/src/main/kotlin/org/incendo/interfaces/example/next/ExampleUtilities.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ import net.kyori.adventure.text.Component
44
import org.bukkit.inventory.ItemStack
55

66
public fun ItemStack.name(name: String): ItemStack {
7-
itemMeta = itemMeta.also { meta ->
8-
meta.displayName(Component.text(name))
9-
}
7+
itemMeta =
8+
itemMeta.also { meta ->
9+
meta.displayName(Component.text(name))
10+
}
1011
return this
1112
}
1213

1314
public fun ItemStack.description(description: String): ItemStack {
14-
itemMeta = itemMeta.also { meta ->
15-
meta.lore(listOf(Component.text(description)))
16-
}
15+
itemMeta =
16+
itemMeta.also { meta ->
17+
meta.lore(listOf(Component.text(description)))
18+
}
1719
return this
1820
}

examples/example-next/src/main/kotlin/org/incendo/interfaces/example/next/MovingExampleInterface.kt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ import org.incendo.interfaces.next.utilities.BoundInteger
1010
public class MovingExampleInterface : RegistrableInterface {
1111
override val subcommand: String = "moving"
1212

13-
override fun create(): Interface<*> = buildCombinedInterface {
14-
val countProperty = BoundInteger(4, 1, 7)
15-
var count by countProperty
13+
override fun create(): Interface<*> =
14+
buildCombinedInterface {
15+
val countProperty = BoundInteger(4, 1, 7)
16+
var count by countProperty
1617

17-
rows = 1
18+
rows = 1
1819

19-
withTransform(countProperty) { pane, _ ->
20-
pane[0, 0] = StaticElement(drawable(Material.RED_CONCRETE)) { count-- }
21-
pane[0, 8] = StaticElement(drawable(Material.GREEN_CONCRETE)) { count++ }
20+
withTransform(countProperty) { pane, _ ->
21+
pane[0, 0] = StaticElement(drawable(Material.RED_CONCRETE)) { count-- }
22+
pane[0, 8] = StaticElement(drawable(Material.GREEN_CONCRETE)) { count++ }
2223

23-
pane[0, count] = StaticElement(drawable(Material.STICK))
24+
pane[0, count] = StaticElement(drawable(Material.STICK))
25+
}
2426
}
25-
}
2627
}

0 commit comments

Comments
 (0)