Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cloud-core/src/main/java/org/incendo/cloud/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,27 @@ private Builder(
);
}

/**
* Adds command meta with no value to the internal command meta-map
*
* @param key meta key
* @return new builder instance using the inserted meta key
*/
@API(status = API.Status.STABLE)
public @NonNull Builder<C> meta(final @NonNull CloudKey<Void> key) {
final CommandMeta commandMeta = CommandMeta.builder().with(this.commandMeta).with(key).build();
return new Builder<>(
this.commandManager,
commandMeta,
this.senderType,
this.commandComponents,
this.commandExecutionHandler,
this.permission,
this.flags,
this.commandDescription
);
}

/**
* Supplies a command manager instance to the builder.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ public class CommandMetaBuilder {
return this;
}

/**
* Stores the given {@code key} with no value.
*
* @param key the key
* @return {@code this}
*/
public @This @NonNull CommandMetaBuilder with(
final @NonNull CloudKey<Void> key
) {
this.map.put(key, new Object());
return this;
}

/**
* Builds a new {@link CommandMeta} instance using the stored {@code key}-{@code value} pairs.
*
Expand Down