From b39672a256261d09742412c67d636703d26369d9 Mon Sep 17 00:00:00 2001 From: Hamza Ali Date: Sun, 5 Apr 2020 22:50:28 +0700 Subject: [PATCH] Fix pagination only removing a single layer --- src/main/kotlin/pw.hamzantal.shopreborn/Util.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/pw.hamzantal.shopreborn/Util.kt b/src/main/kotlin/pw.hamzantal.shopreborn/Util.kt index b3d1ef2..85b665e 100644 --- a/src/main/kotlin/pw.hamzantal.shopreborn/Util.kt +++ b/src/main/kotlin/pw.hamzantal.shopreborn/Util.kt @@ -7,6 +7,7 @@ import org.bukkit.configuration.ConfigurationSection import org.bukkit.entity.Player import org.bukkit.inventory.Inventory import org.bukkit.inventory.ItemStack +import kotlin.math.max val String.c: String get() = ChatColor.translateAlternateColorCodes('&', this) @@ -48,7 +49,7 @@ fun makeInventory( if (page != total) setItem(menuRow + 8, buttons.forward) } - val dropping = (page - 1) * (size - kotlin.math.max(0, menuRow)) + val dropping = (page - 1) * (if(menuRow > 0) (size - 9) else size) items.drop(dropping).forEach { if (firstEmpty() != -1) setItem(firstEmpty(), it.item) else return@apply