Skip to content

Commit

Permalink
feat(core): copy sender type requirement when proxying commands (#636)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla authored Jan 13, 2024
1 parent 69cb421 commit 00ea729
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cloud-core/src/main/java/cloud/commandframework/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -2230,12 +2230,19 @@ private Builder(
* being built. If the current command builder does not have a permission node set, this
* too will be copied.
*
* @param <N> new command sender type
* @param command the command to proxy
* @return new builder that proxies the given command
*/
public @NonNull Builder<C> proxies(final @NonNull Command<C> command) {
Builder<C> builder = this;
for (final CommandComponent<C> component : command.components()) {
@SuppressWarnings("unchecked")
public <N extends C> @NonNull Builder<N> proxies(final @NonNull Command<N> command) {
Builder<N> builder;
if (command.senderType != null) {
builder = this.senderType(command.senderType);
} else {
builder = (Builder<N>) this;
}
for (final CommandComponent<N> component : command.components()) {
if (component.type() == CommandComponent.ComponentType.LITERAL) {
continue;
}
Expand Down

0 comments on commit 00ea729

Please sign in to comment.