Skip to content
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

Command cannot be registered #173

Open
Xefreh opened this issue Nov 21, 2024 · 3 comments
Open

Command cannot be registered #173

Xefreh opened this issue Nov 21, 2024 · 3 comments

Comments

@Xefreh
Copy link

Xefreh commented Nov 21, 2024

I copied the code on the documentation to create a simple command:

package org.example.template;

import io.fairyproject.command.BaseCommand;
import io.fairyproject.command.CommandContext;
import io.fairyproject.command.MessageType;
import io.fairyproject.command.annotation.Arg;
import io.fairyproject.command.annotation.Command;
import io.fairyproject.command.argument.ArgProperty;
import io.fairyproject.container.InjectableComponent;

@InjectableComponent
@Command(value = "testfairy", permissionNode = "fairy.test")
public class TestCommand extends BaseCommand {

    @Arg("name")
    private ArgProperty<String> name;

    @Command("#")
    public void onNoSubCommand(CommandContext sctx) {
        sctx.sendMessage(MessageType.INFO, String.format("Halo %s!", sctx.getProperty(name)));
    }

}

but I got this error:
2024-11-21.log

Paper version is 1.8.8

@Xefreh
Copy link
Author

Xefreh commented Nov 21, 2024

I tried to set @CommandPresence(DefaultPresenceProvider.class) but I end up having a NPE.
2024-11-21-6.log

@Xefreh
Copy link
Author

Xefreh commented Nov 21, 2024

ok so putting Args as a field doesn't work but using the annotation "Arg" works on the method parameters.

@Xefreh
Copy link
Author

Xefreh commented Dec 10, 2024

any updates ?

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

No branches or pull requests

1 participant