Skip to content

Brigadier completion is broken on Minecraft 1.13.2 #387

@0dinD

Description

@0dinD

Preconditions:

  • Use cloud-bukkit or cloud-paper on Minecraft 1.13.2, with commodore
  • Call BukkitCommandManager#registerBrigadier()
  • Begin typing a command that will trigger completions (in my case, it was an org.bukkit.World argument)

When the completions are to be shown, the client gets disconnected with the following message:

image

And indeed, that method does not exist on Minecraft 1.13.2, which uses Brigadier 1.0.14 as per https://launchermeta.mojang.com/v1/packages/1f439c21fee6a7816356c40a6194d064d1f44baa/1.13.2.json.

Or well, it does exist, but the return type is different, which is the cause of this issue. It was changed here: Mojang/brigadier@107b852#diff-18472a62b649fb2b670a39478656c3a7f56e5457db300b7dc1a8fdac11e13c55R122-R130

That change made it into Brigadier 1.0.17, which is used on Minecraft 1.14.4+ as per https://launchermeta.mojang.com/v1/packages/8f81523cd2c2fdaf9c37431fceb0a446dbe71ed5/1.14.4.json.

This issue has not always been present, usage of the CommandContext#getNodes() method was introduced in cloud-brigadier here: f16cafd#diff-a1afbb0e9ce645c8eb5bcfc7801fb95495ecff3231bfd7a725ded1f51fde39adR632-R634


These are some possible resolutions to the issue that come to my mind:

  1. Drop the usage of the CommandContext#getNodes() method.
  2. Use reflection or similar to support Brigadier 1.0.14. It looks like getNodes() returns essentially the same information on both versions, it's just the return type that changed.
  3. Drop support for 1.13, and make sure that CommandManager#hasCapability(CloudBukkitCapabilities.BRIGADIER) returns false on Minecraft 1.13.

I don't know enough about the code to know which solution makes the most sense. Plugin authors can also work around the issue by checking the Minecraft version and skipping the brigadier registration on 1.13.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions