Skip to content

Commit dd7a6f6

Browse files
committed
Switch to MCCoroutine, clean up gradle
1 parent c1133e9 commit dd7a6f6

File tree

5 files changed

+15
-24
lines changed

5 files changed

+15
-24
lines changed

build.gradle.kts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,22 @@ repositories {
2727
mavenCentral()
2828
google()
2929
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
30-
maven("https://jitpack.io")
30+
maven("https://repo.codemc.org/repository/maven-public/")
3131
}
3232

3333
dependencies {
3434
// MineInAbyss platform
3535
compileOnly(libs.kotlinx.coroutines)
36+
compileOnly(libs.minecraft.mccoroutine)
3637
compileOnly(libs.kotlin.reflect)
3738
compileOnly(libs.minecraft.anvilgui)
38-
compileOnly(libs.minecraft.skedule)
3939

4040
// Shaded
4141
api(compose.runtime) {
4242
exclude("org.jetbrains.kotlin")
4343
exclude("org.jetbrains.kotlinx")
4444
}
4545

46-
implementation("com.mineinabyss:idofront:$idofrontVersion")
46+
implementation(libs.idofront.core)
4747
implementation(libs.idofront.nms)
4848
}
49-
50-
tasks {
51-
assemble {
52-
dependsOn(reobfJar)
53-
}
54-
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ version=0.5
44
kotlinVersion=1.6.10
55
composeVersion=1.1.1
66
serverVersion=1.18.2-R0.1-SNAPSHOT
7-
idofrontVersion=0.9.86
7+
idofrontVersion=0.10.90

src/main/kotlin/com/mineinabyss/guiy/components/canvases/Inventory.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.mineinabyss.guiy.components.canvases
22

33
import androidx.compose.runtime.*
4+
import com.github.shynixn.mccoroutine.bukkit.launch
45
import com.mineinabyss.guiy.guiyPlugin
56
import com.mineinabyss.guiy.inventory.GuiyInventoryHolder
67
import com.mineinabyss.guiy.inventory.GuiyOwner
@@ -11,17 +12,13 @@ import com.mineinabyss.guiy.modifiers.DragScope
1112
import com.mineinabyss.guiy.modifiers.Modifier
1213
import com.mineinabyss.guiy.nodes.InventoryCloseScope
1314
import com.mineinabyss.guiy.nodes.StaticMeasurePolicy
14-
import com.mineinabyss.idofront.nms.aliases.NMSItemStack
15-
import com.mineinabyss.idofront.nms.aliases.NMSPlayer
16-
import com.mineinabyss.idofront.nms.aliases.toNMS
17-
import com.okkero.skedule.schedule
15+
import com.mineinabyss.idofront.time.ticks
1816
import kotlinx.coroutines.delay
1917
import org.bukkit.Material
2018
import org.bukkit.entity.Player
2119
import org.bukkit.event.inventory.InventoryClickEvent
2220
import org.bukkit.event.inventory.InventoryCloseEvent
2321
import org.bukkit.inventory.Inventory
24-
import org.bukkit.inventory.ItemStack
2522

2623
//val LocalHolder: ProvidableCompositionLocal<GuiyInventoryHolder> =
2724
// staticCompositionLocalOf { error("No local holder defined") }
@@ -61,8 +58,8 @@ inline fun rememberInventoryHolder(
6158
.forEach { it.openInventory(inventory) }
6259
}
6360
}
64-
guiyPlugin.schedule {
65-
waitFor(1)
61+
guiyPlugin.launch {
62+
delay(1.ticks)
6663
onClose.invoke(scope, player)
6764
}
6865
}
@@ -80,7 +77,7 @@ fun GuiyOwner.Inventory(
8077
// Close inventory when it switches to a new one
8178
DisposableEffect(inventory) {
8279
onDispose {
83-
guiyPlugin.schedule {
80+
guiyPlugin.launch {
8481
inventory.close()
8582
}
8683
}
@@ -89,7 +86,7 @@ fun GuiyOwner.Inventory(
8986
LaunchedEffect(viewers, inventory) {
9087
val oldViewers = inventory.viewers.toSet()
9188

92-
guiyPlugin.schedule {
89+
guiyPlugin.launch {
9390
// Close inventory for removed viewers
9491
(oldViewers - viewers).forEach {
9592
it.closeInventory(InventoryCloseEvent.Reason.PLUGIN)

src/main/kotlin/com/mineinabyss/guiy/inventory/GuiyEventListener.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.mineinabyss.guiy.inventory
22

3+
import com.github.shynixn.mccoroutine.bukkit.launch
34
import com.mineinabyss.guiy.guiyPlugin
45
import com.mineinabyss.guiy.modifiers.DragScope
56
import com.mineinabyss.idofront.nms.aliases.NMSItemStack
67
import com.mineinabyss.idofront.nms.aliases.NMSPlayer
78
import com.mineinabyss.idofront.nms.aliases.toNMS
8-
import com.okkero.skedule.schedule
99
import kotlinx.coroutines.delay
1010
import org.bukkit.Material
1111
import org.bukkit.entity.Player
@@ -47,7 +47,7 @@ class GuiyEventListener : Listener {
4747
if (inGuiy.isNotEmpty()) {
4848
isCancelled = true
4949
result = Event.Result.DEFAULT
50-
val newCursor = oldCursor.apply { inGuiy.map { inventory.getItem(it.key)?.amount ?: 0 }.sum() }
50+
val newCursor = oldCursor.apply { inGuiy.map { inventory.getItem(it.key)?.amount ?: 0 }.sum() }
5151
val event = InventoryDragEvent(
5252
view, newCursor, oldCursor, type == DragType.SINGLE, inPlayerInv
5353
)
@@ -60,7 +60,7 @@ class GuiyEventListener : Listener {
6060

6161
val scope = DragScope(type, inGuiy, newCursor)
6262
guiyHolder.processDrag(scope)
63-
guiyPlugin.schedule {
63+
guiyPlugin.launch {
6464
delay(1)
6565
val nmsView = whoClicked.toNMS<NMSPlayer>().containerMenu
6666
nmsView.carried = NMSItemStack.fromBukkitCopy(scope.cursor ?: ItemStack(Material.AIR))

src/main/kotlin/com/mineinabyss/guiy/navigation/Navigator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import androidx.compose.runtime.Composable
44
import androidx.compose.runtime.LaunchedEffect
55
import androidx.compose.runtime.mutableStateListOf
66
import androidx.compose.runtime.remember
7+
import com.github.shynixn.mccoroutine.bukkit.launch
78
import com.mineinabyss.guiy.guiyPlugin
8-
import com.okkero.skedule.schedule
99
import org.bukkit.entity.Player
1010

1111

@@ -37,7 +37,7 @@ class Navigator<T>(val default: () -> T) {
3737
if (universal.isNotEmpty()) {
3838
when (val screen = universal.first()) {
3939
is UniversalScreens.Anvil -> LaunchedEffect(screen) {
40-
guiyPlugin.schedule {
40+
guiyPlugin.launch {
4141
screen.builder.open(players.first()).inventory
4242
}
4343
}

0 commit comments

Comments
 (0)