diff --git a/README.md b/README.md index cad9085..24ff170 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ repositories { } dependencies { - implementation("com.github.DebitCardz:mc-chestui-plus:1.4.7") + implementation("com.github.DebitCardz:mc-chestui-plus:1.4.9") } ``` ### Maven @@ -34,7 +34,7 @@ dependencies { com.github.DebitCardz mc-chestui-plus - 1.4.7 + 1.4.9 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 4da2fff..948cb28 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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.4.7" +version = "1.4.9" repositories { mavenCentral() diff --git a/src/main/kotlin/me/tech/mcchestui/listeners/GUISlotClickListener.kt b/src/main/kotlin/me/tech/mcchestui/listeners/GUISlotClickListener.kt index 54bc9a8..d394e2e 100644 --- a/src/main/kotlin/me/tech/mcchestui/listeners/GUISlotClickListener.kt +++ b/src/main/kotlin/me/tech/mcchestui/listeners/GUISlotClickListener.kt @@ -17,9 +17,10 @@ internal class GUISlotClickListener(gui: GUI) : GUIEventListener(gui) { val guiSlot = gui.slots.getOrNull(slot) ?: return // handle cancellation of task in onPlace. - if(click == ClickType.DROP || click == ClickType.CONTROL_DROP) { - if(!guiSlot.allowPickup) { + if(click in PICKUP_CLICK_ACTIONS) { + if(!gui.allowItemPickup) { isCancelled = true + return } } @@ -27,4 +28,12 @@ internal class GUISlotClickListener(gui: GUI) : GUIEventListener(gui) { uiEvent(this, whoClicked as Player) } } + + companion object { + private val PICKUP_CLICK_ACTIONS = setOf( + ClickType.DROP, + ClickType.CONTROL_DROP, + ClickType.SWAP_OFFHAND + ) + } } \ No newline at end of file