Skip to content

Commit

Permalink
fix: unregister GUI a tick later (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
DebitCardz authored Aug 12, 2023
1 parent 9844732 commit 576cf92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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.3"
version = "1.0.4"

repositories {
mavenCentral()
Expand Down
7 changes: 5 additions & 2 deletions src/main/kotlin/me/tech/mcchestui/GUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package me.tech.mcchestui

import net.kyori.adventure.text.Component
import org.bukkit.Bukkit
import org.bukkit.Material
import org.bukkit.entity.HumanEntity
import org.bukkit.entity.Player
Expand All @@ -21,7 +22,7 @@ fun toSlot(x: Int, y: Int, type: GUIType) = (x - 1) + ((y - 1) * type.slotsPerRo
fun fromSlot(s: Int, type: GUIType) = Pair(s % type.slotsPerRow, s / type.slotsPerRow)

class GUI(
plugin: JavaPlugin,
private val plugin: JavaPlugin,
val title: Component,
val type: GUIType,
private val render: GUI.() -> Unit
Expand Down Expand Up @@ -280,7 +281,9 @@ class GUI(
return
}

HandlerList.unregisterAll(this)
plugin.server.scheduler.runTask(plugin, Runnable {
HandlerList.unregisterAll(this)
})
}
}

Expand Down

0 comments on commit 576cf92

Please sign in to comment.