Skip to content

Commit 17fd727

Browse files
committed
fix: offhand swap
1 parent 8ebfefe commit 17fd727

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
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.4.7")
24+
implementation("com.github.DebitCardz:mc-chestui-plus:1.4.9")
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.4.7</version>
37+
<version>1.4.9</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.4.7"
11+
version = "1.4.9"
1212

1313
repositories {
1414
mavenCentral()

src/main/kotlin/me/tech/mcchestui/listeners/GUISlotClickListener.kt

+11-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,23 @@ internal class GUISlotClickListener(gui: GUI) : GUIEventListener(gui) {
1717
val guiSlot = gui.slots.getOrNull(slot)
1818
?: return // handle cancellation of task in onPlace.
1919

20-
if(click == ClickType.DROP || click == ClickType.CONTROL_DROP) {
21-
if(!guiSlot.allowPickup) {
20+
if(click in PICKUP_CLICK_ACTIONS) {
21+
if(!gui.allowItemPickup) {
2222
isCancelled = true
23+
return
2324
}
2425
}
2526

2627
guiSlot.onClick?.let { uiEvent ->
2728
uiEvent(this, whoClicked as Player)
2829
}
2930
}
31+
32+
companion object {
33+
private val PICKUP_CLICK_ACTIONS = setOf(
34+
ClickType.DROP,
35+
ClickType.CONTROL_DROP,
36+
ClickType.SWAP_OFFHAND
37+
)
38+
}
3039
}

0 commit comments

Comments
 (0)