com.mojang.brigadier.builder.ArgumentBuilder Java Examples

The following examples show how to use com.mojang.brigadier.builder.ArgumentBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdvancementCommand.java    From multiconnect with MIT License 6 votes vote down vote up
private static ArgumentBuilder<CommandSource, ?> tail() {
    return argument("player", players())
            .then(literal("only")
                .then(argument("advancement", identifier())
                    .suggests(ADVANCEMENT_SUGGESTOR)
                    .executes(ctx -> 0)
                    .then(argument("criteria", word())
                        .suggests(CRITERIA_SUGGESTOR)
                        .executes(ctx -> 0))))
            .then(literal("until")
                .then(argument("advancement", identifier())
                    .suggests(ADVANCEMENT_SUGGESTOR)
                    .executes(ctx -> 0)))
            .then(literal("from")
                .then(argument("advancement", identifier())
                    .suggests(ADVANCEMENT_SUGGESTOR)
                    .executes(ctx -> 0)))
            .then(literal("through")
                .then(argument("advancement", identifier())
                    .suggests(ADVANCEMENT_SUGGESTOR)
                    .executes(ctx -> 0)))
            .then(literal("everything")
                .executes(ctx -> 0));
}
 
Example #2
Source File: ReplaceItemCommand.java    From multiconnect with MIT License 5 votes vote down vote up
private static ArgumentBuilder<CommandSource, ?> tail() {
    return argument("slot", itemSlot())
            .then(argument("item", item())
                .executes(ctx -> 0)
                .then(argument("count", integer(1, 64))
                    .executes(ctx -> 0)
                    .then(argument("damage", integer(0, Short.MAX_VALUE))
                        .executes(ctx -> 0)
                        .then(argument("nbt", nbtCompound())
                            .executes(ctx -> 0)))));
}
 
Example #3
Source File: StatsCommand.java    From multiconnect with MIT License 5 votes vote down vote up
private static ArgumentBuilder<CommandSource, ?> set() {
    return literal("set")
            .then(argument("stat", statsType())
                .then(argument("selector", entities())
                    .then(argument("objective", word())
                        .suggests(SuggestionProviders.ASK_SERVER)
                        .executes(ctx -> 0))));
}
 
Example #4
Source File: ScoreboardCommand.java    From multiconnect with MIT License 5 votes vote down vote up
private static CommandNode<CommandSource> addPlayerList(ArgumentBuilder<CommandSource, ?> parentBuilder) {
    CommandNode<CommandSource> parent = parentBuilder.executes(ctx -> 0).build();
    CommandNode<CommandSource> child = argument("player", entities())
            .executes(ctx -> 0)
            .redirect(parent)
            .build();
    parent.addChild(child);
    return parent;
}
 
Example #5
Source File: AvailableCommands.java    From Velocity with MIT License 5 votes vote down vote up
private WireNode(int idx, byte flags, int[] children, int redirectTo,
    @Nullable ArgumentBuilder<Object, ?> args) {
  this.idx = idx;
  this.flags = flags;
  this.children = children;
  this.redirectTo = redirectTo;
  this.args = args;
}
 
Example #6
Source File: StatsCommand.java    From multiconnect with MIT License 4 votes vote down vote up
private static ArgumentBuilder<CommandSource, ?> clear() {
    return literal("clear")
            .then(argument("stat", statsType())
                .executes(ctx -> 0));
}
 
Example #7
Source File: Nodes.java    From Chimera with MIT License 4 votes vote down vote up
public B optionally(ArgumentBuilder<T, ?> builder) {
    return optionally(builder.build());
}
 
Example #8
Source File: RootCommandNode.java    From brigadier with MIT License 4 votes vote down vote up
@Override
public ArgumentBuilder<S, ?> createBuilder() {
    throw new IllegalStateException("Cannot convert root into a builder");
}
 
Example #9
Source File: CommandNode.java    From brigadier with MIT License votes vote down vote up
public abstract ArgumentBuilder<S, ?> createBuilder();