Skip to content

Commit 98d8c5c

Browse files
committed
fix: non-null pickup event
1 parent 4142002 commit 98d8c5c

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repositories {
2121
}
2222

2323
dependencies {
24-
implementation("com.github.DebitCardz:mc-chestui-plus:1.5.0")
24+
implementation("com.github.DebitCardz:mc-chestui-plus:1.5.6")
2525
}
2626
```
2727
### Maven
@@ -34,7 +34,7 @@ dependencies {
3434
<dependency>
3535
<groupId>com.github.DebitCardz</groupId>
3636
<artifactId>mc-chestui-plus</artifactId>
37-
<version>1.5.0</version>
37+
<version>1.5.6</version>
3838
</dependency>
3939

4040
```

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ val githubActor = project.findProperty("gpr.user") as String? ?: System.getenv("
88
val githubToken = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
99

1010
group = "me.tech"
11-
version = "1.5.5"
11+
version = "1.5.6"
1212

1313
repositories {
1414
mavenCentral()

src/main/kotlin/me/tech/mcchestui/listeners/item/GUIItemPickupListener.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ internal class GUIItemPickupListener(gui: GUI): GUIEventListener(gui) {
2222
}
2323

2424
if(clickedInventory == whoClicked.inventory) {
25-
if(currentItem == null || currentItem?.type?.isEmpty == true) {
25+
val itemStack = currentItem
26+
?: return
27+
if(itemStack.type.isEmpty) {
2628
return
2729
}
2830

2931
gui.onPlayerInventoryPickupItem?.let { uiEvent ->
30-
uiEvent(this, whoClicked as Player, currentItem, slot).let { outcome ->
32+
uiEvent(this, whoClicked as Player, itemStack, slot).let { outcome ->
3133
isCancelled = outcome
3234
}
3335
}

src/main/kotlin/me/tech/mcchestui/utils/GUIHelper.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ internal typealias GUIItemPlaceEvent = InventoryClickEvent.(player: Player, item
5454
/**
5555
* Event when a [ItemStack] or [GUI.Slot] is picked up.
5656
*/
57-
internal typealias GUIItemPickupEvent = InventoryClickEvent.(player: Player, item: ItemStack?, slot: Int) -> Boolean
57+
internal typealias GUIItemPickupEvent = InventoryClickEvent.(player: Player, item: ItemStack, slot: Int) -> Boolean
5858

5959
/**
6060
* Event when an [ItemStack] is dragged across a [GUI].

0 commit comments

Comments
 (0)