|
4 | 4 | import pl.stachu540.hirezstudios.games.Paladins; |
5 | 5 | import pl.stachu540.hirezstudios.games.Smite; |
6 | 6 |
|
| 7 | +import java.util.Arrays; |
| 8 | + |
7 | 9 | /** |
8 | 10 | * @author Damian Staszewski <[email protected]> |
9 | 11 | * @since 1.8 |
10 | 12 | */ |
11 | 13 | public class HiRezAPI { |
| 14 | + /** |
| 15 | + * Developer ID (DevId) |
| 16 | + * @see HiRezAPI#HiRezAPI(String, String) |
| 17 | + */ |
12 | 18 | private final String devId; |
| 19 | + /** |
| 20 | + * Authorization Key (AuthKey) |
| 21 | + * @see HiRezAPI#HiRezAPI(String, String) |
| 22 | + */ |
13 | 23 | private final String authKey; |
14 | 24 |
|
| 25 | + /** |
| 26 | + * Smite API |
| 27 | + * @see Smite |
| 28 | + */ |
15 | 29 | public Smite smite; |
| 30 | + /** |
| 31 | + * Paladins API |
| 32 | + * @see Paladins |
| 33 | + */ |
16 | 34 | public Paladins paladins; |
17 | 35 |
|
| 36 | + /** |
| 37 | + * Initialize Hi-Rez API. All stuff will delivered by Hi-Rez employer via E-Mail. |
| 38 | + * Please fill <a href="https://fs12.formsite.com/HiRez/form48/secure_index.html">this form first</a> to using script. |
| 39 | + * After acceptation your request, you can proceed to action. |
| 40 | + * @param devId Developer ID (DevId) |
| 41 | + * @param authKey Authorization Key (AuthKey) |
| 42 | + */ |
18 | 43 | public HiRezAPI(@NotNull String devId, @NotNull String authKey) { |
19 | 44 | this.devId = devId; |
20 | 45 | this.authKey = authKey; |
| 46 | + setPlatform("pc"); |
21 | 47 | } |
22 | 48 |
|
23 | | - public String getDevId() { |
24 | | - return devId; |
25 | | - } |
26 | | - |
27 | | - public String getAuthKey() { |
28 | | - return authKey; |
| 49 | + /** |
| 50 | + * Before using variables {@link #smite} and {@link #paladins} define platform first. (Default platform is "PC") |
| 51 | + * You can use it with variables mentioned above. |
| 52 | + * Example: |
| 53 | + * <blockqote> |
| 54 | + * HiRezAPI hirez = new HiRezAPI("1004","23DF3C7E9BD14D84BF892AD206B6755C"); |
| 55 | + * hirez.setPlatform("xbox").smite.getPlayer("stachu Official"); |
| 56 | + * </blockquote> |
| 57 | + * @param platform Platform name <b>PC</b>/<b>XBOX</b>/<b>PS4</b> |
| 58 | + */ |
| 59 | + public HiRezAPI setPlatform(String platform) { |
| 60 | + smite = new Smite(devId, authKey, Arrays.stream(Smite.Endpoint.values()) |
| 61 | + .filter(endpoint -> (endpoint.name().toLowerCase().equals(platform.toLowerCase()))).findFirst().get()); |
| 62 | + paladins = new Paladins(devId, authKey, Arrays.stream(Paladins.Endpoint.values()) |
| 63 | + .filter(endpoint -> endpoint.name().toLowerCase().equals(platform.toLowerCase())).findFirst().get()); |
| 64 | + return this; |
29 | 65 | } |
30 | 66 | } |
0 commit comments