aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hype/bbsentials/client/BBUtils.java
blob: 284738ad43ba93cafe2551b39a2ceba48914e12d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
    }
}