diff --git a/base/command/pom.xml b/base/command/pom.xml
index 5c90198..9f460da 100644
--- a/base/command/pom.xml
+++ b/base/command/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/base/command/src/main/java/cc/carm/lib/easyplugin/command/CommandHandler.java b/base/command/src/main/java/cc/carm/lib/easyplugin/command/CommandHandler.java
index 4cc53e5..b4a606a 100644
--- a/base/command/src/main/java/cc/carm/lib/easyplugin/command/CommandHandler.java
+++ b/base/command/src/main/java/cc/carm/lib/easyplugin/command/CommandHandler.java
@@ -11,13 +11,14 @@ import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.stream.Collectors;
+@SuppressWarnings("UnusedReturnValue")
public abstract class CommandHandler implements TabExecutor, NamedExecutor {
protected final @NotNull JavaPlugin plugin;
protected final @NotNull String cmd;
protected final @NotNull List aliases;
- protected final @NotNull Map registeredCommands = new HashMap<>();
+ protected final @NotNull Map> registeredCommands = new HashMap<>();
protected final @NotNull Map registeredHandlers = new HashMap<>();
protected final @NotNull Map aliasesMap = new HashMap<>();
@@ -36,13 +37,13 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
this.aliases = Arrays.asList(aliases);
}
- public abstract void noArgs(CommandSender sender);
+ public abstract Void noArgs(CommandSender sender);
- public void unknownCommand(CommandSender sender, String[] args) {
- noArgs(sender);
+ public Void unknownCommand(CommandSender sender, String[] args) {
+ return noArgs(sender);
}
- public abstract void noPermission(CommandSender sender);
+ public abstract Void noPermission(CommandSender sender);
@Override
public @NotNull List getAliases() {
@@ -54,7 +55,7 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
return this.cmd;
}
- public void registerSubCommand(SubCommand command) {
+ public void registerSubCommand(SubCommand> command) {
String name = command.getName().toLowerCase();
this.registeredCommands.put(name, command);
command.getAliases().forEach(alias -> this.aliasesMap.put(alias.toLowerCase(), name));
@@ -82,14 +83,14 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
}
}
- SubCommand subCommand = getSubCommand(input);
- if (subCommand == null) {
+ SubCommand> sub = getSubCommand(input);
+ if (sub == null) {
this.unknownCommand(sender, args);
- } else if (!subCommand.hasPermission(sender)) {
+ } else if (!sub.hasPermission(sender)) {
this.noPermission(sender);
} else {
try {
- subCommand.execute(this.plugin, sender, this.shortenArgs(args));
+ sub.execute(this.plugin, sender, this.shortenArgs(args));
} catch (ArrayIndexOutOfBoundsException var9) {
this.unknownCommand(sender, args);
}
@@ -117,9 +118,9 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
return handler.onTabComplete(sender, command, alias, this.shortenArgs(args));
}
- SubCommand subCommand = getSubCommand(input);
- if (subCommand != null && subCommand.hasPermission(sender)) {
- return subCommand.tabComplete(this.plugin, sender, this.shortenArgs(args));
+ SubCommand> sub = getSubCommand(input);
+ if (sub != null && sub.hasPermission(sender)) {
+ return sub.tabComplete(this.plugin, sender, this.shortenArgs(args));
}
return Collections.emptyList();
@@ -144,8 +145,8 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
else return this.registeredHandlers.get(nameFromAlias);
}
- protected @Nullable SubCommand getSubCommand(@NotNull String name) {
- SubCommand fromName = this.registeredCommands.get(name);
+ protected @Nullable SubCommand> getSubCommand(@NotNull String name) {
+ SubCommand> fromName = this.registeredCommands.get(name);
if (fromName != null) return fromName;
String nameFromAlias = this.aliasesMap.get(name);
diff --git a/base/command/src/main/java/cc/carm/lib/easyplugin/command/SubCommand.java b/base/command/src/main/java/cc/carm/lib/easyplugin/command/SubCommand.java
index 9295324..5080435 100644
--- a/base/command/src/main/java/cc/carm/lib/easyplugin/command/SubCommand.java
+++ b/base/command/src/main/java/cc/carm/lib/easyplugin/command/SubCommand.java
@@ -2,28 +2,38 @@ package cc.carm.lib.easyplugin.command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Unmodifiable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@SuppressWarnings("UnusedReturnValue")
-public abstract class SubCommand implements NamedExecutor {
+public abstract class SubCommand implements NamedExecutor {
+
+ private final @NotNull C parent;
private final String name;
private final List aliases;
- public SubCommand(String name, String... aliases) {
+ public SubCommand(@NotNull C parent, String name, String... aliases) {
+ this.parent = parent;
this.name = name;
this.aliases = Arrays.asList(aliases);
}
+ public @NotNull C getParent() {
+ return parent;
+ }
+
@Override
public String getName() {
return this.name;
}
@Override
+ @Unmodifiable
public List getAliases() {
return this.aliases;
}
@@ -33,6 +43,5 @@ public abstract class SubCommand implements NamedExecutor {
public List tabComplete(JavaPlugin plugin, CommandSender sender, String[] args) {
return Collections.emptyList();
}
-
-
+
}
diff --git a/base/conf/pom.xml b/base/conf/pom.xml
index a32de86..fab38b2 100644
--- a/base/conf/pom.xml
+++ b/base/conf/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/base/database/pom.xml b/base/database/pom.xml
index e1ba1ea..722685e 100644
--- a/base/database/pom.xml
+++ b/base/database/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/base/gui/pom.xml b/base/gui/pom.xml
index 3667df5..41053aa 100644
--- a/base/gui/pom.xml
+++ b/base/gui/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/base/listener/pom.xml b/base/listener/pom.xml
index 9807e1e..cf1a71b 100644
--- a/base/listener/pom.xml
+++ b/base/listener/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/base/main/pom.xml b/base/main/pom.xml
index 1146247..b7225e4 100644
--- a/base/main/pom.xml
+++ b/base/main/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/base/storage/pom.xml b/base/storage/pom.xml
index 379801f..6b4617a 100644
--- a/base/storage/pom.xml
+++ b/base/storage/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/collection/all/pom.xml b/collection/all/pom.xml
index 070fb1f..00a5441 100644
--- a/collection/all/pom.xml
+++ b/collection/all/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/collection/bom/pom.xml b/collection/bom/pom.xml
index fd8fd77..5457e56 100644
--- a/collection/bom/pom.xml
+++ b/collection/bom/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/collection/common/pom.xml b/collection/common/pom.xml
index b120d8b..1ad40ab 100644
--- a/collection/common/pom.xml
+++ b/collection/common/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/extension/gh-checker/pom.xml b/extension/gh-checker/pom.xml
index 64bcd58..762c990 100644
--- a/extension/gh-checker/pom.xml
+++ b/extension/gh-checker/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/extension/papi/pom.xml b/extension/papi/pom.xml
index 22e31ae..3800b79 100644
--- a/extension/papi/pom.xml
+++ b/extension/papi/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/extension/vault/pom.xml b/extension/vault/pom.xml
index b00b719..bf95f1f 100644
--- a/extension/vault/pom.xml
+++ b/extension/vault/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.13
+ 1.4.14
../../pom.xml
4.0.0
diff --git a/pom.xml b/pom.xml
index 7c8b103..94c9b92 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
cc.carm.lib
easyplugin-parent
pom
- 1.4.13
+ 1.4.14
base/main