forked from chipmunkmc/chipmunkbot
fix the chip mc moment
i should have been less lazy and tested it but yes
This commit is contained in:
parent
b5d3747410
commit
4260e3853f
1 changed files with 37 additions and 0 deletions
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue