recommend player names
This commit is contained in:
parent
49130736df
commit
b3e5a3fe4d
1 changed files with 12 additions and 2 deletions
|
@ -1,17 +1,24 @@
|
||||||
package net.saltymc.eaa.commands;
|
package net.saltymc.eaa.commands;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.mojang.brigadier.StringReader;
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import com.mojang.brigadier.suggestion.Suggestions;
|
||||||
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
||||||
import net.minecraft.client.toast.SystemToast;
|
import net.minecraft.client.toast.SystemToast;
|
||||||
|
import net.minecraft.command.CommandSource;
|
||||||
|
import net.minecraft.command.EntitySelectorReader;
|
||||||
import net.minecraft.command.argument.EntityArgumentType;
|
import net.minecraft.command.argument.EntityArgumentType;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.argument;
|
import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.argument;
|
||||||
import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal;
|
import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal;
|
||||||
|
|
||||||
|
@ -25,14 +32,17 @@ public class TagCommand extends EaaModCommand{
|
||||||
|
|
||||||
SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.TUTORIAL_HINT, Text.of(tag), Text.of(player));
|
SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.TUTORIAL_HINT, Text.of(tag), Text.of(player));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LiteralArgumentBuilder<FabricClientCommandSource> getCommandSpecification() {
|
public LiteralArgumentBuilder<FabricClientCommandSource> getCommandSpecification() {
|
||||||
return literal("/tag").then(
|
return literal("/tag").then(
|
||||||
argument("player", EntityArgumentType.player())
|
argument("player", StringArgumentType.word())
|
||||||
.then(argument("tag", StringArgumentType.word())
|
.suggests((ctx, builder) -> EntityArgumentType.player().listSuggestions(ctx, builder))
|
||||||
|
.then(argument("tag", StringArgumentType.word())
|
||||||
.executes(this)
|
.executes(this)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue