From aef3d8bdcd5d090674c5845b8313fd42ad84074b Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 14 Jul 2020 14:21:53 +0200 Subject: [PATCH] Allow types implementing the CommandSender in the ReflectiveSubCommandExecutor --- README.md | 4 ++-- pom.xml | 2 +- .../simplecommand/executor/ReflectiveSubCommandExecutor.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 371e96a..a2e7a09 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Maven: com.github.derrop simplecommand - 1.1-RELEASE + 1.2-RELEASE ``` @@ -27,7 +27,7 @@ maven { url 'https://jitpack.io' } -compile group: 'com.github.derrop', name: 'simplecommand', version: '1.1-RELEASE' +compile group: 'com.github.derrop', name: 'simplecommand', version: '1.2-RELEASE' ```
diff --git a/pom.xml b/pom.xml index 0c0ff4c..9fb5857 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.derrop simplecommand - 1.0-RELEASE + 1.2-RELEASE diff --git a/src/main/java/com/github/derrop/simplecommand/executor/ReflectiveSubCommandExecutor.java b/src/main/java/com/github/derrop/simplecommand/executor/ReflectiveSubCommandExecutor.java index e3eb197..80dc26a 100644 --- a/src/main/java/com/github/derrop/simplecommand/executor/ReflectiveSubCommandExecutor.java +++ b/src/main/java/com/github/derrop/simplecommand/executor/ReflectiveSubCommandExecutor.java @@ -41,7 +41,7 @@ public void setCommand(UsableCommand command) { private void validateParameters(Method method) { for (Parameter parameter : method.getParameters()) { - if (Arrays.stream(ALLOWED_PARAMETERS).noneMatch(allowed -> allowed.getType().equals(parameter.getType()))) { + if (Arrays.stream(ALLOWED_PARAMETERS).noneMatch(allowed -> allowed.getType().isAssignableFrom(parameter.getType()))) { throw new IllegalArgumentException("Parameter " + parameter.getName() + "@" + parameter.getType().getSimpleName() + " is not allowed on sub commands"); } }