Skip to content

Commit

Permalink
fix: onOpen 인벤토리를 연 플레이어만 실행되게 변
Browse files Browse the repository at this point in the history
  • Loading branch information
cccgh5 committed Apr 22, 2024
1 parent 756771b commit 5cc1367
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,21 @@ open class HQContainer(
}

fun open(vararg players: Player) {
val openedPlayers = mutableListOf<Player>()
for (player in players) {
val prevHolder = player.openInventory.topInventory.holder
if (prevHolder == this) continue
if (prevHolder is HQContainer) {
if (plugin == null) plugin = Bukkit.getPluginManager().getPlugin("HQFramework")
val plugin = plugin!!
plugin.server.scheduler.runTaskLater(plugin, Runnable { open(player) }, 1)
} else player.openInventory(inventory)
} else {
player.openInventory(inventory)
openedPlayers.add(player)
}
}
onOpen(*players)

onOpen(*openedPlayers.toTypedArray())
}

@Suppress("deprecation")
Expand Down

0 comments on commit 5cc1367

Please sign in to comment.