Skip to content

Fix and enhance openInventory(InventoryView)#11455

Closed
masmc05 wants to merge 5 commits into
PaperMC:masterfrom
masmc05:add-default-title-override
Closed

Fix and enhance openInventory(InventoryView)#11455
masmc05 wants to merge 5 commits into
PaperMC:masterfrom
masmc05:add-default-title-override

Conversation

@masmc05
Copy link
Copy Markdown
Contributor

@masmc05 masmc05 commented Sep 30, 2024

The new method allows overriding the title on the menu which is being opened without the necessity to listen to InventoryOpenEvent and setting InventoryOpenEvent#titleOverride(Component)

When creating this new api discovered an issue with the current method which has a very small fix, the issue being that currently when running

    @EventHandler
    public void onInventoryOpen(org.bukkit.event.inventory.InventoryOpenEvent event) {
        if (event.getInventory() instanceof HorseInventory) {
            event.getPlayer().getScheduler().runDelayed(this, task -> {
                event.getPlayer().openInventory(event.getPlayer().getOpenInventory());
            }, () -> {}, 40L);
        }
    }

You will get this error https://pastes.dev/yAFvj1yF6I

Should I instead of current behavior, pass the title override as the default value of InventoryOpenEvent#titleOverride?

@masmc05 masmc05 requested a review from a team as a code owner September 30, 2024 21:44
@Machine-Maker
Copy link
Copy Markdown
Member

You can already create views with any title via the MenuType API. Is there a point to adding this with the MenuType API already in?

@masmc05
Copy link
Copy Markdown
Contributor Author

masmc05 commented Oct 1, 2024

For current opened view, this method goes trough the proper whole open inventory process without closing it, maintaining the most similar state to the pre open state

@masmc05
Copy link
Copy Markdown
Contributor Author

masmc05 commented Nov 24, 2024

Rebased on 1.21.3

@Warriorrrr Warriorrrr moved this from Awaiting review to Waiting For Author in Paper PR Queue Mar 5, 2025
@kennytv kennytv added the pre-softspoon: never rebased Pre-hardfork pull requests that were not re-opened with the new main branch label Mar 23, 2025
@kennytv kennytv deleted the branch PaperMC:master March 23, 2025 19:16
@kennytv kennytv closed this Mar 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pre-softspoon: never rebased Pre-hardfork pull requests that were not re-opened with the new main branch pre-softspoon

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants