aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2022-05-21 21:18:14 +0900
committersyeyoung <cyoung06@naver.com>2022-05-21 21:28:52 +0900
commit20dd3f99a7b139b5848128246c622fd9cfefa478 (patch)
tree78e5f84ad22fd53876d488f6b58c3528aebe6501 /src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java
parent50de034c046c4ddea033b73793c8825ecb5bb86f (diff)
downloadSkyblock-Dungeons-Guide-20dd3f99a7b139b5848128246c622fd9cfefa478.tar.gz
Skyblock-Dungeons-Guide-20dd3f99a7b139b5848128246c622fd9cfefa478.tar.bz2
Skyblock-Dungeons-Guide-20dd3f99a7b139b5848128246c622fd9cfefa478.zip
- Project separation
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java123
1 files changed, 0 insertions, 123 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java b/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java
deleted file mode 100755
index 7e2286b3..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide;
-
-import com.google.common.collect.Sets;
-import kr.syeyoung.dungeonsguide.commands.*;
-import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry;
-import kr.syeyoung.dungeonsguide.utils.TextUtils;
-import lombok.Getter;
-import lombok.Setter;
-import net.minecraft.client.Minecraft;
-import net.minecraft.scoreboard.*;
-import net.minecraftforge.client.ClientCommandHandler;
-import net.minecraftforge.common.MinecraftForge;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.NoSuchPaddingException;
-import java.io.File;
-import java.io.IOException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.util.Collection;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class SkyblockStatus {
- @Getter
- private boolean isOnSkyblock;
- private boolean isOnDungeon;
-
- public boolean isOnDungeon() {
- return forceIsOnDungeon || isOnDungeon;
- }
-
- @Getter @Setter
- private boolean forceIsOnDungeon;
-
- @Getter
- @Setter
- private DungeonContext context;
-
- @Getter
- @Setter
- private int percentage;
-
- @Getter @Setter
- private String dungeonName;
-
- public boolean isOnHypixel() {
- Minecraft mc = Minecraft.getMinecraft();
- if (mc == null || mc.thePlayer == null) return false;
- if (!mc.isSingleplayer() && mc.thePlayer.getClientBrand() != null) {
- return mc.thePlayer.getClientBrand().startsWith("Hypixel BungeeCord");
- }
- return false;
- }
-
- private static final Set<String> SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet("SKYBLOCK");
-
- public void updateStatus() {
- if (!isOnHypixel()) {
- isOnDungeon = false;
- isOnSkyblock = false;
- return;
- }
-
- Scoreboard scoreboard = Minecraft.getMinecraft().thePlayer.getWorldScoreboard();
- ScoreObjective scoreObjective = scoreboard.getObjectiveInDisplaySlot(1);
- if (scoreObjective == null) return;
-
- String objectiveName = TextUtils.stripColor(scoreObjective.getDisplayName());
- boolean skyblockFound = false;
- for (String skyblock : SKYBLOCK_IN_ALL_LANGUAGES) {
- if (objectiveName.startsWith(skyblock)) {
- skyblockFound = true;
- isOnSkyblock = true;
- break;
- }
- }
-
- if (!skyblockFound) {
- isOnSkyblock = false;
- isOnDungeon = false;
- return;
- }
-
- Collection<Score> scores = scoreboard.getSortedScores(scoreObjective);
- boolean foundDungeon = false;
- for (Score sc:scores) {
- ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName());
- String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim();
- if (strippedLine.contains("Cleared: ")) {
- foundDungeon = true;
- percentage = Integer.parseInt(strippedLine.substring(9).split(" ")[0]);
- }
- if (ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()).startsWith(" §7⏣")) {
- dungeonName = strippedLine.trim();
- }
- }
-
- isOnDungeon = foundDungeon;
- }
-}