@Arg @Quoted String
If you want to parse an argument with quoted content including spaces and special characters, use the @Quoted
annotation.
java
@Command(name = "mute")
public class MuteCommand {
@Execute
void mute(
@Context CommandSender sender,
@Arg Player target,
@Arg @Quoted String reason
) {
// [...] mute implementation
sender.message(ChatUtil.color("&cPlayer &7" + target.getName() + " &chas been muted! Reason: &7" + reason));
}
}
Here is an example of the /mute
command usage:
/mute <player> <reason...>
Input
/mute Rollczi "Spamming and harassment"Output
Player Rollczi has been muted! Reason: Spamming and harassment