40 lines
1.4 KiB
Java
40 lines
1.4 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.brigadier.StringReader
|
|
* com.mojang.brigadier.arguments.ArgumentType
|
|
* com.mojang.brigadier.context.CommandContext
|
|
* com.mojang.brigadier.exceptions.CommandSyntaxException
|
|
* com.mojang.brigadier.suggestion.Suggestions
|
|
* com.mojang.brigadier.suggestion.SuggestionsBuilder
|
|
*/
|
|
package net.minecraft.util.parsing.packrat.commands;
|
|
|
|
import com.mojang.brigadier.StringReader;
|
|
import com.mojang.brigadier.arguments.ArgumentType;
|
|
import com.mojang.brigadier.context.CommandContext;
|
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
|
import com.mojang.brigadier.suggestion.Suggestions;
|
|
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import net.minecraft.util.parsing.packrat.commands.CommandArgumentParser;
|
|
|
|
public abstract class ParserBasedArgument<T>
|
|
implements ArgumentType<T> {
|
|
private final CommandArgumentParser<T> parser;
|
|
|
|
public ParserBasedArgument(CommandArgumentParser<T> parser) {
|
|
this.parser = parser;
|
|
}
|
|
|
|
public T parse(StringReader reader) throws CommandSyntaxException {
|
|
return this.parser.parseForCommands(reader);
|
|
}
|
|
|
|
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
|
return this.parser.parseForSuggestions(builder);
|
|
}
|
|
}
|
|
|