Open
Description
Is there an existing issue for this?
- I have searched the existing issues
π Describe the bug
Hello I have an Kotlin extension function looking like this:
@JvmStatic
fun RenderContext.pagination(state: State<Pagination>, fallBack: ViewItems = ViewItems.MENU_PLACEHOLDER) {
"NP".forEach { layoutSlot(it, fallBack.get()) }
layoutSlot('N', ViewItems.NEXT_PAGE.get()).displayIf { c -> state.get(c).canAdvance() }
.updateOnStateChange(state)
.onClick { context ->
val pagination = state.get(context)
pagination.advance()
CustomSounds.MENU_CLICK.playSound(this.player)
}
layoutSlot('P').displayIf { c -> state.get(c).canBack() }
.updateOnStateChange(state)
.onClick { context ->
val pagination = state.get(context)
pagination.back()
CustomSounds.MENU_CLICK.playSound(this.player)
}
}
It adds next and Previous buttons to a layout, my issue is here that they are always added, no matter of there is just 1 or 50 Items in the Pennington.
This Problem only exists with all computedPagintons
βοΈ Expected behavior
Well, that the items are not displayed if there is no next or previous site.
π£ Steps to Reproduce
No response
π» Platform
- Bukkit
- Sponge
- Other
β Server Version
Paper version 1.21.1-122-master@4430e96 (2024-10-12T21:18:42Z) (Implementing API version 1.21.1-R0.1-SNAPSHOT)
π Library Version
3.0.11
βοΈ Additional context
No response