Skip to content

Commit bab92d5

Browse files
committed
Support creative mode properly
1 parent 5f620d2 commit bab92d5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ val javaVersion: Int = 21
1515

1616
allprojects {
1717
group = "com.noxcrew.interfaces"
18-
version = "1.1.2-SNAPSHOT"
18+
version = "1.1.3-SNAPSHOT"
1919

2020
tasks.withType<JavaCompile> {
2121
sourceCompatibility = javaVersion.toString()

interfaces/src/main/kotlin/com/noxcrew/interfaces/view/PlayerInterfaceView.kt

+7-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public class PlayerInterfaceView internal constructor(
4444
if (isOpen()) {
4545
// Clear the player's inventory!
4646
player.inventory.clear()
47-
if (player.openInventory.topInventory.type == InventoryType.CRAFTING) {
47+
if (player.openInventory.topInventory.type == InventoryType.CRAFTING ||
48+
player.openInventory.topInventory.type == InventoryType.CREATIVE
49+
) {
4850
player.openInventory.topInventory.clear()
4951
}
5052
player.openInventory.cursor = null
@@ -66,6 +68,9 @@ public class PlayerInterfaceView internal constructor(
6668
}
6769

6870
override fun isOpen(): Boolean =
69-
player.openInventory.type == InventoryType.CRAFTING &&
71+
(
72+
player.openInventory.type == InventoryType.CRAFTING ||
73+
player.openInventory.type == InventoryType.CREATIVE
74+
) &&
7075
InterfacesListeners.INSTANCE.getOpenInterface(player.uniqueId) == this
7176
}

0 commit comments

Comments
 (0)