Skip to content

Commit

Permalink
Merge pull request #41 from UltiKits/alpha
Browse files Browse the repository at this point in the history
2023/12/26更新 API版本6.0.2
  • Loading branch information
wisdommen authored Dec 26, 2023
2 parents 608e210 + 034d74b commit 5a5d2c7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Home/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>com.ultikits</groupId>
<artifactId>UltiTools-API</artifactId>
<version>6.0.0.202312150106</version>
<version>6.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion UltiTools-API/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>UltiTools-API</artifactId>
<groupId>com.ultikits</groupId>
<version>6.0.1</version>
<version>6.0.2</version>
<modelVersion>4.0.0</modelVersion>
<name>UltiTools-API</name>
<description>This project is the base of the Ultitools plugin development.</description>
Expand Down
18 changes: 0 additions & 18 deletions UltiTools-API/src/main/java/com/ultikits/ultitools/UltiTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 5a5d2c7

Please sign in to comment.