Skip to content

CommandTree#override not working on 1.21.5 #640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ShaneBeee opened this issue Apr 12, 2025 · 3 comments
Closed

CommandTree#override not working on 1.21.5 #640

ShaneBeee opened this issue Apr 12, 2025 · 3 comments
Labels
bug Something isn't working implemented for next release This has been implemented in the current dev build for the next public release

Comments

@ShaneBeee
Copy link

ShaneBeee commented Apr 12, 2025

CommandAPI version

10.0.0

Minecraft version

1.21.5 (Paper)

Are you shading the CommandAPI?

Yes

What I did

I create a gamerule command tree, with subcommands for worlds.
Its a bit of a bigger command than this, but here is the registration part:

private void registerCommand() {
    CommandTree command = new CommandTree("gamerule");
    StringArgument worldArg = createWorldArg();
    for (@NotNull GameRule<?> value : GameRule.values()) {
        if (value.getType() == Boolean.class) {
            worldArg.then(createBooleanArg(value.getName()));
        } else if (value.getType() == Integer.class) {
            worldArg.then(createIntegerArg(value.getName()));
        }
    }

    command.then(worldArg);
    command.override();
}

(here is more of the code if you think it would be helpful https://github.com/ShaneBeee/CorePlugin/blob/master/src/main/java/com/shanebeestudios/core/plugin/command/GameruleCommand.java)

What actually happened

The command does not appear to override the vanilla Minecraft /gamerule command
In 1.21.4 it works as expected (this was CommandAPI 9.7.0):
Image

In 1.21.5 it does not appear to override the vanilla command (with CommandAPI 10.0.0):
Image

It appears to merge the vanilla and custom commands together:
As you can see here, if I start typing out "w" it offers both my worlds and the vanilla game rules.
Image

What should have happened

This should, as previous versions, completely wipe out the vanilla command.

Server logs and CommandAPI config

Nothing really to add here. I have shaded CommandAPI into my project.

Other

No response

@ShaneBeee ShaneBeee added the bug Something isn't working label Apr 12, 2025
@DerEchtePilz DerEchtePilz added the implemented for next release This has been implemented in the current dev build for the next public release label Apr 12, 2025
@DerEchtePilz
Copy link
Member

We know about this already, this is caused by the unregistering feature being broken.
It is, however, already fixed in the latest snapshot version which is 10.0.1-SNAPSHOT. Instructions on how to get snapshot builds are in the discord, see the pins in the #snapshots channel.

@ShaneBeee
Copy link
Author

ShaneBeee commented Apr 12, 2025

Thank you very much, I'll give that a whirl.
Update: Tested snapshot, works like a charm 👍🏻

@JorelAli
Copy link
Member

JorelAli commented May 6, 2025

Fixed in 10.0.1.

@JorelAli JorelAli closed this as completed May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working implemented for next release This has been implemented in the current dev build for the next public release
Projects
None yet
Development

No branches or pull requests

3 participants