Skip to content

Commit

Permalink
fix: offhand swap
Browse files Browse the repository at this point in the history
  • Loading branch information
DebitCardz committed Feb 20, 2024
1 parent 8ebfefe commit 17fd727
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 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.4.7")
implementation("com.github.DebitCardz:mc-chestui-plus:1.4.9")
}
```
### Maven
Expand All @@ -34,7 +34,7 @@ dependencies {
<dependency>
<groupId>com.github.DebitCardz</groupId>
<artifactId>mc-chestui-plus</artifactId>
<version>1.4.7</version>
<version>1.4.9</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.4.7"
version = "1.4.9"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@ 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
}
}

guiSlot.onClick?.let { uiEvent ->
uiEvent(this, whoClicked as Player)
}
}

companion object {
private val PICKUP_CLICK_ACTIONS = setOf(
ClickType.DROP,
ClickType.CONTROL_DROP,
ClickType.SWAP_OFFHAND
)
}
}

0 comments on commit 17fd727

Please sign in to comment.