Skip to content

Commit 5e5604b

Browse files
committed
fix: same functions
1 parent 8f7cced commit 5e5604b

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,13 @@ 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-
fillEmpty(inv, PLACEHOLDER_GRAY)
166+
fun fillEmptyAndOpenInventory(player: Player, inv: Inventory, spacer: ItemStack = PLACEHOLDER_GRAY, identifier: String? = null, vararg identifiers: Map<NamespacedKey, String>? = arrayOf()) {
167+
fillEmptyInventory(inv, spacer)
168168
if (identifier != null) inv.identify(identifier, *identifiers)
169169
player.openInventory(inv)
170170
}
171171

172-
173-
fun fillEmptyAndOpenInventoryWithCustomSpacer(player: Player, inv: Inventory, spacer: ItemStack, identifier: String? = null, vararg identifiers: Map<NamespacedKey, String>? = arrayOf()) {
174-
fillEmpty(inv, spacer)
175-
if (identifier != null) inv.identify(identifier, *identifiers)
176-
player.openInventory(inv)
177-
}
178-
179-
fun fillEmpty(inventory: Inventory, customSpacer: ItemStack, identifier: String? = null, vararg identifiers: Map<NamespacedKey, String>? = arrayOf()) {
172+
fun fillEmptyInventory(inventory: Inventory, customSpacer: ItemStack, identifier: String? = null, vararg identifiers: Map<NamespacedKey, String>? = arrayOf()) {
180173
for (i in 0 until inventory.size) {
181174
if (inventory.getItem(i) == null || inventory.getItem(i)!!.type == Material.AIR) {
182175
inventory.setItem(i, customSpacer)
@@ -186,7 +179,7 @@ fun fillEmpty(inventory: Inventory, customSpacer: ItemStack, identifier: String?
186179
}
187180

188181
fun Inventory.fillEmpty(filler: ItemStack, identifier: String? = null, vararg identifiers: Map<NamespacedKey, String>? = arrayOf()) {
189-
fillEmpty(this, filler, identifier, *identifiers)
182+
fillEmptyInventory(this, filler, identifier, *identifiers)
190183
}
191184

192185
fun Inventory.arrangeItemsAround(newItem: ItemStack) {

0 commit comments

Comments
 (0)