Skip to content

Footer is always longer than header with Pagination #3

@501warhead

Description

@501warhead

This may be a mistake on my end, attempting to integrate this API with my recent works and having some difficulty with pagination. No matter what I attempt to do, the footer is always slightly longer than the header. I've attempted at this point any number of fixes and tried digging for some potential solutions.

I do know this is still a very new feature, so I figured I'd at least provide a bug report for my findings to see if it helps

Version: 3.0.2

Using text-serializer-gson,text-feature-pagination, and text-api with text-bukkit-adapter

Platform is Paper

Width: 53
image

Width: 50
image

With longer title, width 50
image

Width 50 with dummy data to cause pagination
image

smol title
image

Code (In Kotlin) ((An abomination of formatting, I apologize in advance))

return Pagination.builder().line { cs ->
            cs.character('=')
        }.width(53).build(TextComponent.of("Charters").color(TextColor.GOLD), Pagination.Renderer.RowRenderer { value, index ->
            return@RowRenderer listOf(if (value == null) TextComponent.of("${index + 1}. ").color(TextColor.YELLOW).content("ERR?").color(TextColor.RED) else
                TextComponent.of("${index + 1}. ")
                        .color(TextColor.YELLOW)
                        .append(TextComponent.of(value.name).color(TextColor.GRAY))
                        .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to view this charter").color(TextColor.GRAY)))
                        .clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/charter info ${value.name}")))
        }, Pagination.PageCommandFunction { page -> "/charter list -page $page" })
        val rendered = settlementService.buildSettlementPagination().render(settlementService.dummyData().sortedBy { settlement -> settlement.name }, page)
        rendered.forEach { comp ->
            TextAdapter.sendComponent(p, comp)
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions