Skip to content

Refactor EffOpenInventory to support the newer MenuType api by paper#8384

Merged
sovdeeth merged 27 commits intoSkriptLang:dev/patchfrom
3add:master
Feb 1, 2026
Merged

Refactor EffOpenInventory to support the newer MenuType api by paper#8384
sovdeeth merged 27 commits intoSkriptLang:dev/patchfrom
3add:master

Conversation

@3add
Copy link
Copy Markdown
Contributor

@3add 3add commented Jan 17, 2026

Refactor EffOpenInventory to support the newer MenuType api by paper, included some backwards compatiblity.

Tested Versions:

  • 1.20.4 (skript didn't enable because of a different syntax element, unsupported)
  • 1.21.1 (fallback to older Bukkit api)
  • 1.21.3 (fallback to older Bukkit api)
  • 1.21.4
  • 1.21.10
  • 1.21.11

Problem

The legacy Bukkit api has been lacking functionality for a while also this class is currently a pretty big mess.

Solution

Adding support for the newer paper api introduced in 1.21.1, older versions fallback on the Bukkit api

Testing Completed

command inventory:
    trigger:

        set {_r} to random element of integers between 1 and 5

        if {_r} is 1:
            open crafting table to player
        else if {_r} is 2:
            open chest to player
        else if {_r} is 3:
            open anvil to player
        else if {_r} is 4:
            open dropper to player
        else if {_r} is 5:
            open dispenser to player
        
        send {_r} to player

Supporting Information

This fixes Anvil text input Issue and Enchanting and Anvil not working issue on 1.21.4+.

While the actual api was added in 1.21.1, it was only improved to support nullable titles in 1.21.4.


Completes: #6954 #6470
Related: Issues listed in Supporting Information
AI assistance: no ai was used

jasper added 2 commits January 17, 2026 21:52
… backwards compatiblity.

Tested Versions:
- 1.20.4 (skript didn't enable because of a different syntax element, unsupported)
- 1.21.1
- 1.21.3
- 1.21.4
- 1.21.10
- 1.21.11
… and add new description of the @SInCE added in this PR.

Refactoring EffOpenInventory to avoid a bug on 1.21.1 where creating an InventoryView with a null title is not possible (paper fixed this in 1.21.3)
@3add 3add requested a review from a team as a code owner January 17, 2026 21:52
@3add 3add requested review from Burbulinis, TheMug06 and Copilot and removed request for a team January 17, 2026 21:52
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jan 17, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the EffOpenInventory class to support Paper's newer MenuType API (introduced in 1.21.1, improved in 1.21.4) while maintaining backwards compatibility with the legacy Bukkit API. This fixes issues with anvil text input and enchanting/anvil functionality on Minecraft 1.21.4+.

Changes:

  • Adds MenuType API support with fallback to Bukkit's createInventory for older versions
  • Refactors the init and execute methods for better code organization and clarity
  • Updates documentation annotations from @example to @examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sovdeeth sovdeeth linked an issue Jan 17, 2026 that may be closed by this pull request
1 task
@sovdeeth sovdeeth changed the base branch from master to dev/patch January 17, 2026 22:15
@sovdeeth sovdeeth added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Jan 17, 2026
@github-project-automation github-project-automation bot moved this to In Review in 2.14 Releases Jan 17, 2026
@3add 3add requested a review from sovdeeth January 18, 2026 13:16
@3add 3add requested a review from sovdeeth January 18, 2026 21:58
3add and others added 4 commits January 21, 2026 22:33
@3add 3add requested a review from sovdeeth January 21, 2026 21:55
Copy link
Copy Markdown
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good

Comment on lines +32 to +39
{"close (%players%'[s] inventory [view]|[the] inventory [view] (to|of|for) %players%)", null},
{"open %inventory/inventorytype% (to|for) %players%", null},
{"open [a] (crafting table|workbench) (to|for) %players%", InventoryType.WORKBENCH},
{"open [a] chest (to|for) %players%", InventoryType.CHEST},
{"open [a[n]] anvil (to|for) %players%", InventoryType.ANVIL},
{"open [a] hopper (to|for) %players%", InventoryType.HOPPER},
{"open [a] dropper (to|for) %players%", InventoryType.DROPPER},
{"open [a] dispenser (to|for) %players%", InventoryType.DISPENSER}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might consider putting the first two patterns at the end, instead, since they are more expensive to parse than the others. optional

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh? Does the parser parse in order of me registering them?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it will try the patterns in order when attempting a syntaxinfo

Copy link
Copy Markdown
Contributor

@TheMug06 TheMug06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.14 Releases Jan 29, 2026
@sovdeeth sovdeeth merged commit e77ea62 into SkriptLang:dev/patch Feb 1, 2026
9 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.14 Releases Feb 1, 2026
@skriptlang-automation skriptlang-automation bot added completed The issue has been fully resolved and the change will be in the next Skript update. and removed needs reviews A PR that needs additional reviews labels Feb 1, 2026
@sovdeeth sovdeeth moved this from Done - Awaiting Release to Done - Released in 2.14 Releases Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update.

Projects

Status: Done - Released

Development

Successfully merging this pull request may close these issues.

anvil text input not working if anvil is open from Skript Enchant/anvil inventories don't function intended

4 participants