Skip to content
This repository was archived by the owner on May 23, 2025. It is now read-only.

Commit 8f87efb

Browse files
committed
更新
1 parent 85406ac commit 8f87efb

File tree

8 files changed

+27
-82
lines changed

8 files changed

+27
-82
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public class Main implements CommandExecutor, Listener {
136136
<dependency>
137137
<groupId>top.qscraft</groupId>
138138
<artifactId>dodoopenjava</artifactId>
139-
<version>3.2.7</version>
139+
<version>3.2.8-SNAPSHOT</version>
140140
</dependency>
141141
</dependencies>
142142
```
@@ -149,7 +149,7 @@ public class Main implements CommandExecutor, Listener {
149149
}
150150
151151
dependencies {
152-
implementation 'top.qscraft:dodoopenjava:3.2.7'
152+
implementation 'top.qscraft:dodoopenjava:3.2.8-SNAPSHOT'
153153
}
154154
```
155155
### 教程(过于古老,无参考价值,改日重写)

src/main/java/io/github/minecraftchampions/dodoopenjava/ApiResultsLogger.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
/**
1616
* 记录API调用的日志
17+
*
1718
* @author qscbm187531
1819
*/
1920
@RequiredArgsConstructor(access = AccessLevel.PROTECTED)

src/main/java/io/github/minecraftchampions/dodoopenjava/Bot.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
/**
2626
* 机器人实例
27+
*
2728
* @author qscbm187531
2829
*/
2930
@Getter

src/main/java/io/github/minecraftchampions/dodoopenjava/DodoOpenJava.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
/**
1313
* API
14+
*
1415
* @author qscbm187531
1516
*/
1617
@Slf4j
@@ -35,7 +36,7 @@ public static synchronized Bot createBot(@NonNull String clientId, @NonNull Stri
3536
}
3637

3738
public static List<Bot> getBotList() {
38-
return BaseUtil.castList(BOT_LIST.clone(),Bot.class);
39+
return BaseUtil.castList(BOT_LIST.clone(), Bot.class);
3940
}
4041

4142

src/main/java/io/github/minecraftchampions/dodoopenjava/Result.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/**
1111
* api结果
12+
*
1213
* @author qscbm187531
1314
*/
1415
@Data

src/main/java/io/github/minecraftchampions/dodoopenjava/utils/BaseUtil.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ public static List<Node> getAllTextNodes(@NonNull Node node) {
101101
return result;
102102
}
103103

104-
104+
/**
105+
* 转Object转为List
106+
*
107+
* @param obj 对象
108+
* @param clazz List包含的对象的类
109+
* @param <T> 泛型
110+
* @return List<T>
111+
*/
105112
public static <T> List<T> castList(Object obj, Class<T> clazz) {
106113
List<T> result = new ArrayList<>();
107114
if (obj instanceof List<?>) {

src/main/java/io/github/minecraftchampions/dodoopenjava/utils/NumberUtil.java

Lines changed: 0 additions & 76 deletions
This file was deleted.

src/main/java/io/github/minecraftchampions/dodoopenjava/utils/OpenSecretUtil.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,18 @@ private static String aesDecrypt(byte[] payload, byte[] secretKey, byte[] iv, Ci
5757
* @return 字节数组
5858
*/
5959
private static byte[] hexToBytes(String hex) {
60-
byte[] result = new byte[hex.length() / 2];
61-
for (int i = 0; i < hex.length() / 2; i++) {
60+
int hexLen = hex.length();
61+
int arrayLen = hexLen / 2;
62+
boolean isOdd = hexLen % 2 == 1;
63+
byte[] result;
64+
if (isOdd) {
65+
arrayLen++;
66+
result = new byte[arrayLen];
67+
hex = "0" + hex;
68+
} else {
69+
result = new byte[arrayLen];
70+
}
71+
for (int i = 0; i < arrayLen; i++) {
6272
int high = Integer.parseInt(hex.substring(i * 2, i * 2 + 1), 16);
6373
int low = Integer.parseInt(hex.substring(i * 2 + 1, i * 2 + 2), 16);
6474
result[i] = (byte) (high * 16 + low);

0 commit comments

Comments
 (0)