From 034d74b34d0984eb106f69d23800b595760b0cf4 Mon Sep 17 00:00:00 2001
From: wisdommen <41609381+wisdommen@users.noreply.github.com>
Date: Tue, 26 Dec 2023 23:32:45 +1100
Subject: [PATCH] =?UTF-8?q?2023/12/26=E6=9B=B4=E6=96=B0=20API=E7=89=88?=
=?UTF-8?q?=E6=9C=AC6.0.2=20[UltiTools-API]=201.=E4=BF=AE=E5=A4=8D?=
=?UTF-8?q?=E4=BA=86=E6=8F=92=E4=BB=B6=E5=90=AF=E5=8A=A8=E6=89=BE=E4=B8=8D?=
=?UTF-8?q?=E5=88=B0JSON=E4=BE=9D=E8=B5=96=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Home/pom.xml | 2 +-
UltiTools-API/pom.xml | 2 +-
.../com/ultikits/ultitools/UltiTools.java | 18 -----------
.../ultikits/ultitools/utils/CommonUtils.java | 32 +++++++++++++++++++
.../utils/PluginInitiationUtils.java | 2 +-
5 files changed, 35 insertions(+), 21 deletions(-)
create mode 100644 UltiTools-API/src/main/java/com/ultikits/ultitools/utils/CommonUtils.java
diff --git a/Home/pom.xml b/Home/pom.xml
index 16419ee..29bba1a 100755
--- a/Home/pom.xml
+++ b/Home/pom.xml
@@ -18,7 +18,7 @@
com.ultikits
UltiTools-API
- 6.0.0.202312150106
+ 6.0.2
provided
diff --git a/UltiTools-API/pom.xml b/UltiTools-API/pom.xml
index 7eb5e25..fa08b42 100755
--- a/UltiTools-API/pom.xml
+++ b/UltiTools-API/pom.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
UltiTools-API
com.ultikits
- 6.0.1
+ 6.0.2
4.0.0
UltiTools-API
This project is the base of the Ultitools plugin development.
diff --git a/UltiTools-API/src/main/java/com/ultikits/ultitools/UltiTools.java b/UltiTools-API/src/main/java/com/ultikits/ultitools/UltiTools.java
index 79fc77a..c982d2e 100755
--- a/UltiTools-API/src/main/java/com/ultikits/ultitools/UltiTools.java
+++ b/UltiTools-API/src/main/java/com/ultikits/ultitools/UltiTools.java
@@ -279,22 +279,4 @@ public static YamlConfiguration getEnv() {
}
return config;
}
-
- /**
- * get UltiTools UUID
- *
- * @return UUID
- * @throws IOException if an I/O error occurs
- */
- public static String getUltiToolsUUID() throws IOException {
- File dataFile = new File(UltiTools.getInstance().getDataFolder(), "data.json");
- JSON json = new cn.hutool.json.JSONObject();
- if (dataFile.exists()) {
- json = JSONUtil.readJSON(dataFile, StandardCharsets.UTF_8);
- } else {
- json.putByPath("uuid", IdUtil.simpleUUID());
- json.write(new FileWriter(dataFile));
- }
- return json.getByPath("uuid").toString();
- }
}
diff --git a/UltiTools-API/src/main/java/com/ultikits/ultitools/utils/CommonUtils.java b/UltiTools-API/src/main/java/com/ultikits/ultitools/utils/CommonUtils.java
new file mode 100644
index 0000000..1c2b31a
--- /dev/null
+++ b/UltiTools-API/src/main/java/com/ultikits/ultitools/utils/CommonUtils.java
@@ -0,0 +1,32 @@
+package com.ultikits.ultitools.utils;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.json.JSON;
+import cn.hutool.json.JSONUtil;
+import com.ultikits.ultitools.UltiTools;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+public class CommonUtils {
+
+ /**
+ * get UltiTools UUID
+ *
+ * @return UUID
+ * @throws IOException if an I/O error occurs
+ */
+ public static String getUltiToolsUUID() throws IOException {
+ File dataFile = new File(UltiTools.getInstance().getDataFolder(), "data.json");
+ JSON json = new cn.hutool.json.JSONObject();
+ if (dataFile.exists()) {
+ json = JSONUtil.readJSON(dataFile, StandardCharsets.UTF_8);
+ } else {
+ json.putByPath("uuid", IdUtil.simpleUUID());
+ json.write(new FileWriter(dataFile));
+ }
+ return json.getByPath("uuid").toString();
+ }
+}
diff --git a/UltiTools-API/src/main/java/com/ultikits/ultitools/utils/PluginInitiationUtils.java b/UltiTools-API/src/main/java/com/ultikits/ultitools/utils/PluginInitiationUtils.java
index 4286111..6303ecc 100644
--- a/UltiTools-API/src/main/java/com/ultikits/ultitools/utils/PluginInitiationUtils.java
+++ b/UltiTools-API/src/main/java/com/ultikits/ultitools/utils/PluginInitiationUtils.java
@@ -51,7 +51,7 @@ public static void loginAccount() throws IOException {
}
TokenEntity token = HttpRequestUtils.getToken(username, password);
- String uuid = UltiTools.getUltiToolsUUID();
+ String uuid = CommonUtils.getUltiToolsUUID();
HttpResponse uuidResponse = HttpRequestUtils.getServerByUUID(uuid, token);
int port = UltiTools.getInstance().getConfig().getInt("web-editor.port");
String domain = UltiTools.getInstance().getConfig().getString("web-editor.https.domain");