Skip to content

Add pagination to /hs inv (currently limited to 9 players) #39

Description

@Th0rgal

Problem

The /hs inv command creates a 9-slot inventory (single row), which can only display up to 9 players. Servers with more online players cannot see all entries. There is no pagination, no next/previous page buttons.

Root cause: CommandsManager.java line 147:

Inventory inv = Bukkit.createInventory(new HackedHolder(player), 9, "HackedServer");

All players are added via inv.addItem(head) in a loop with no bounds checking — players beyond 9 are silently dropped.

Suggested approach

  1. Expand the inventory to a larger size (e.g., 54 slots = 6 rows) to fit more players
  2. Add pagination with navigation items:
    • Use the bottom row for navigation (previous page / next page arrows, page indicator)
    • Top 5 rows (45 slots) for player heads
    • Store the current page number in the HackedHolder object
  3. Handle click events for the navigation items in HackedPlayerListeners (currently all clicks are cancelled on line 62)

The HackedHolder class could be extended to track pagination state:

public class HackedHolder implements InventoryHolder {
    private final Player viewer;
    private int currentPage = 0;
    // ...
}

Relevant files

  • hackedserver-spigot/src/main/java/org/hackedserver/spigot/commands/CommandsManager.java (line 147)
  • hackedserver-spigot/src/main/java/org/hackedserver/spigot/HackedHolder.java
  • hackedserver-spigot/src/main/java/org/hackedserver/spigot/listeners/HackedPlayerListeners.java (line 62)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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