diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index 57b38be55..554257469 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -95,7 +95,6 @@ class ShelfListener : InteractionListener { return } val itemsPerPage = 4 - val totalPages = (shelfItemsNames.size + itemsPerPage - 1) / itemsPerPage // Total number of pages when (stage) { 0, shelfItemsNames.size + 1 -> { // Initial stage or final more button clicked @@ -106,14 +105,9 @@ class ShelfListener : InteractionListener { val currentPage = stage / (itemsPerPage + 1) val startIndex = currentPage * itemsPerPage - if (buttonID == itemsPerPage + 1) { // "More" button clicked - if (currentPage < totalPages) { - val topics = createTopics(currentPage + 1, itemsPerPage) - showTopics(*topics.toTypedArray()).also { stage = currentPage*4 + 1 } - } else { // Last page, loop back to the first page - val topics = createTopics(1, itemsPerPage) - showTopics(*topics.toTypedArray()).also { stage = 1 } - } + if (buttonID == itemsPerPage + 1) { // "More" button clicked (but not the last one) + val topics = createTopics(currentPage + 1, itemsPerPage) + showTopics(*topics.toTypedArray()).also { stage = currentPage*4 + 1 } } else { // Handle item selection val itemIndex = startIndex + (buttonID - 1) if (itemIndex < shelfItemsNames.size) {