Skip to content

Commit

Permalink
fix: non-null pickup event
Browse files Browse the repository at this point in the history
  • Loading branch information
DebitCardz committed Aug 19, 2024
1 parent 4142002 commit 98d8c5c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repositories {
}

dependencies {
implementation("com.github.DebitCardz:mc-chestui-plus:1.5.0")
implementation("com.github.DebitCardz:mc-chestui-plus:1.5.6")
}
```
### Maven
Expand All @@ -34,7 +34,7 @@ dependencies {
<dependency>
<groupId>com.github.DebitCardz</groupId>
<artifactId>mc-chestui-plus</artifactId>
<version>1.5.0</version>
<version>1.5.6</version>
</dependency>

```
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ val githubActor = project.findProperty("gpr.user") as String? ?: System.getenv("
val githubToken = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")

group = "me.tech"
version = "1.5.5"
version = "1.5.6"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ internal class GUIItemPickupListener(gui: GUI): GUIEventListener(gui) {
}

if(clickedInventory == whoClicked.inventory) {
if(currentItem == null || currentItem?.type?.isEmpty == true) {
val itemStack = currentItem
?: return
if(itemStack.type.isEmpty) {
return
}

gui.onPlayerInventoryPickupItem?.let { uiEvent ->
uiEvent(this, whoClicked as Player, currentItem, slot).let { outcome ->
uiEvent(this, whoClicked as Player, itemStack, slot).let { outcome ->
isCancelled = outcome
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/me/tech/mcchestui/utils/GUIHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal typealias GUIItemPlaceEvent = InventoryClickEvent.(player: Player, item
/**
* Event when a [ItemStack] or [GUI.Slot] is picked up.
*/
internal typealias GUIItemPickupEvent = InventoryClickEvent.(player: Player, item: ItemStack?, slot: Int) -> Boolean
internal typealias GUIItemPickupEvent = InventoryClickEvent.(player: Player, item: ItemStack, slot: Int) -> Boolean

/**
* Event when an [ItemStack] is dragged across a [GUI].
Expand Down

0 comments on commit 98d8c5c

Please sign in to comment.