2022-01-01 18:27:52 +01:00
|
|
|
package net.minestom.demo.commands;
|
2020-07-14 13:35:07 +02:00
|
|
|
|
2021-03-04 14:41:41 +01:00
|
|
|
import net.kyori.adventure.text.Component;
|
2020-07-14 13:35:07 +02:00
|
|
|
import net.minestom.server.command.CommandSender;
|
|
|
|
import net.minestom.server.command.builder.Command;
|
2021-03-11 00:11:29 +01:00
|
|
|
import net.minestom.server.command.builder.CommandContext;
|
2021-05-31 00:00:23 +02:00
|
|
|
import net.minestom.server.command.builder.arguments.ArgumentType;
|
2020-07-14 13:35:07 +02:00
|
|
|
|
|
|
|
public class TestCommand extends Command {
|
|
|
|
|
|
|
|
public TestCommand() {
|
2020-08-04 06:14:42 +02:00
|
|
|
super("testcmd");
|
2020-07-14 13:35:07 +02:00
|
|
|
setDefaultExecutor(this::usage);
|
|
|
|
|
2021-05-31 00:00:23 +02:00
|
|
|
var block = ArgumentType.BlockState("block");
|
|
|
|
block.setCallback((sender, exception) -> exception.printStackTrace());
|
|
|
|
|
|
|
|
addSyntax((sender, context) -> System.out.println("executed"), block);
|
2020-07-14 13:35:07 +02:00
|
|
|
}
|
|
|
|
|
2021-03-11 00:11:29 +01:00
|
|
|
private void usage(CommandSender sender, CommandContext context) {
|
2021-03-04 14:41:41 +01:00
|
|
|
sender.sendMessage(Component.text("Incorrect usage"));
|
2020-07-14 13:35:07 +02:00
|
|
|
}
|
2021-03-10 19:14:24 +01:00
|
|
|
|
2020-07-14 13:35:07 +02:00
|
|
|
}
|