Skip to content

Commit fc41fbf

Browse files
committed
fix: fill inv
1 parent 5100043 commit fc41fbf

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/main/kotlin/cc/modlabs/kpaper/extensions/InventoryExtensions.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ fun Inventory.setItem(range: IntProgression, item: ItemStack) {
163163
range.forEach { this.setItem(it, item) }
164164
}
165165

166+
fun fillEmptyAndOpenInventory(player: Player, inv: Inventory, identifier: String? = null, vararg identifiers: Map<NamespacedKey, String>? = arrayOf()) {
167+
fillEmptyInventory(inv, PLACEHOLDER_GRAY)
168+
if (identifier != null) inv.identify(identifier, *identifiers)
169+
player.openInventory(inv)
170+
}
171+
166172
fun fillEmptyAndOpenInventory(player: Player, inv: Inventory, spacer: ItemStack = PLACEHOLDER_GRAY, identifier: String? = null, vararg identifiers: Map<NamespacedKey, String>? = arrayOf()) {
167173
fillEmptyInventory(inv, spacer)
168174
if (identifier != null) inv.identify(identifier, *identifiers)

0 commit comments

Comments
 (0)