Skip to content

/sf categories throws error when there are more than 54 categories #49

@ybw0014

Description

@ybw0014

Description (Required)

The command /sf categories will throw an error if there are more than 54 categories. This happens on servers with a lot of addons installed.

Steps to reproduce the Issue (Required)

Run /sf categories when there are more than 54 categories.

Expected behavior (Required)

Add pagination to avoid the error.

Server Log / Error Report

Forwarded from fork SlimefunGuguProject#10,
but i believe this will also happen due to the codes:

SCMenu menu = new SCMenu("&6Category Namespace Guide");
menu.setSize(54);
int slot = 0;
for (ItemGroup group : Slimefun.getRegistry().getAllItemGroups()) {
ItemStack catItem = group.getItem(p).clone();
ItemMeta catMeta = catItem.getItemMeta();
List<String> catLore = catMeta.getLore();
catLore.set(catLore.size() - 1, Utils.color(
"&6ID: " + group.getKey().getNamespace() + ":" + group.getKey().getKey())
); // Replaces the "Click to Open" line
catMeta.setLore(catLore);
catItem.setItemMeta(catMeta);
menu.replaceExistingItem(slot, catItem);
menu.addMenuClickHandler(slot, ChestMenuUtils.getEmptyClickHandler());
slot++;
}
menu.setPlayerInventoryClickable(false);
menu.setBackgroundNonClickable(true);
menu.open(p);

Config Files

N/A

Environment (Required)

  • Minecraft Version:
  • CS-CoreLib Version:
  • Slimefun Version:
  • Plugin Version:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions