Conversation
…agination controls
…urf/surfapi/bukkit/api/dialog/builder/DialogPaginationBuilder.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…/paginated-dialog
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new paginated dialog feature to the Bukkit API, providing a builder for creating dialogs with pagination capabilities. The implementation includes navigation buttons, configurable elements per page, and customizable pagination controls.
Key changes:
- Added
DialogPaginationBuilderclass with comprehensive pagination functionality - Introduced
DialogPageActioninterface for custom page navigation logic - Updated API version to 1.21.8-2.39.0
Reviewed Changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| DialogPaginationBuilder.kt | New builder class implementing paginated dialog functionality with navigation buttons and element management |
| surf-api-bukkit-api.api | API signature updates to expose the new pagination builder classes and methods |
| gradle.properties | Version bump from 2.38.0 to 2.39.0 |
Files not reviewed (2)
- .idea/misc.xml: Language not supported
- .idea/modules.xml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| width += paginationButtonWidth // current page button | ||
|
|
||
| return width.coerceAtLeast(minElementButtonWidth) |
There was a problem hiding this comment.
The function returns a calculated width but this value is never used to update the button widths. The variable width accumulates pagination button widths but doesn't account for the actual element button width calculation logic.
| return width.coerceAtLeast(minElementButtonWidth) | |
| val calculatedWidth = width.coerceAtLeast(minElementButtonWidth) | |
| minElementButtonWidth = calculatedWidth | |
| return calculatedWidth |
| private var firstPageButton = DialogPaginationBaseAction.FIRST.actionButton( | ||
| currentPage, maxPages, paginationButtonWidth | ||
| ) | ||
|
|
||
| private var backButton = DialogPaginationBaseAction.BACK.actionButton( | ||
| currentPage, maxPages, paginationButtonWidth | ||
| ) | ||
|
|
||
| private var currentPageButton = DialogPaginationBaseAction.CURRENT.actionButton( | ||
| currentPage, maxPages, paginationButtonWidth | ||
| ) | ||
|
|
||
| private var nextButton = DialogPaginationBaseAction.NEXT.actionButton( | ||
| currentPage, maxPages, paginationButtonWidth | ||
| ) | ||
|
|
||
| private var lastPageButton = DialogPaginationBaseAction.LAST.actionButton( |
There was a problem hiding this comment.
These buttons are initialized with currentPage and maxPages values that will be stale. When currentPage changes or elements are added/removed, these buttons will still display outdated page information since they're not regenerated.
| private var firstPageButton = DialogPaginationBaseAction.FIRST.actionButton( | |
| currentPage, maxPages, paginationButtonWidth | |
| ) | |
| private var backButton = DialogPaginationBaseAction.BACK.actionButton( | |
| currentPage, maxPages, paginationButtonWidth | |
| ) | |
| private var currentPageButton = DialogPaginationBaseAction.CURRENT.actionButton( | |
| currentPage, maxPages, paginationButtonWidth | |
| ) | |
| private var nextButton = DialogPaginationBaseAction.NEXT.actionButton( | |
| currentPage, maxPages, paginationButtonWidth | |
| ) | |
| private var lastPageButton = DialogPaginationBaseAction.LAST.actionButton( | |
| private val firstPageButton get() = DialogPaginationBaseAction.FIRST.actionButton( | |
| currentPage, maxPages, paginationButtonWidth | |
| ) | |
| private val backButton get() = DialogPaginationBaseAction.BACK.actionButton( | |
| currentPage, maxPages, paginationButtonWidth | |
| ) | |
| private val currentPageButton get() = DialogPaginationBaseAction.CURRENT.actionButton( | |
| currentPage, maxPages, paginationButtonWidth | |
| ) | |
| private val nextButton get() = DialogPaginationBaseAction.NEXT.actionButton( | |
| currentPage, maxPages, paginationButtonWidth | |
| ) | |
| private val lastPageButton get() = DialogPaginationBaseAction.LAST.actionButton( |
No description provided.