blob: 984af7294ba51c07d826a83e62a2188ff7164c70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
package de.hype.bbsentials.client;
import de.hype.bbsentials.chat.Chat;
import de.hype.bbsentials.constants.enviromentShared.Islands;
import net.minecraft.client.MinecraftClient;
public class BBUtils {
public static Islands getCurrentIsland() {
try {
String string = MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-b").getDisplayName().getString();
if (!string.startsWith("Area: ")) {
Chat.sendPrivateMessageToSelf("§4Could not get Area data. Are you in Skyblock?");
}
else {
return Islands.getByDisplayName(string.replace("Area: ", "").trim());
}
} catch (Exception e) {
}
return null;
}
public static int getPlayerCount() {
return Integer.parseInt(MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!B-a").getDisplayName().getString().trim().replaceAll("[^0-9]", ""));
}
public static String getServer() {
return MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-c").getDisplayName().getString().replace("Server:", "").trim();
}
public static boolean isOnMegaServer() {
return getServer().toLowerCase().startsWith("mega");
}
public static boolean isOnMiniServer() {
return getServer().toLowerCase().startsWith("mini");
}
public static int getMaximumPlayerCount() {
boolean mega = isOnMegaServer();
Islands island = getCurrentIsland();
if (island == null) return 100;
if (island.equals(Islands.HUB)) {
if (mega) return 80;
else return 24;
}
return 24;
}
}
|