From 437d0ffb323e14d695e0cd0962903de62830e2ff Mon Sep 17 00:00:00 2001 From: carm Date: Tue, 13 Dec 2022 00:29:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(utils):=20=E7=8B=AC=E7=AB=8B=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E7=B1=BB=E5=88=B0=E5=8D=95=E7=8B=AC=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E4=BE=BF=E4=BA=8E=E4=BD=BF=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++- base/command/pom.xml | 2 +- base/conf/pom.xml | 2 +- base/database/pom.xml | 2 +- base/gui/pom.xml | 2 +- base/listener/pom.xml | 2 +- base/main/pom.xml | 11 +++- base/storage/pom.xml | 2 +- base/utils/pom.xml | 51 +++++++++++++++++++ .../lib/easyplugin/utils/ColorParser.java | 0 .../lib/easyplugin/utils/EasyCooldown.java | 13 +---- .../easyplugin/utils/JarResourceUtils.java | 0 .../src/test/java/ColorParseTest.java} | 2 +- collection/all/pom.xml | 2 +- collection/bom/pom.xml | 2 +- collection/common/pom.xml | 2 +- extension/gh-checker/pom.xml | 2 +- extension/papi/pom.xml | 2 +- extension/vault/pom.xml | 2 +- pom.xml | 3 +- 20 files changed, 83 insertions(+), 29 deletions(-) create mode 100644 base/utils/pom.xml rename base/{main => utils}/src/main/java/cc/carm/lib/easyplugin/utils/ColorParser.java (100%) rename base/{main => utils}/src/main/java/cc/carm/lib/easyplugin/utils/EasyCooldown.java (85%) rename base/{main => utils}/src/main/java/cc/carm/lib/easyplugin/utils/JarResourceUtils.java (100%) rename base/{main/src/test/java/ColorTest.java => utils/src/test/java/ColorParseTest.java} (98%) diff --git a/README.md b/README.md index c8cf1d0..de10dd0 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,14 @@ ### 主要部分 (`/base`) +- Utils [`easyplugin-utils`](base/utils) + - 通用工具类模块,该模块中的内容支持在Bungee、Bukkit使用。 + - 本模块提供 + - `ColorParser` 支持RGB颜色与RGB渐变色的颜色解析器。 + - `EasyCooldown` 快速创造一个冷却时间的管理器。 + - `JarResourceUtils` 快速读取Jar包内容的工具类。 - Main [`easyplugin-main`](base/main) - - 主要接口模块,提供了方便的插件入口类与相关工具类。 + - 主要接口模块,提供了方便的插件入口类与相关工具类。 - Command [`easyplugin-command`](base/command) - 指令接口模块,便于快速进行子指令的实现,并提供单独的TabComplete方法。 - 随本项目提供了 `SimpleCompleter` 类,用于快速创建补全的内容列表。 diff --git a/base/command/pom.xml b/base/command/pom.xml index 4579032..6af601c 100644 --- a/base/command/pom.xml +++ b/base/command/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/base/conf/pom.xml b/base/conf/pom.xml index dc83ec9..7b42e40 100644 --- a/base/conf/pom.xml +++ b/base/conf/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/base/database/pom.xml b/base/database/pom.xml index 0e695b4..da19828 100644 --- a/base/database/pom.xml +++ b/base/database/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/base/gui/pom.xml b/base/gui/pom.xml index 78dd7d0..f5798ae 100644 --- a/base/gui/pom.xml +++ b/base/gui/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/base/listener/pom.xml b/base/listener/pom.xml index 3e93e42..c5961b0 100644 --- a/base/listener/pom.xml +++ b/base/listener/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/base/main/pom.xml b/base/main/pom.xml index a00d683..f3eae59 100644 --- a/base/main/pom.xml +++ b/base/main/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 @@ -22,7 +22,7 @@ jar EasyPlugin-Main - 轻松插件主要接口模块,包含方便的插件入口类与相关工具类。 + 轻松插件主要接口模块,包含便捷的插件入口类与相关工具类。 https://github.com/CarmJos/EasyPlugin @@ -53,6 +53,13 @@ + + ${project.groupId} + easyplugin-utils + ${project.version} + compile + + me.clip placeholderapi diff --git a/base/storage/pom.xml b/base/storage/pom.xml index e80900a..4669e12 100644 --- a/base/storage/pom.xml +++ b/base/storage/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/base/utils/pom.xml b/base/utils/pom.xml new file mode 100644 index 0000000..3706650 --- /dev/null +++ b/base/utils/pom.xml @@ -0,0 +1,51 @@ + + + + easyplugin-parent + cc.carm.lib + 1.4.18 + ../../pom.xml + + 4.0.0 + + ${project.jdk.version} + ${project.jdk.version} + UTF-8 + UTF-8 + + + easyplugin-utils + + EasyPlugin-Utils + 轻松插件工具类模块,该模块中的内容支持在Bungee、Bukkit使用。 + https://github.com/CarmJos/EasyPlugin + + + + CarmJos + Carm Jos + carm@carm.cc + https://www.carm.cc + + + + + + The MIT License + https://opensource.org/licenses/MIT + + + + + GitHub Issues + https://github.com/CarmJos/EasyPlugin/issues + + + + GitHub Actions + https://github.com/CarmJos/EasyPlugin/actions/workflows/maven.yml + + + \ No newline at end of file diff --git a/base/main/src/main/java/cc/carm/lib/easyplugin/utils/ColorParser.java b/base/utils/src/main/java/cc/carm/lib/easyplugin/utils/ColorParser.java similarity index 100% rename from base/main/src/main/java/cc/carm/lib/easyplugin/utils/ColorParser.java rename to base/utils/src/main/java/cc/carm/lib/easyplugin/utils/ColorParser.java diff --git a/base/main/src/main/java/cc/carm/lib/easyplugin/utils/EasyCooldown.java b/base/utils/src/main/java/cc/carm/lib/easyplugin/utils/EasyCooldown.java similarity index 85% rename from base/main/src/main/java/cc/carm/lib/easyplugin/utils/EasyCooldown.java rename to base/utils/src/main/java/cc/carm/lib/easyplugin/utils/EasyCooldown.java index 92eac47..c2fc614 100644 --- a/base/main/src/main/java/cc/carm/lib/easyplugin/utils/EasyCooldown.java +++ b/base/utils/src/main/java/cc/carm/lib/easyplugin/utils/EasyCooldown.java @@ -1,12 +1,10 @@ package cc.carm.lib.easyplugin.utils; -import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.text.NumberFormat; import java.util.HashMap; import java.util.Map; -import java.util.UUID; import java.util.function.Consumer; import java.util.function.Function; @@ -82,7 +80,7 @@ public class EasyCooldown { return numberFormatter.format((double) cooldownMillis / 1000D); } - public static NumberFormat createFormatter(Consumer consumer) { + public static NumberFormat createFormatter(@NotNull Consumer consumer) { NumberFormat format = NumberFormat.getInstance(); consumer.accept(format); return format; @@ -92,13 +90,4 @@ public class EasyCooldown { return createFormatter((f) -> f.setMaximumFractionDigits(2)); } - public static EasyCooldown playerCooldown(Function durationProvider) { - return new EasyCooldown(Player::getUniqueId) { - @Override - public long getDuration(@NotNull Player provider) { - return durationProvider.apply(provider); - } - }; - } - } diff --git a/base/main/src/main/java/cc/carm/lib/easyplugin/utils/JarResourceUtils.java b/base/utils/src/main/java/cc/carm/lib/easyplugin/utils/JarResourceUtils.java similarity index 100% rename from base/main/src/main/java/cc/carm/lib/easyplugin/utils/JarResourceUtils.java rename to base/utils/src/main/java/cc/carm/lib/easyplugin/utils/JarResourceUtils.java diff --git a/base/main/src/test/java/ColorTest.java b/base/utils/src/test/java/ColorParseTest.java similarity index 98% rename from base/main/src/test/java/ColorTest.java rename to base/utils/src/test/java/ColorParseTest.java index 51655cd..3026fe0 100644 --- a/base/main/src/test/java/ColorTest.java +++ b/base/utils/src/test/java/ColorParseTest.java @@ -6,7 +6,7 @@ import java.util.regex.Matcher; import static cc.carm.lib.easyplugin.utils.ColorParser.*; -public class ColorTest { +public class ColorParseTest { @Test diff --git a/collection/all/pom.xml b/collection/all/pom.xml index 06bccb4..b36a071 100644 --- a/collection/all/pom.xml +++ b/collection/all/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/collection/bom/pom.xml b/collection/bom/pom.xml index 9fa05e1..5eb15d4 100644 --- a/collection/bom/pom.xml +++ b/collection/bom/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/collection/common/pom.xml b/collection/common/pom.xml index b1cd0a0..bc2b935 100644 --- a/collection/common/pom.xml +++ b/collection/common/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/extension/gh-checker/pom.xml b/extension/gh-checker/pom.xml index e32614e..d022bdb 100644 --- a/extension/gh-checker/pom.xml +++ b/extension/gh-checker/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/extension/papi/pom.xml b/extension/papi/pom.xml index 6bc4186..8a07476 100644 --- a/extension/papi/pom.xml +++ b/extension/papi/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/extension/vault/pom.xml b/extension/vault/pom.xml index 4d44407..359f3fe 100644 --- a/extension/vault/pom.xml +++ b/extension/vault/pom.xml @@ -5,7 +5,7 @@ easyplugin-parent cc.carm.lib - 1.4.17 + 1.4.18 ../../pom.xml 4.0.0 diff --git a/pom.xml b/pom.xml index acd39f1..6bd2a28 100644 --- a/pom.xml +++ b/pom.xml @@ -15,8 +15,9 @@ cc.carm.lib easyplugin-parent pom - 1.4.17 + 1.4.18 + base/utils base/main base/conf