Skip to content

Commit e3ee4a5

Browse files
author
wuliao97
committed
3rd commit
1 parent 432e47e commit e3ee4a5

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

readme.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,46 @@
44
- json
55

66

7+
# Sample Code
8+
```Java
9+
package org.API;
10+
11+
import org.API.core.MihomoAPI;
12+
import org.API.core.jsonObject;
13+
14+
import java.io.IOException;
15+
16+
public class Sample {
17+
public static void main(String[] args) throws IOException, InterruptedException {
18+
MihomoAPI mihomoAPI = new MihomoAPI();
19+
mihomoAPI.setUID("801671759");
20+
21+
jsonObject result = mihomoAPI.getResult();
22+
System.out.println("UID: " + result.player.uid);
23+
System.out.println("NickName: " + result.player.nickname);
24+
System.out.println("Icon: " + mihomoAPI.getIconUrl(result.player.avatar.icon));
25+
System.out.println("achievement: " + result.player.space_info.achievement_count);
26+
27+
System.out.println("\n----- Characters -----\n");
28+
29+
for (final jsonObject.Characters character : result.characters){
30+
System.out.println("Name: " + character.name);
31+
System.out.println("Level: " + character.level);
32+
33+
for (final var relic : character.relics) {
34+
System.out.println("- relicName: " + relic.name + " | " + relic.main_affix.name + ": " + relic.main_affix.display);
35+
36+
StringBuilder sb = new StringBuilder();
37+
for (final var relic2 : relic.sub_affix) {
38+
sb.append(" - ").append(relic2.name).append(":").append(relic2.display).append("\n");
39+
}
40+
System.out.print(sb.toString());
41+
}
42+
}
43+
}
44+
}
45+
```
46+
747
# output
848
```
949
UID: 801671759

src/main/java/org/Sample.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public static void main(String[] args) throws IOException, InterruptedException
1818

1919
System.out.println("\n----- Characters -----\n");
2020

21-
2221
for (final jsonObject.Characters character : result.characters){
2322
System.out.println("Name: " + character.name);
2423
System.out.println("Level: " + character.level);

0 commit comments

Comments
 (0)