Skip to content

Nested subcommands and exception handling do not work on Bukkit/Velocity (others not tested) #139

Description

@imJack6

I used Kotlin/Java to write it, but it didn’t work (is there something wrong with my operation or project configuration?)

The code here is for Bukkit, and the same is true for Velocity.
Java:

    @Override
    public void onEnable() {
        Lamp<BukkitCommandActor> lamp = BukkitLamp
                .builder(this)
                .exceptionHandler(new BukkitExceptionHandler())
                .build();
        lamp.register(new MyCommand());
    }

    @Override
    public void onDisable() {
    }

    @Command("hello")
    public class MyCommand {

        @Subcommand("test1")
        public void test1() {
        }

        @Subcommand("test2")
        public static class Test2 {
            @Subcommand("test3")
            public void test3() {
            }
        }
    }

Kotlin:

    override fun onEnable() {
        val lamp = BukkitLamp
            .builder(this)
            .exceptionHandler(BukkitExceptionHandler())
            .build()
        lamp.register(MyCommand())
    }

    override fun onDisable() {
    }

    @Command("hello")
    class MyCommand {

        @Subcommand("test1")
        fun test1() {
        }

        @Subcommand("test2")
        class Test2 {
            @Subcommand("test3")
            fun test3() {
            }
        }
    }

In the end, I only got test1, but not test2 and test3.
(I checked the docs)
Image

In addition, the exception handling of unknown instructions does not work properly, including some types of exception handling (only tested onInvalidBoolean and onInvalidInteger), but onEmptyEntitySelector onSenderNotConsole, etc. can work normally.
Image

Image Image

Version:

val lampVersion = "4.0.0-rc.12"
dependencies {
    // ...
    implementation("io.github.revxrsal:lamp.common:$lampVersion")
    implementation("io.github.revxrsal:lamp.bukkit:$lampVersion")
    implementation("io.github.revxrsal:lamp.brigadier:$lampVersion")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions