fix the chip mc moment

i should have been less lazy and tested it but yes
This commit is contained in:
Chipmunk 2023-01-19 18:48:13 -05:00
parent b5d3747410
commit 4260e3853f

View file

@ -0,0 +1,37 @@
package land.chipmunk.chipmunkbot.commands;
import land.chipmunk.chipmunkbot.ChipmunkBot;
import land.chipmunk.chipmunkbot.command.*;
import static land.chipmunk.chipmunkbot.plugins.CommandManager.literal;
import static land.chipmunk.chipmunkbot.plugins.CommandManager.argument;
import static com.mojang.brigadier.arguments.StringArgumentType.greedyString;
import static com.mojang.brigadier.arguments.StringArgumentType.getString;
import com.mojang.brigadier.context.CommandContext;
import net.kyori.adventure.text.Component;
public class EchoCommand extends Command {
public EchoCommand () {
super();
this.node(
literal("echo")
.then(
argument("command", greedyString())
.executes(this::run)
argument("text", greedyString())
.executes(this::echo)
)
);
}
public int echo (CommandContext<CommandSource> context) {
final CommandSource source = context.getSource();
final ChipmunkBot client = source.client();
client.core().run(getString(context, "command"));
final String text = getString(context, "command");
source.sendOutput(Component.text(text));
return 1;
}
}