LiteLDev/LiteLoader.NET

Command registered with DynamicCommand.RegisterCommand is not displayed

Closed this issue · 6 comments

Operating System

Windows 10

LiteLoader version

v2.3.1-pre-1

BDS version

Version 1.19.2.02(ProtocolVersion 527)

What happened?

A command registered with DynamicCommand.RegisterCommand does not appear in the command list in the game. But it is displayed in the command list in the console and generally works in both the console and the game.

Steps to reproduce

  1. Make plugin with the command created and registered as in the ExamplePlugin (ExampleCommand)
  2. Put the plugin in the plugins folder and run the server.
  3. Join the server, and start writing the created command in the chat. It will not appear above the input line or in the list of commands (help/?).

The problem is back after commit 8c5d883

Pd233 commented

Strange bug... But it seems that have no problem with it?
image

Yes, indeed. Now made a build of the plugin with the latest LLNET version just in case, and the command is displaying now. Maybe I just forgot to make a new build that time, although the command displayed in the console after all ;/

The bug sometimes still appears.

I noticed that it always appears when I register two commands whose class names are TemplateCommand1 and TemplateCommand2 (i.e. names that differ only by one digit), but the names of the commands (in CommandAttribute) are template and templateform.

And the bug only appears if the commands are registered immediately after loading the plugin (OnInitialize). If they are registered later (for example, when handling event), then everything is OK.

UPD: Now I get this bug even when I register a command test whose class name is just TestCommand 👍

public override void OnInitialize()
{
    DynamicCommand.RegisterCommand<TestCommand>();
}
[Command("test", Description = ".NET template command", Permission = CommandPermissionLevel.Any)]
public class TestCommand : ICommand
{
    public void Execute(CommandOrigin origin, CommandOutput output)
    {
        Console.WriteLine("/test printed");
    }
}

outdate