9
9
import cn .xiaopangxie732 .mojang_api .util .Net ;
10
10
11
11
/**
12
- * To get UUID of username.
12
+ * To get UUID of username(playername) .
13
13
* @author XiaoPangxie732
14
14
*/
15
15
public class UserName {
@@ -18,7 +18,7 @@ public class UserName {
18
18
private static Gson json = new Gson ();
19
19
20
20
/**
21
- * Get the UUID of this player name at a time.
21
+ * Get the UUID of this playername at a time.
22
22
* @param username The playername needs to get UUID.
23
23
* @param timestamp A UNIX timestamp (without milliseconds).
24
24
* @return The UUID of the name at the timestamp provided.
@@ -42,7 +42,7 @@ public static String UUIDAtTime(String username, long timestamp) throws Username
42
42
}
43
43
44
44
/**
45
- * Get the UUID of this player name at now.
45
+ * Get the UUID of this playername at now.
46
46
* @param username The playername needs to get UUID.
47
47
* @return The UUID of the name at now.
48
48
* @throws UsernameOrTimestampInvalidException When the username is invalid.
@@ -62,7 +62,7 @@ public static String UUIDAtNow(String username) throws UsernameOrTimestampInvali
62
62
}
63
63
64
64
/**
65
- * Get the UUID of this player name at original time (timestamp=0).
65
+ * Get the UUID of this playername at original time (timestamp=0).
66
66
* @param username The playername needs to get UUID.
67
67
* @return The UUID of the name at the original.
68
68
* @throws UsernameOrTimestampInvalidException When the username is invalid or playername wasn't change at least once.
@@ -73,6 +73,13 @@ public static String UUIDAtOriginal(String username) throws UsernameOrTimestampI
73
73
return UUIDAtTime (username , 0 );
74
74
}
75
75
76
+ /**
77
+ * Get the UUID of the playername(s).
78
+ * @param usernames The playername(s) needs to get UUID.
79
+ * @return The UUID(s) of the playername(s).
80
+ * @throws IllegalArgumentException When the request names reached more than 100.
81
+ * @throws IllegalArgumentException when any of the usernames is <code>null</code> or <code>""</code>.
82
+ */
76
83
public static String UUIDOfNames (String ... usernames ) throws IllegalArgumentException {
77
84
if (usernames .length > 100 ) throw new IllegalArgumentException ("Too more names! (" + usernames .length + "/100)" );
78
85
String response = Net .postConnection ("https://api.mojang.com/profiles/minecraft" , "application/json" , json .toJson (usernames ));
0 commit comments