From ce208c31079689527a489eab2b54765591a8507f Mon Sep 17 00:00:00 2001 From: hackthetime Date: Wed, 8 Nov 2023 12:45:33 +0100 Subject: added Island detection to 1.8.9 --- .../java/de/hype/bbsentials/forge/BBUtils.java | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java b/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java index 3acf95e..c7d2e22 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/BBUtils.java @@ -1,24 +1,25 @@ package de.hype.bbsentials.forge; import com.google.common.collect.Lists; +import de.hype.bbsentials.common.chat.Chat; import de.hype.bbsentials.common.constants.enviromentShared.Islands; +import net.minecraft.client.Minecraft; import java.util.List; public class BBUtils implements de.hype.bbsentials.common.mclibraries.BBUtils { public Islands getCurrentIsland() { -// try { -// String string = MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-b").getDisplayName().getString(); -// if (!string.startsWith("Area: ")) { -// Chat.sendPrivateMessageToSelfError("Could not get Area data. Are you in Skyblock?"); -// } -// else { -// return Islands.getByDisplayName(string.replace("Area: ", "").trim()); -// } -// } catch (Exception e) { -// } -// return null; - return Islands.PRIVATE_ISLAND; + try { + String string = Minecraft.getMinecraft().getNetHandler().getPlayerInfo("!C-b").getDisplayName().getUnformattedText(); + if (!string.startsWith("Area: ")) { + Chat.sendPrivateMessageToSelfError("Could not get Area data. Are you in Skyblock?"); + } + else { + return Islands.getByDisplayName(string.replace("Area: ", "").trim()); + } + } catch (Exception e) { + } + return null; } public int getPlayerCount() { -- cgit