Skip to content

/help: withFullDescription duplicates usage with entries after unregistering and re-registering command #685

@objz

Description

@objz

CommandAPI version

11.1.0

Minecraft version

1.21.11

Are you shading the CommandAPI?

No

What I did

public final class Plugin extends JavaPlugin {

	@Override
	public void onEnable() {
		new CommandAPICommand("register")
				.executes((sender, args) -> {
					registerCmd();
				})
				.register();

		new CommandAPICommand("unregister")
				.executes((sender, args) -> {
					CommandAPI.unregister("testcmd123");
				})
				.register();
	}

    private void registerCmd() {
        new CommandAPICommand("testcmd123")
            .withFullDescription("this is a simple full demo description")
            .executes((sender, args) -> {
                getLogger().info("testcmd123 executed!");
            })
            .register();
    }

	@Override
	public void onDisable() {
	}
}

Using this sample plugin, I performed the following steps:

  • started the server

  • ran the command /register
  • ran the command /help testcmd123
  • ran the command /unregister

  • ran the command /register
  • ran the command /help testcmd123
  • ran the command /unregister

I repeated these steps several times.

What actually happened

The command usage starts duplicating the usage lines based on how many times I repeat this.

This was after the first register + /help:

Image

After the second register (after unregister), it looked like this:

Image

After the third iteration, it looked like this:

Image

This does not happen with withShortDescription, only with withFullDescription.

What should have happened

Well, it shouldn’t do that. It should not append the list, and it should look like this even after N times:

Image

Server logs and CommandAPI config

No response

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions