From cbe3a04b5aa1f55ddad17e0e05e6dc35d7f06a65 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 20:08:53 +0000 Subject: [PATCH] Remove unneeded code --- .../construction/decoration/kitchen/ShelfListener.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) 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) {