Skip to content

Hey there! If you like my work, you can support me by sponsoring me on GitHub. Thanks! ❤

Sponsor me
on GitHub

@Join

To concatenate multiple arguments into a single string, use the @Join annotation.

java
@Command(name = "ban")
public class BanCommand {
    @Execute
    void ban(@Arg Player target, @Join String reason) {
        // Command implementation
    }
}

Let's consider the following command usage:

/ban <player> <reason...>
Input
/ban JohnDoe Offensive language and behavior
target
JohnDoe
reason
Offensive language and behavior

Additional Options

Sometimes you may want to limit the number of arguments that will be joined.

java
@Join(limit = 2)

Or you may want to join arguments with a different separator.

java
@Join(separator = ", ")

Or both:

java
@Command(name = "ban")
public class BanCommand {
    @Execute
    public void ban(
        @Arg Player target,
        @Join(limit = 10, separator = "-") String reason
    ) {
        // Command implementation
    }
}

Now, our result will be:

/ban <player> <reason...>
Input
/ban JohnDoe Offensive language and behavior
target
JohnDoe
reason
Offensive-language-and-behavior

Made by LiteDevelopers and Contributors with ❤️