Skip to content

Commit

Permalink
Merge branch '2.0.0-dev' into feat/2.0.0/immutable-component
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla authored Jan 13, 2024
2 parents e35fa33 + 33443a6 commit a20dcb3
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -964,10 +964,6 @@ private <T> void parseParsers(final @NonNull T instance) {
} catch (final Exception e) {
throw new RuntimeException("Failed to construct command execution handler", e);
}
/* Check if the command should be hidden */
if (methodOrClassHasAnnotation(method, Hidden.class)) {
builder = builder.hidden();
}
/* Apply flags */
for (final CommandFlag<?> flag : flags) {
builder = builder.flag(flag);
Expand Down Expand Up @@ -1016,12 +1012,9 @@ private <T> void parseParsers(final @NonNull T instance) {
if (proxy.contains(" ")) {
throw new IllegalArgumentException("@ProxiedBy proxies may only contain single literals");
}
cloud.commandframework.Command.Builder<C> proxyBuilder = this.manager.commandBuilder(proxy, command.commandMeta())
.proxies(command);
if (proxyAnnotation.hidden()) {
proxyBuilder = proxyBuilder.hidden();
}
return proxyBuilder.build();
return this.manager.commandBuilder(proxy, command.commandMeta())
.proxies(command)
.build();
}

private @NonNull SyntaxFragment findSyntaxFragment(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,4 @@
* @return Proxy syntax
*/
@NonNull String value();

/**
* Whether or not the proxying command should be {@link Hidden}
*
* @return {@code true} if the proxying command should be hidden, {@code false} if not
*/
boolean hidden() default false;
}
19 changes: 0 additions & 19 deletions cloud-core/src/main/java/cloud/commandframework/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -404,15 +404,6 @@ public final String toString() {
return build.substring(0, build.length() - 1);
}

/**
* Returns whether the command is hidden.
*
* @return {@code true} if the command is hidden, {@code false} if not
*/
public boolean isHidden() {
return this.commandMeta().getOrDefault(CommandMeta.HIDDEN, false);
}


/**
* Builder for {@link Command} instances. The builder is immutable, and each
Expand Down Expand Up @@ -2256,16 +2247,6 @@ private Builder(
return builder.handler(command.commandExecutionHandler);
}

/**
* Indicates that the command should be hidden from help menus
* and other places where commands are exposed to users.
*
* @return new builder instance that indicates that the constructed command should be hidden
*/
public @NonNull Builder<C> hidden() {
return this.meta(CommandMeta.HIDDEN, true);
}

/**
* Registers a new command flag.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
package cloud.commandframework.meta;

import cloud.commandframework.Command;
import cloud.commandframework.keys.CloudKey;
import cloud.commandframework.keys.CloudKeyContainer;
import org.apiguardian.api.API;
import org.checkerframework.checker.nullness.qual.NonNull;
Expand All @@ -38,11 +37,6 @@
@API(status = API.Status.STABLE)
public abstract class CommandMeta implements CloudKeyContainer {

public static final CloudKey<Boolean> HIDDEN = CloudKey.of(
"cloud:hidden",
Boolean.class
);

/**
* Create a new simple command meta-builder
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import cloud.commandframework.execution.CommandExecutionHandler
import cloud.commandframework.keys.CloudKey
import cloud.commandframework.kotlin.extension.command
import cloud.commandframework.kotlin.extension.senderType
import cloud.commandframework.meta.CommandMeta
import cloud.commandframework.permission.Permission
import kotlin.reflect.KClass

Expand Down Expand Up @@ -280,16 +279,6 @@ public class MutableCommandBuilder<C : Any>(
it.commandDescription(commandDescription)
}

/**
* Set the [CommandMeta.HIDDEN] meta for this command
*
* @param hidden whether this command should be hidden
* @return this mutable builder
* @since 1.3.0
*/
public fun hidden(hidden: Boolean = true): MutableCommandBuilder<C> =
meta(CommandMeta.HIDDEN, hidden)

/**
* Specify a required sender type
*
Expand Down

0 comments on commit a20dcb3

Please sign in to comment.