|
7 | 7 | import java.util.Set; |
8 | 8 |
|
9 | 9 | public class SimpleClientAPI { |
10 | | - public static final String MIN_SUPPORTED_VERSION = "0.2.6"; |
| 10 | + /** |
| 11 | + * Minimum SimpleClient version supported by the plugin |
| 12 | + */ |
| 13 | + public static final String MIN_SUPPORTED_VERSION = "0.2.7"; |
11 | 14 | private static final Set<Player> simpleClientPlayers = new HashSet<>(); |
12 | 15 | private static final Set<Player> blockingPlayers = new HashSet<>(); |
13 | 16 | private static boolean legacyPvPEnabled = false; |
14 | 17 |
|
| 18 | + /** |
| 19 | + * Checks if a player is using SimpleClient |
| 20 | + * @param player The player |
| 21 | + * @return True if the player is using SimpleClient |
| 22 | + */ |
15 | 23 | public static boolean isUsingSimpleClient(Player player) { |
16 | 24 | return simpleClientPlayers.contains(player); |
17 | 25 | } |
18 | 26 |
|
| 27 | + /** |
| 28 | + * Checks if a player is using SimpleClient and blocking with a sword |
| 29 | + * @param player The player |
| 30 | + * @return True if the player is using SimpleClient and blocking with a sword |
| 31 | + */ |
19 | 32 | public static boolean isBlockingWithSword(Player player) { |
20 | 33 | return isUsingSimpleClient(player) && blockingPlayers.contains(player); |
21 | 34 | } |
22 | 35 |
|
| 36 | + /** |
| 37 | + * Gets the players who are using SimpleClient |
| 38 | + * @return Set of players who are using SimpleClient |
| 39 | + */ |
23 | 40 | public static Set<Player> getSimpleClientPlayers() { |
24 | 41 | return simpleClientPlayers; |
25 | 42 | } |
26 | 43 |
|
| 44 | + /** |
| 45 | + * Gets the players who are using SimpleClient and blocking with a sword |
| 46 | + * @return Set of players who are using SimpleClient and blocking with a sword |
| 47 | + */ |
27 | 48 | public static Set<Player> getBlockingPlayers() { |
28 | 49 | return blockingPlayers; |
29 | 50 | } |
30 | 51 |
|
| 52 | + /** |
| 53 | + * Weather legacy PvP is enabled or not |
| 54 | + * @return True if legacy PvP is enabled |
| 55 | + */ |
31 | 56 | public static boolean isLegacyPvPEnabled() { |
32 | 57 | return legacyPvPEnabled; |
33 | 58 | } |
34 | 59 |
|
| 60 | + /** |
| 61 | + * Enabled or disables legacy PvP |
| 62 | + * @param enabled Weather legacy PvP should be enabled or not |
| 63 | + */ |
35 | 64 | public static void setLegacyPvPEnabled(boolean enabled) { |
36 | 65 | legacyPvPEnabled = enabled; |
37 | 66 | if (!enabled) { |
|
0 commit comments