diff --git a/base/command/pom.xml b/base/command/pom.xml
index c9e5884..9a40a5f 100644
--- a/base/command/pom.xml
+++ b/base/command/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.8
+ 1.4.9
../../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 e7d1891..4cc53e5 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
@@ -38,7 +38,9 @@ public abstract class CommandHandler implements TabExecutor, NamedExecutor {
public abstract void noArgs(CommandSender sender);
- public abstract void unknownCommand(CommandSender sender, String[] args);
+ public void unknownCommand(CommandSender sender, String[] args) {
+ noArgs(sender);
+ }
public abstract void noPermission(CommandSender sender);
diff --git a/base/command/src/main/java/cc/carm/lib/easyplugin/command/SimpleCompleter.java b/base/command/src/main/java/cc/carm/lib/easyplugin/command/SimpleCompleter.java
index cc418f3..d0cb6f7 100644
--- a/base/command/src/main/java/cc/carm/lib/easyplugin/command/SimpleCompleter.java
+++ b/base/command/src/main/java/cc/carm/lib/easyplugin/command/SimpleCompleter.java
@@ -1,15 +1,18 @@
package cc.carm.lib.easyplugin.command;
+import com.google.common.collect.ImmutableList;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
+import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.HumanEntity;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -17,14 +20,22 @@ import java.util.stream.Stream;
public class SimpleCompleter {
- public static @NotNull List objects(@NotNull String input, List> objects) {
+ public static @NotNull List none() {
+ return ImmutableList.of();
+ }
+
+ public static @NotNull List objects(@NotNull String input, Collection> objects) {
return objects(input, objects.size(), objects);
}
- public static @NotNull List objects(@NotNull String input, int limit, List> objects) {
+ public static @NotNull List objects(@NotNull String input, int limit, Collection> objects) {
return objects(input, limit, objects.stream());
}
+ public static @NotNull List objects(@NotNull String input, Stream> stream) {
+ return objects(input, 20, stream);
+ }
+
public static @NotNull List objects(@NotNull String input, int limit, Stream> stream) {
return stream.filter(Objects::nonNull).map(Object::toString)
.filter(s -> StringUtil.startsWithIgnoreCase(s, input))
@@ -39,11 +50,11 @@ public class SimpleCompleter {
return text(input, limit, Arrays.asList(texts));
}
- public static @NotNull List text(@NotNull String input, List texts) {
+ public static @NotNull List text(@NotNull String input, Collection texts) {
return text(input, texts.size(), texts);
}
- public static @NotNull List text(@NotNull String input, int limit, List texts) {
+ public static @NotNull List text(@NotNull String input, int limit, Collection texts) {
return objects(input, limit, texts);
}
@@ -87,4 +98,13 @@ public class SimpleCompleter {
return objects(input, limit, Arrays.stream(PotionEffectType.values()).map(PotionEffectType::getName));
}
+ public static @NotNull List enchantments(@NotNull String input) {
+ return effects(input, 10);
+ }
+
+ @SuppressWarnings("deprecation")
+ public static @NotNull List enchantments(@NotNull String input, int limit) {
+ return objects(input, limit, Arrays.stream(Enchantment.values()).map(Enchantment::getName));
+ }
+
}
diff --git a/base/gui/pom.xml b/base/gui/pom.xml
index e050da1..a54e28e 100644
--- a/base/gui/pom.xml
+++ b/base/gui/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.8
+ 1.4.9
../../pom.xml
4.0.0
diff --git a/base/main/pom.xml b/base/main/pom.xml
index 8e7960c..558ef0c 100644
--- a/base/main/pom.xml
+++ b/base/main/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.8
+ 1.4.9
../../pom.xml
4.0.0
diff --git a/base/storage/pom.xml b/base/storage/pom.xml
index 3f34791..a2bd13f 100644
--- a/base/storage/pom.xml
+++ b/base/storage/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.8
+ 1.4.9
../../pom.xml
4.0.0
diff --git a/collection/all/pom.xml b/collection/all/pom.xml
index 51e3168..dad97ea 100644
--- a/collection/all/pom.xml
+++ b/collection/all/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.8
+ 1.4.9
../../pom.xml
4.0.0
diff --git a/collection/bom/pom.xml b/collection/bom/pom.xml
index 13514e6..7c879c4 100644
--- a/collection/bom/pom.xml
+++ b/collection/bom/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.8
+ 1.4.9
../../pom.xml
4.0.0
diff --git a/collection/common/pom.xml b/collection/common/pom.xml
index 3f59430..686c895 100644
--- a/collection/common/pom.xml
+++ b/collection/common/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.8
+ 1.4.9
../../pom.xml
4.0.0
diff --git a/extension/gh-checker/pom.xml b/extension/gh-checker/pom.xml
index 4f975b5..835f691 100644
--- a/extension/gh-checker/pom.xml
+++ b/extension/gh-checker/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.8
+ 1.4.9
../../pom.xml
4.0.0
diff --git a/extension/papi/pom.xml b/extension/papi/pom.xml
index d71fe58..089a0e0 100644
--- a/extension/papi/pom.xml
+++ b/extension/papi/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.8
+ 1.4.9
../../pom.xml
4.0.0
diff --git a/extension/vault/pom.xml b/extension/vault/pom.xml
index f4b2050..2a8a958 100644
--- a/extension/vault/pom.xml
+++ b/extension/vault/pom.xml
@@ -5,7 +5,7 @@
easyplugin-parent
cc.carm.lib
- 1.4.8
+ 1.4.9
../../pom.xml
4.0.0
diff --git a/pom.xml b/pom.xml
index c35de5b..83c0214 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
cc.carm.lib
easyplugin-parent
pom
- 1.4.8
+ 1.4.9
base/main