diff --git a/api-examples/src/main/java/net/zffu/hardened/examples/api/CustomCommandExample.java b/api-examples/src/main/java/net/zffu/hardened/examples/api/CustomCommandExample.java
index 955648d..8d44797 100644
--- a/api-examples/src/main/java/net/zffu/hardened/examples/api/CustomCommandExample.java
+++ b/api-examples/src/main/java/net/zffu/hardened/examples/api/CustomCommandExample.java
@@ -6,6 +6,9 @@
import net.zffu.hardened.api.context.CommandContext;
import net.zffu.hardened.api.invoker.InvokerType;
+import java.util.Arrays;
+import java.util.List;
+
/**
* An example on how to create your own {@link net.zffu.hardened.api.commands.Command} implementation with the custom features you want.
*/
@@ -13,12 +16,16 @@
// In this example we create a invoker gated command.
public class CustomCommandExample implements Command, TypeGatedCommand {
- private String[] names = new String[]{"test"};
- private InvokerType[] allowedInvokers = new InvokerType[] {InvokerType.PLAYER}; // Only allows players to use our command, this will not matter at all if the custom validator doesn't include a check for it
+ private List allowedInvokers = Arrays.asList(new InvokerType[]{InvokerType.PLAYER}); // Only allows players to use our command, this will not matter at all if the custom validator doesn't include a check for it
+
+ @Override
+ public String getPrimaryName() {
+ return "test";
+ }
@Override
- public String[] getNames() {
- return this.names;
+ public String[] getAliases() {
+ return new String[0];
}
@Override
@@ -32,7 +39,7 @@ public void execute(CommandContext commandContext) {
}
@Override
- public InvokerType[] getAllowedInvokers() {
+ public List getAllowedInvokers() {
return this.allowedInvokers;
}
}
diff --git a/api-examples/src/main/java/net/zffu/hardened/examples/api/CustomCommandValidator.java b/api-examples/src/main/java/net/zffu/hardened/examples/api/CustomCommandValidator.java
index d2f4e40..d8e5edc 100644
--- a/api-examples/src/main/java/net/zffu/hardened/examples/api/CustomCommandValidator.java
+++ b/api-examples/src/main/java/net/zffu/hardened/examples/api/CustomCommandValidator.java
@@ -15,7 +15,7 @@ public class CustomCommandValidator implements CommandValidatorVariant of the {@link net.zffu.hardened.api.commands.Command} interface.
* This variant isn't the default one as it implements every single feature that commands can have in the Hardened for the builder.
@@ -21,7 +24,7 @@ public abstract class BuilderCommand implements Command
protected String primaryName;
- protected InvokerType[] allowedTypes;
+ protected List allowedTypes;
protected String[] aliases;
@@ -47,7 +50,7 @@ public BuilderCommandValidator getValidator() {
}
@Override
- public InvokerType[] getAllowedInvokers() {
+ public List getAllowedInvokers() {
return this.allowedTypes;
}
diff --git a/api/src/main/java/net/zffu/hardened/api/commands/builder/CommandBuilder.java b/api/src/main/java/net/zffu/hardened/api/commands/builder/CommandBuilder.java
index 1d2e17b..b0e1b6b 100644
--- a/api/src/main/java/net/zffu/hardened/api/commands/builder/CommandBuilder.java
+++ b/api/src/main/java/net/zffu/hardened/api/commands/builder/CommandBuilder.java
@@ -5,6 +5,8 @@
import net.zffu.hardened.api.context.CommandContext;
import net.zffu.hardened.api.invoker.InvokerType;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -44,7 +46,7 @@ public CommandBuilder(String primaryName, String... aliases) {
* @return
*/
public CommandBuilder allowed(InvokerType... types) {
- this.allowedTypes = types;
+ this.allowedTypes = Arrays.asList(types);
return this;
}
diff --git a/api/src/main/java/net/zffu/hardened/api/commands/types/TypeGatedCommand.java b/api/src/main/java/net/zffu/hardened/api/commands/types/TypeGatedCommand.java
index c21c851..f8abac2 100644
--- a/api/src/main/java/net/zffu/hardened/api/commands/types/TypeGatedCommand.java
+++ b/api/src/main/java/net/zffu/hardened/api/commands/types/TypeGatedCommand.java
@@ -2,6 +2,8 @@
import net.zffu.hardened.api.invoker.InvokerType;
+import java.util.List;
+
/**
* A {@link net.zffu.hardened.api.commands.Command} that can onlu run with specific {@link net.zffu.hardened.api.invoker.InvokerType}.
* @since 1.0.0
@@ -12,6 +14,6 @@ public interface TypeGatedCommand {
* Gets the list of the {@link InvokerType} that are allowed to run the command.
* @return {@link InvokerType}.
*/
- InvokerType[] getAllowedInvokers();
+ List getAllowedInvokers();
}