aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/xmrvizzy/skyblocker/utils/Utils.java
blob: d305370e9420b5d632c9cdfea6f2986d608c4c29 (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
package me.xmrvizzy.skyblocker.utils;

import net.minecraft.client.MinecraftClient;
import net.minecraft.scoreboard.ScoreboardObjective;
import net.minecraft.text.Text;

public class Utils {
    public static boolean isSkyblock() {
        MinecraftClient client = MinecraftClient.getInstance();
        if (client != null && client.world != null && !client.isInSingleplayer()) {
            ScoreboardObjective scoreboard = client.world.getScoreboard().getObjectiveForSlot(1);
            if (scoreboard != null) {
                String name = "";
                for (Text text : scoreboard.getDisplayName().getSiblings()) {
                    name += text.getString();
                }
                if (name.contains("SKYBLOCK")) {
                    return true;
                }
            }
        }
        return false;
    }
}