|
|
|
@ -21,6 +21,7 @@
|
|
|
|
|
|
|
|
|
|
package net.william278.uniform.fabric;
|
|
|
|
|
|
|
|
|
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
|
|
|
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
@ -31,8 +32,10 @@ import net.minecraft.util.Identifier;
|
|
|
|
|
import net.minecraft.util.InvalidIdentifierException;
|
|
|
|
|
import net.william278.uniform.BaseCommand;
|
|
|
|
|
import net.william278.uniform.Command;
|
|
|
|
|
import net.william278.uniform.CommandSyntax;
|
|
|
|
|
import net.william278.uniform.Uniform;
|
|
|
|
|
import net.william278.uniform.element.ArgumentElement;
|
|
|
|
|
import net.william278.uniform.element.CommandElement;
|
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -48,7 +51,8 @@ public class FabricCommand extends BaseCommand<ServerCommandSource> {
|
|
|
|
|
super(name, aliases);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public FabricCommand(@NotNull String name, @NotNull String description, @NotNull List<String> aliases) {
|
|
|
|
|
public FabricCommand(@NotNull String name, @NotNull String description,
|
|
|
|
|
@NotNull List<String> aliases) {
|
|
|
|
|
super(name, description, aliases);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -79,6 +83,28 @@ public class FabricCommand extends BaseCommand<ServerCommandSource> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@NotNull
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
public List<CommandSyntax<ServerCommandSource>> getSyntaxes() {
|
|
|
|
|
return super.getSyntaxes().stream().map(
|
|
|
|
|
syntax -> new CommandSyntax<>(
|
|
|
|
|
syntax.condition(),
|
|
|
|
|
syntax.executor(),
|
|
|
|
|
syntax.elements().stream()
|
|
|
|
|
.filter(e -> e instanceof ArgumentElement)
|
|
|
|
|
.map(e -> (ArgumentElement<?, ?>) e)
|
|
|
|
|
.map(e -> e.custom() ? new ArgumentElement<>(
|
|
|
|
|
e.name(),
|
|
|
|
|
StringArgumentType.string(),
|
|
|
|
|
e.suggestionProvider()
|
|
|
|
|
) : e)
|
|
|
|
|
.map(e -> (CommandElement<ServerCommandSource>) e)
|
|
|
|
|
.toList()
|
|
|
|
|
)
|
|
|
|
|
).toList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addSubCommand(@NotNull Command command) {
|
|
|
|
|
addSubCommand(new FabricCommand(command));
|
|
|
|
@ -88,5 +114,4 @@ public class FabricCommand extends BaseCommand<ServerCommandSource> {
|
|
|
|
|
public Uniform getUniform() {
|
|
|
|
|
return FabricUniform.INSTANCE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|