You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RoccoDev edited this page May 25, 2018
·
2 revisions
If you were to fetch the global Hive statistics (e.g, the player count), you would need to use the Server object.
You can instantiate it directly:
Java
Servers = newServer();
Kotlin
val s =Server()
Then we can fetch the player count with .getPlayerCount(); (Java) or .playerCount (Kotlin).
Staff API
You can get the current staff members with the getStaffMembers method.
This will return a Map<Integer, String[]> containing the UUIDs of the members, mapped by rank.
Human-friendly indexes can be found in the StaffIndex enum.
For example, if you were to fetch how many developers are currently in the team, you would do:
Java
Servers = newServer(); // Fetch global statsMap<Integer, String[]> staff = s.getStaffMembers(); // Get the staff membersString[] developers = staff.get(StaffIndex.DEVELOPER.getIndex()); // Get only the developersSystem.out.println(developers.length); // Print the size of the array
Kotlin
val s =Server() // Fetch global statsval staff = s.staffMembers // Get the staff membersval developers = staff[StaffIndex.DEVELOPER.index] // Get only the developersprintln(developers?.size) // Print the size of the array