Skip to content

Let players pick any item as a home icon, not only the one they are holding #45

Description

@milanmalhotra

Problem

After a home exists, the only way to change its icon is the management menu's Set icon to held item, which reads player.getInventory().getItemInMainHand() (HomeActionsGui, ACTION_ICON). If the player does not own the item they want, or is in creative and would rather not fetch it, they are stuck. /sethome <name> <icon> accepts any material name at creation time, so the two paths are inconsistent: any item is fine on the way in, but afterwards you must physically hold it.

Proposed

Two additions, both keeping the current held-item button as the fast path:

  1. A command form: /set-home-icon <home> <material> (or an icon sub-form of an existing command, decide during design), with the same material validation create-home applies (Material.matchMaterial, must be isItem()), and tab completion of materials through the shared TabCompletions helper.
  2. An item picker in the management menu: a paginated GUI of items, opened from a second button next to Set icon to held item, that sets the icon on click. Search or filtering by typing is out of scope for a first pass; pages plus the existing prefix and substring tab completion on the command cover the "I know the name" case.

If only one is done first, do the command; the GUI picker can follow.

Design questions

  • Which item set does the picker show: every Material.isItem(), or a curated list (blocks first, then tools, then misc)? Every item is over 1300 entries, which is 30 pages of 45; that is usable with tab completion on the command but heavy in a GUI.
  • Should the picker reuse HomesGui's pagination or share a generic paged-inventory base? Worth extracting if it is the second consumer.
  • Config keys for the new button (item and name), following the existing setIconButtonItem / setIconButtonName pattern.

Acceptance criteria

  • A player can set any valid item as a home icon without holding it, by command.
  • Invalid or non-item materials are rejected with the existing invalidHomeItem message.
  • Tab completion offers materials via TabCompletions.matching.
  • Permission is sh2.manage-homes (no new node) unless design decides otherwise; admins acting on another player's home are out of scope.
  • Set icon to held item keeps working unchanged.
  • MockBukkit tests for the command path; the GUI picker, if built, tests its click handling like HomeActionsGui.
  • README Managing homes table gains the new action.

Notes

Related to #37 (default icon variants), which is about the icon chosen when the player picks none; this issue is about choosing one deliberately after the fact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions