Skip to content

Add 26.1-compatible ItemInput handling for Bukkit ItemStack parsing#143

Merged
jpenilla merged 2 commits intomasterfrom
copilot/fix-261-cloud-command-errors
Mar 8, 2026
Merged

Add 26.1-compatible ItemInput handling for Bukkit ItemStack parsing#143
jpenilla merged 2 commits intomasterfrom
copilot/fix-261-cloud-command-errors

Conversation

Copy link
Contributor

Copilot AI commented Mar 8, 2026

Minecraft 26.1 removed the checkSize boolean from ItemInput#createItemStack, which breaks the current Bukkit ItemStackParser reflection path. This change updates the parser to handle the new signature while simplifying the public ProtoItemStack API to always enforce stack-size validation.

  • Bukkit ItemInput compatibility

    • Update reflective lookup in ItemStackParser to support:
      • legacy createItemStack(int, boolean) / obfuscated equivalent
      • new createItemStack(int)
    • When running against older server versions, continue invoking the legacy signature with size checks enabled.
  • ProtoItemStack API cleanup

    • Remove the respectMaximumStackSize flag from ProtoItemStack#createItemStack.
    • Standardize behavior so stack-size limits are always respected.
  • Legacy fallback behavior

    • Update the non-NMS LegacyProtoItemStack implementation to always reject stack sizes above the material max, matching the new API contract.
  • Example updates

    • Adjust example Bukkit usages to the new one-argument createItemStack(int) API.
final ItemStack stack = proto.createItemStack(amount);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-20a94bbfef510b4f/dbs/java/working/files-to-index2435302225019657682.list --sourceArchiveDir=/tmp/codeql-scratch-20a94bbfef510b4f/dbs/java/src --outputDir=/tmp/codeql-scratch-20a94bbfef510b4f/dbs/java/trap/java (dns block)
  • libraries.minecraft.net
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xmx1G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)
  • repo.papermc.io
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xmx1G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>26.1 support</issue_title>
<issue_description>Hello, I was just trying out if my plugins work with 26.1 (snapshot 11) and noticed that there were errors with the Cloud command framework.

The error is: "Couldn't find createItemStack method on ItemInput" caused by this method.

The new signature seems to be ItemStack createItemStack(final int count), so without the boolean. I cloned the cloud-minecraft repo locally and removed the second boolean argument and it worked.

I would open a PR, but I'm not too familiar with the code base at all to implement a proper fix. Maybe it's even still too early for fix (maybe there is a missing paper patch that adds that second boolean or something).</issue_description>

<agent_instructions>The boolean parameter (checkSize) is gone and size is always checked. It's unlikely anyone really needs to ignore size checks, so we can remove the api for this and fallback to always pass true on old versions. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: jpenilla <11360596+jpenilla@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix errors with Cloud command framework for 26.1 support Add 26.1-compatible ItemInput handling for Bukkit ItemStack parsing Mar 8, 2026
@jpenilla jpenilla marked this pull request as ready for review March 8, 2026 00:54
@jpenilla jpenilla mentioned this pull request Mar 8, 2026
@jpenilla jpenilla merged commit aaa49cb into master Mar 8, 2026
2 of 3 checks passed
@jpenilla jpenilla deleted the copilot/fix-261-cloud-command-errors branch March 8, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

26.1 support

2 participants