-
Notifications
You must be signed in to change notification settings - Fork 0
Server statistics
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
Server s = new Server();
Kotlin
val s = Server()
Then we can fetch the player count with .getPlayerCount();
(Java) or .playerCount
(Kotlin).
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
Server s = new Server(); // Fetch global stats
Map<Integer, String[]> staff = s.getStaffMembers(); // Get the staff members
String[] developers = staff.get(StaffIndex.DEVELOPER.getIndex()); // Get only the developers
System.out.println(developers.length); // Print the size of the array
Kotlin
val s = Server() // Fetch global stats
val staff = s.staffMembers // Get the staff members
val developers = staff[StaffIndex.DEVELOPER.index] // Get only the developers
println(developers?.size) // Print the size of the array