Skip to content

Commit

Permalink
feat: add UpdateInventoryOnCloseListener
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed Jul 15, 2024
1 parent 61dfbe8 commit 0bbb666
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "net.azisaba"
version = "6.11.1"
version = "6.11.2"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/github/mori01231/lifecore/LifeCore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ class LifeCore : JavaPlugin() {
pm.registerEvents(OverrideTabCompleteListener(), this)
pm.registerEvents(KotlinLoveItemListener(this), this)
pm.registerEvents(CommandListScreen.EventListener(), this)
pm.registerEvents(UpdateInventoryOnCloseListener(this), this)

// Items
pm.registerEvents(OreOnlyItemListener(), this)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.github.mori01231.lifecore.listener

import com.github.mori01231.lifecore.LifeCore
import org.bukkit.Bukkit
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.inventory.InventoryCloseEvent

class UpdateInventoryOnCloseListener(private val plugin: LifeCore) : Listener {
@EventHandler
fun onInventoryClose(e: InventoryCloseEvent) {
Bukkit.getScheduler().runTask(plugin, Runnable {
(e.player as Player).updateInventory()
})
}
}

0 comments on commit 0bbb666

Please sign in to comment.