FINALLY got stuff working, lol
This commit is contained in:
parent
9aed953f22
commit
49130736df
8 changed files with 114 additions and 97 deletions
38
src/main/java/net/saltymc/eaa/commands/EchoCommand.java
Normal file
38
src/main/java/net/saltymc/eaa/commands/EchoCommand.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package net.saltymc.eaa.commands;
|
||||
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
||||
import net.minecraft.client.toast.*;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.argument;
|
||||
import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal;
|
||||
|
||||
public class EchoCommand extends EaaModCommand{
|
||||
|
||||
public int run(CommandContext<FabricClientCommandSource> context) { // throws CommandSyntaxException
|
||||
FabricClientCommandSource source = context.getSource();
|
||||
|
||||
String nachricht = StringArgumentType.getString(context,"nachricht");
|
||||
|
||||
SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.TUTORIAL_HINT, Text.of("ECHO"), Text.of(nachricht));
|
||||
|
||||
source.sendFeedback(
|
||||
new LiteralText("You said: ")
|
||||
.formatted(Formatting.RED)
|
||||
.append(new LiteralText(nachricht + ""))
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public LiteralArgumentBuilder<FabricClientCommandSource> getCommandSpecification() {
|
||||
return literal("/echo").then(
|
||||
argument("nachricht", StringArgumentType.greedyString())
|
||||
.executes(this)
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue