Skip to content

Commit

Permalink
fix: on close event triggering every close (#9)
Browse files Browse the repository at this point in the history
Because it was never checked which inventory was being closed this would fire for all inventories regardless of if the correct inventory was being closed.
  • Loading branch information
DebitCardz authored Aug 12, 2023
1 parent d93aa24 commit df8152c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repositories {
}

dependencies {
implementation("com.github.DebitCardz:mc-chestui-plus:1.0.4")
implementation("com.github.DebitCardz:mc-chestui-plus:1.0.5")
}
```
### Maven
Expand All @@ -31,7 +31,7 @@ dependencies {
<dependency>
<groupId>com.github.DebitCardz</groupId>
<artifactId>mc-chestui-plus</artifactId>
<version>1.0.4</version>
<version>1.0.5</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.0.4"
version = "1.0.5"

repositories {
mavenCentral()
Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/me/tech/mcchestui/GUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ class GUI(

@EventHandler(priority = EventPriority.MONITOR)
internal fun onInventoryClose(ev: InventoryCloseEvent) {
if(ev.inventory != inventory) {
return
}

onCloseInventory?.let { uiEvent ->
uiEvent(ev, ev.player)
}
Expand All @@ -277,7 +281,7 @@ class GUI(
return
}

if(ev.inventory != inventory || ev.inventory.viewers.size > 1) {
if(ev.inventory.viewers.size > 1) {
return
}

Expand Down

0 comments on commit df8152c

Please sign in to comment.