>> cachedSubclasses = new AtomicReference<>();
+
+ /**
+ * Get all subclasses of the current class, using the ClassGraph library.
+ *
+ * If the returned list is not yet cached, or {@code forceUpdateCache} is true, then the cache is updated before
+ * being returned. This may take some time.
+ *
+ * The ClassGraph library scan all class files in the class path, then loads those which will be returned by
+ * this method.
+ *
+ * @param forceUpdateCache to force the update of the cache, even if it already filled.
+ * @return the list of all subclasses found in all loaded class loader.
+ * @throws ClassGraphException if any of the worker threads throws an uncaught exception, or the scan was interrupted. (see {@link ClassGraph#scan})
+ * @throws IllegalArgumentException f an exception or error was thrown while trying to load any of the classes. (see {@link ClassInfoList#loadClasses()})
+ */
+ public List> getAllSubclasses(boolean forceUpdateCache) {
+ synchronized (cachedSubclasses) {
+ if (forceUpdateCache || cachedSubclasses.get() == null) {
+ try (ScanResult scanResult = new ClassGraph().enableClassInfo().ignoreClassVisibility().scan()) {
+ cachedSubclasses.set(scanResult.getSubclasses(clazz).loadClasses());
+ }
+ }
+ @SuppressWarnings("unchecked")
+ List> ret = (List>) (List>) cachedSubclasses.get();
+ return ret;
+ }
+
+ }
}
@@ -432,41 +459,7 @@ public class Reflect {
}
-
-
-
-
-
-
-
-
-
-
-
-
-
- private static final Cache, List>> subClassesLists = CacheBuilder.newBuilder()
- .expireAfterAccess(10, TimeUnit.MINUTES)
- .build();
-
- public static List> getAllSubclasses(Class clazz) {
- try {
- @SuppressWarnings("unchecked")
- List> classes = (List>) (List>) subClassesLists.get(clazz, () -> {
- try (ScanResult scanResult = new ClassGraph().enableClassInfo().ignoreClassVisibility().scan()) {
- return scanResult.getSubclasses(clazz.getName()).loadClasses();
- }
- });
- return classes;
- } catch(ExecutionException e) {
- Log.severe(e);
- return new ArrayList<>();
- }
-
- }
-
-
}
diff --git a/Util/pom.xml b/Util/pom.xml
new file mode 100644
index 0000000..aeeda89
--- /dev/null
+++ b/Util/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ pandalib-parent
+ fr.pandacube.lib
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ pandalib-util
+
+
+ 17
+ 17
+
+
+
\ No newline at end of file
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/AmountPerTimeLimiter.java b/Util/src/main/java/fr/pandacube/lib/util/AmountPerTimeLimiter.java
similarity index 97%
rename from Core/src/main/java/fr/pandacube/lib/core/util/AmountPerTimeLimiter.java
rename to Util/src/main/java/fr/pandacube/lib/util/AmountPerTimeLimiter.java
index e6d4772..633d491 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/AmountPerTimeLimiter.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/AmountPerTimeLimiter.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.ArrayList;
import java.util.List;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/BiMap.java b/Util/src/main/java/fr/pandacube/lib/util/BiMap.java
similarity index 98%
rename from Core/src/main/java/fr/pandacube/lib/core/util/BiMap.java
rename to Util/src/main/java/fr/pandacube/lib/util/BiMap.java
index e47f613..ef7990d 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/BiMap.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/BiMap.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.Collections;
import java.util.HashMap;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/CronExpression.java b/Util/src/main/java/fr/pandacube/lib/util/CronExpression.java
similarity index 99%
rename from Core/src/main/java/fr/pandacube/lib/core/util/CronExpression.java
rename to Util/src/main/java/fr/pandacube/lib/util/CronExpression.java
index 9400220..ea46150 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/CronExpression.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/CronExpression.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
// from https://github.com/frode-carlsen/cron/blob/master/java8/src/main/java/fc/cron/CronExpression.java
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/DistanceUtil.java b/Util/src/main/java/fr/pandacube/lib/util/DistanceUtil.java
similarity index 97%
rename from Core/src/main/java/fr/pandacube/lib/core/util/DistanceUtil.java
rename to Util/src/main/java/fr/pandacube/lib/util/DistanceUtil.java
index da3d462..92028ec 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/DistanceUtil.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/DistanceUtil.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.text.DecimalFormat;
import java.util.Arrays;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/EnumUtil.java b/Util/src/main/java/fr/pandacube/lib/util/EnumUtil.java
similarity index 98%
rename from Core/src/main/java/fr/pandacube/lib/core/util/EnumUtil.java
rename to Util/src/main/java/fr/pandacube/lib/util/EnumUtil.java
index 02954fb..c750d55 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/EnumUtil.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/EnumUtil.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.Arrays;
import java.util.stream.Collectors;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/FileUtils.java b/Util/src/main/java/fr/pandacube/lib/util/FileUtils.java
similarity index 96%
rename from Core/src/main/java/fr/pandacube/lib/core/util/FileUtils.java
rename to Util/src/main/java/fr/pandacube/lib/util/FileUtils.java
index d0ba161..4a4c03b 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/FileUtils.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/FileUtils.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.io.File;
import java.io.IOException;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/IteratorIterator.java b/Util/src/main/java/fr/pandacube/lib/util/IteratorIterator.java
similarity index 98%
rename from Core/src/main/java/fr/pandacube/lib/core/util/IteratorIterator.java
rename to Util/src/main/java/fr/pandacube/lib/util/IteratorIterator.java
index ba0fc24..d68ddec 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/IteratorIterator.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/IteratorIterator.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/JArithmeticInterpreter.java b/Util/src/main/java/fr/pandacube/lib/util/JArithmeticInterpreter.java
similarity index 99%
rename from Core/src/main/java/fr/pandacube/lib/core/util/JArithmeticInterpreter.java
rename to Util/src/main/java/fr/pandacube/lib/util/JArithmeticInterpreter.java
index bd13ecb..30fed8b 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/JArithmeticInterpreter.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/JArithmeticInterpreter.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
//******************************************************************************
//***
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/Lazy.java b/Util/src/main/java/fr/pandacube/lib/util/Lazy.java
similarity index 97%
rename from Core/src/main/java/fr/pandacube/lib/core/util/Lazy.java
rename to Util/src/main/java/fr/pandacube/lib/util/Lazy.java
index a50373a..432090e 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/Lazy.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/Lazy.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.Objects;
import java.util.function.Supplier;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/LazyOrException.java b/Util/src/main/java/fr/pandacube/lib/util/LazyOrException.java
similarity index 91%
rename from Core/src/main/java/fr/pandacube/lib/core/util/LazyOrException.java
rename to Util/src/main/java/fr/pandacube/lib/util/LazyOrException.java
index b699809..a4b964d 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/LazyOrException.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/LazyOrException.java
@@ -1,8 +1,8 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.Objects;
-import fr.pandacube.lib.core.util.ThrowableUtil.SupplierException;
+import fr.pandacube.lib.util.ThrowableUtil.SupplierException;
/**
* Represents a lazy loaded value.
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/LevenshteinDistance.java b/Util/src/main/java/fr/pandacube/lib/util/LevenshteinDistance.java
similarity index 97%
rename from Core/src/main/java/fr/pandacube/lib/core/util/LevenshteinDistance.java
rename to Util/src/main/java/fr/pandacube/lib/util/LevenshteinDistance.java
index a69c9bc..ca15ba9 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/LevenshteinDistance.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/LevenshteinDistance.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.Objects;
import java.util.function.ToIntBiFunction;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/ListUtil.java b/Util/src/main/java/fr/pandacube/lib/util/ListUtil.java
similarity index 84%
rename from Core/src/main/java/fr/pandacube/lib/core/util/ListUtil.java
rename to Util/src/main/java/fr/pandacube/lib/util/ListUtil.java
index f4ce7c7..bc1ab3d 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/ListUtil.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/ListUtil.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.List;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/Log.java b/Util/src/main/java/fr/pandacube/lib/util/Log.java
similarity index 96%
rename from Core/src/main/java/fr/pandacube/lib/core/util/Log.java
rename to Util/src/main/java/fr/pandacube/lib/util/Log.java
index d84d91a..6ef1119 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/Log.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/Log.java
@@ -1,10 +1,10 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
-public class Log {
+public final class Log {
private static Logger logger = Logger.getGlobal();
private static final AtomicBoolean logDebug = new AtomicBoolean(false);
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/MappedListView.java b/Util/src/main/java/fr/pandacube/lib/util/MappedListView.java
similarity index 99%
rename from Core/src/main/java/fr/pandacube/lib/core/util/MappedListView.java
rename to Util/src/main/java/fr/pandacube/lib/util/MappedListView.java
index 34d08af..c256a06 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/MappedListView.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/MappedListView.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.AbstractList;
import java.util.Iterator;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/MemoryUtil.java b/Util/src/main/java/fr/pandacube/lib/util/MemoryUtil.java
similarity index 97%
rename from Core/src/main/java/fr/pandacube/lib/core/util/MemoryUtil.java
rename to Util/src/main/java/fr/pandacube/lib/util/MemoryUtil.java
index 52abf37..f1bde7e 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/MemoryUtil.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/MemoryUtil.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.text.DecimalFormat;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/MinecraftVersion.java b/Util/src/main/java/fr/pandacube/lib/util/MinecraftVersion.java
similarity index 77%
rename from Core/src/main/java/fr/pandacube/lib/core/util/MinecraftVersion.java
rename to Util/src/main/java/fr/pandacube/lib/util/MinecraftVersion.java
index d157b2c..c70546b 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/MinecraftVersion.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/MinecraftVersion.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.ArrayList;
import java.util.Arrays;
@@ -8,8 +8,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import com.google.common.collect.ImmutableList;
-
public enum MinecraftVersion {
v1_7_2_to_1_7_5(4, "1.7.2-1.7.5"),
v1_7_6_to_1_7_10(5, "1.7.6-1.7.10"),
@@ -65,92 +63,92 @@ public enum MinecraftVersion {
versionMergeDisplay = new HashMap<>();
versionMergeDisplay.put(EnumSet.of(v1_7_2_to_1_7_5, v1_7_6_to_1_7_10),
- ImmutableList.of("1.7.2-1.7.10"));
+ List.of("1.7.2-1.7.10"));
versionMergeDisplay.put(EnumSet.of(v1_9, v1_9_1, v1_9_2, v1_9_3_to_1_9_4),
- ImmutableList.of("1.9.x"));
+ List.of("1.9.x"));
versionMergeDisplay.put(EnumSet.of(v1_9, v1_9_1, v1_9_2),
- ImmutableList.of("1.9-1.9.2"));
+ List.of("1.9-1.9.2"));
versionMergeDisplay.put(EnumSet.of(v1_9, v1_9_1),
- ImmutableList.of("1.9", "1.9.1"));
+ List.of("1.9", "1.9.1"));
versionMergeDisplay.put(EnumSet.of(v1_9_1, v1_9_2, v1_9_3_to_1_9_4),
- ImmutableList.of("1.9.1-1.9.4"));
+ List.of("1.9.1-1.9.4"));
versionMergeDisplay.put(EnumSet.of(v1_9_1, v1_9_2),
- ImmutableList.of("1.9.1", "1.9.2"));
+ List.of("1.9.1", "1.9.2"));
versionMergeDisplay.put(EnumSet.of(v1_9_2, v1_9_3_to_1_9_4),
- ImmutableList.of("1.9.2-1.9.4"));
+ List.of("1.9.2-1.9.4"));
versionMergeDisplay.put(EnumSet.of(v1_11, v1_11_1_to_1_11_2),
- ImmutableList.of("1.11.x"));
+ List.of("1.11.x"));
versionMergeDisplay.put(EnumSet.of(v1_12, v1_12_1, v1_12_2),
- ImmutableList.of("1.12.x"));
+ List.of("1.12.x"));
versionMergeDisplay.put(EnumSet.of(v1_12, v1_12_1),
- ImmutableList.of("1.12", "1.12.1"));
+ List.of("1.12", "1.12.1"));
versionMergeDisplay.put(EnumSet.of(v1_12_1, v1_12_2),
- ImmutableList.of("1.12.1", "1.12.2"));
+ List.of("1.12.1", "1.12.2"));
versionMergeDisplay.put(EnumSet.of(v1_13, v1_13_1, v1_13_2),
- ImmutableList.of("1.13.x"));
+ List.of("1.13.x"));
versionMergeDisplay.put(EnumSet.of(v1_13, v1_13_1),
- ImmutableList.of("1.13", "1.13.1"));
+ List.of("1.13", "1.13.1"));
versionMergeDisplay.put(EnumSet.of(v1_13_1, v1_13_2),
- ImmutableList.of("1.13.1", "1.13.2"));
+ List.of("1.13.1", "1.13.2"));
versionMergeDisplay.put(EnumSet.of(v1_14, v1_14_1, v1_14_2, v1_14_3, v1_14_4),
- ImmutableList.of("1.14.x"));
+ List.of("1.14.x"));
versionMergeDisplay.put(EnumSet.of(v1_14, v1_14_1, v1_14_2, v1_14_3),
- ImmutableList.of("1.14-1.14.3"));
+ List.of("1.14-1.14.3"));
versionMergeDisplay.put(EnumSet.of(v1_14_1, v1_14_2, v1_14_3, v1_14_4),
- ImmutableList.of("1.14.1-1.14.4"));
+ List.of("1.14.1-1.14.4"));
versionMergeDisplay.put(EnumSet.of(v1_14, v1_14_1, v1_14_2),
- ImmutableList.of("1.14-1.14.2"));
+ List.of("1.14-1.14.2"));
versionMergeDisplay.put(EnumSet.of(v1_14_1, v1_14_2, v1_14_3),
- ImmutableList.of("1.14.1-1.14.3"));
+ List.of("1.14.1-1.14.3"));
versionMergeDisplay.put(EnumSet.of(v1_14_2, v1_14_3, v1_14_4),
- ImmutableList.of("1.14.2-1.14.4"));
+ List.of("1.14.2-1.14.4"));
versionMergeDisplay.put(EnumSet.of(v1_14, v1_14_1),
- ImmutableList.of("1.14", "1.14.1"));
+ List.of("1.14", "1.14.1"));
versionMergeDisplay.put(EnumSet.of(v1_14_1, v1_14_2),
- ImmutableList.of("1.14.1", "1.14.2"));
+ List.of("1.14.1", "1.14.2"));
versionMergeDisplay.put(EnumSet.of(v1_14_2, v1_14_3),
- ImmutableList.of("1.14.2", "1.14.3"));
+ List.of("1.14.2", "1.14.3"));
versionMergeDisplay.put(EnumSet.of(v1_14_3, v1_14_4),
- ImmutableList.of("1.14.3", "1.14.4"));
+ List.of("1.14.3", "1.14.4"));
versionMergeDisplay.put(EnumSet.of(v1_15, v1_15_1, v1_15_2),
- ImmutableList.of("1.15.x"));
+ List.of("1.15.x"));
versionMergeDisplay.put(EnumSet.of(v1_15, v1_15_1),
- ImmutableList.of("1.15", "1.15.1"));
+ List.of("1.15", "1.15.1"));
versionMergeDisplay.put(EnumSet.of(v1_15_1, v1_15_2),
- ImmutableList.of("1.15.1", "1.15.2"));
+ List.of("1.15.1", "1.15.2"));
versionMergeDisplay.put(EnumSet.of(v1_16, v1_16_1, v1_16_2, v1_16_3, v1_16_4_to_1_16_5),
- ImmutableList.of("1.16.x"));
+ List.of("1.16.x"));
versionMergeDisplay.put(EnumSet.of(v1_16, v1_16_1, v1_16_2, v1_16_3),
- ImmutableList.of("1.16-1.16.3"));
+ List.of("1.16-1.16.3"));
versionMergeDisplay.put(EnumSet.of(v1_16_1, v1_16_2, v1_16_3, v1_16_4_to_1_16_5),
- ImmutableList.of("1.16.1-1.16.5"));
+ List.of("1.16.1-1.16.5"));
versionMergeDisplay.put(EnumSet.of(v1_16, v1_16_1, v1_16_2),
- ImmutableList.of("1.16-1.16.2"));
+ List.of("1.16-1.16.2"));
versionMergeDisplay.put(EnumSet.of(v1_16_1, v1_16_2, v1_16_3),
- ImmutableList.of("1.16.1-1.16.3"));
+ List.of("1.16.1-1.16.3"));
versionMergeDisplay.put(EnumSet.of(v1_16_2, v1_16_3, v1_16_4_to_1_16_5),
- ImmutableList.of("1.16.2-1.16.5"));
+ List.of("1.16.2-1.16.5"));
versionMergeDisplay.put(EnumSet.of(v1_16, v1_16_1),
- ImmutableList.of("1.16", "1.16.1"));
+ List.of("1.16", "1.16.1"));
versionMergeDisplay.put(EnumSet.of(v1_16_1, v1_16_2),
- ImmutableList.of("1.16.1", "1.16.2"));
+ List.of("1.16.1", "1.16.2"));
versionMergeDisplay.put(EnumSet.of(v1_16_2, v1_16_3),
- ImmutableList.of("1.16.2", "1.16.3"));
+ List.of("1.16.2", "1.16.3"));
versionMergeDisplay.put(EnumSet.of(v1_16_3, v1_16_4_to_1_16_5),
- ImmutableList.of("1.16.3-1.16.5"));
+ List.of("1.16.3-1.16.5"));
versionMergeDisplay.put(EnumSet.of(v1_17, v1_17_1),
- ImmutableList.of("1.17.x"));
+ List.of("1.17.x"));
versionMergeDisplay.put(EnumSet.of(v1_18_to_1_18_1, v1_18_2),
- ImmutableList.of("1.18.x"));
+ List.of("1.18.x"));
}
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/MinecraftWebUtil.java b/Util/src/main/java/fr/pandacube/lib/util/MinecraftWebUtil.java
similarity index 98%
rename from Core/src/main/java/fr/pandacube/lib/core/util/MinecraftWebUtil.java
rename to Util/src/main/java/fr/pandacube/lib/util/MinecraftWebUtil.java
index 5e03417..0d5afaf 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/MinecraftWebUtil.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/MinecraftWebUtil.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
public class MinecraftWebUtil {
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/OfflineUUID.java b/Util/src/main/java/fr/pandacube/lib/util/OfflineUUID.java
similarity index 96%
rename from Core/src/main/java/fr/pandacube/lib/core/util/OfflineUUID.java
rename to Util/src/main/java/fr/pandacube/lib/util/OfflineUUID.java
index d515d0d..fce80c2 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/OfflineUUID.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/OfflineUUID.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/RandomUtil.java b/Util/src/main/java/fr/pandacube/lib/util/RandomUtil.java
similarity index 98%
rename from Core/src/main/java/fr/pandacube/lib/core/util/RandomUtil.java
rename to Util/src/main/java/fr/pandacube/lib/util/RandomUtil.java
index f1283e1..24fcb56 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/RandomUtil.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/RandomUtil.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.List;
import java.util.Random;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/StringUtil.java b/Util/src/main/java/fr/pandacube/lib/util/StringUtil.java
similarity index 96%
rename from Core/src/main/java/fr/pandacube/lib/core/util/StringUtil.java
rename to Util/src/main/java/fr/pandacube/lib/util/StringUtil.java
index 11b47fc..020030d 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/StringUtil.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/StringUtil.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.util.Arrays;
import java.util.List;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/ThrowableUtil.java b/Util/src/main/java/fr/pandacube/lib/util/ThrowableUtil.java
similarity index 99%
rename from Core/src/main/java/fr/pandacube/lib/core/util/ThrowableUtil.java
rename to Util/src/main/java/fr/pandacube/lib/util/ThrowableUtil.java
index 2095c35..5d241d2 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/ThrowableUtil.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/ThrowableUtil.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/Tick.java b/Util/src/main/java/fr/pandacube/lib/util/Tick.java
similarity index 93%
rename from Core/src/main/java/fr/pandacube/lib/core/util/Tick.java
rename to Util/src/main/java/fr/pandacube/lib/util/Tick.java
index 9b1593e..21a54f4 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/Tick.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/Tick.java
@@ -1,4 +1,4 @@
-package fr.pandacube.lib.core.util;
+package fr.pandacube.lib.util;
public class Tick {
diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/TimeUtil.java b/Util/src/main/java/fr/pandacube/lib/util/TimeUtil.java
similarity index 90%
rename from Core/src/main/java/fr/pandacube/lib/core/util/TimeUtil.java
rename to Util/src/main/java/fr/pandacube/lib/util/TimeUtil.java
index dcf77d7..280fcd1 100644
--- a/Core/src/main/java/fr/pandacube/lib/core/util/TimeUtil.java
+++ b/Util/src/main/java/fr/pandacube/lib/util/TimeUtil.java
@@ -1,14 +1,10 @@
-package fr.pandacube.lib.core.util;
-
-import fr.pandacube.lib.core.commands.SuggestionsSupplier;
+package fr.pandacube.lib.util;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
-import java.util.Collections;
import java.util.Comparator;
import java.util.GregorianCalendar;
import java.util.List;
@@ -332,46 +328,12 @@ public class TimeUtil {
if (c.after(max)) return max.getTimeInMillis();
return c.getTimeInMillis();
}
-
-
-
-
-
- public static SuggestionsSupplier suggestDuration() {
- return (s, ti, token, args) -> {
- if (token.isEmpty()) {
- return emptyTokenSuggestions;
- }
- List remainingSuffixes = new ArrayList<>(allSuffixes);
- char[] tokenChars = token.toCharArray();
- String accSuffix = "";
- for (char c : tokenChars) {
- if (Character.isDigit(c)) {
- scanAndRemovePastSuffixes(remainingSuffixes, accSuffix);
- accSuffix = "";
- } else if (Character.isLetter(c)) {
- accSuffix += c;
- } else
- return Collections.emptyList();
- }
- String prefixToken = token.substring(0, token.length() - accSuffix.length());
- return SuggestionsSupplier.collectFilteredStream(remainingSuffixes.stream(), accSuffix)
- .stream()
- .map(str -> prefixToken + str)
- .collect(Collectors.toList());
- };
- }
-
- private static final List allSuffixes = Arrays.asList("y", "mo", "w", "d", "h", "m", "s");
- private static final List emptyTokenSuggestions = allSuffixes.stream().map(p -> "1" + p).collect(Collectors.toList());
- private static void scanAndRemovePastSuffixes(List suffixes, String foundSuffix) {
- for (int i = 0; i < suffixes.size(); i++) {
- if (foundSuffix.startsWith(suffixes.get(i))) {
- suffixes.subList(0, i + 1).clear();
- return;
- }
- }
- }
+
+
+
+
+ public static final List DURATION_SUFFIXES = List.of("y", "mo", "w", "d", "h", "m", "s");
+
}
diff --git a/pom.xml b/pom.xml
index 1b05f7b..2174bfa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,8 +8,6 @@
pandalib-parent
1.0-SNAPSHOT
pom
-
- PandaLib-Parent
Pandacube
@@ -48,9 +46,16 @@
Bungee
+ Chat
CLI
Core
+ DB
+ Net
+ NetworkAPI
Paper
+ Permissions
+ Reflect
+ Util
@@ -68,9 +73,10 @@
net.md-5
scriptus
- 0.3.1
+ 0.4.1
git:${project.name}:${project.version}:%s:${build.number}
+ true
@@ -95,51 +101,19 @@
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.2.1
+
+
+ attach-sources
+
+ jar
+
+
+
+
-
-
-
-
- org.eclipse.m2e
- lifecycle-mapping
- 1.0.0
-
-
-
-
-
- net.md-5
- scriptus
- [0.3.1,)
-
- describe
-
-
-
-
- false
-
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- [1.0.0,)
-
- enforce
-
-
-
-
-
-
-
-
-
-
-
-