aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud_2/ComponentHandler.java
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-08 16:12:55 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-08 16:12:55 +0200
commit4463c7fa78f886a8abc09e867dd17cde2a685ad4 (patch)
tree9245b4eed7f410f1c168688a77eeda6bfd55c994 /src/main/java/com/thatgravyboat/skyblockhud_2/ComponentHandler.java
parent9e08dbf2baa9819abd281ad285df7462c99491e2 (diff)
downloadskyhanni-4463c7fa78f886a8abc09e867dd17cde2a685ad4.tar.gz
skyhanni-4463c7fa78f886a8abc09e867dd17cde2a685ad4.tar.bz2
skyhanni-4463c7fa78f886a8abc09e867dd17cde2a685ad4.zip
code cleanup
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud_2/ComponentHandler.java')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud_2/ComponentHandler.java124
1 files changed, 124 insertions, 0 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud_2/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud_2/ComponentHandler.java
new file mode 100644
index 000000000..5677a7382
--- /dev/null
+++ b/src/main/java/com/thatgravyboat/skyblockhud_2/ComponentHandler.java
@@ -0,0 +1,124 @@
+//package com.thatgravyboat.skyblockhud;
+//
+//import at.lorenz.mod.LorenzMod;
+//import com.google.common.collect.ComparisonChain;
+//import com.google.common.collect.Ordering;
+//import com.thatgravyboat.skyblockhud.dungeons.DungeonHandler;
+//import com.thatgravyboat.skyblockhud.location.*;
+//import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler;
+//import com.thatgravyboat.skyblockhud.utils.Utils;
+//import java.util.Comparator;
+//import java.util.List;
+//import java.util.regex.Pattern;
+//import net.minecraft.client.Minecraft;
+//import net.minecraft.client.network.NetworkPlayerInfo;
+//import net.minecraft.scoreboard.ScorePlayerTeam;
+//import net.minecraft.world.WorldSettings;
+//import net.minecraftforge.client.GuiIngameForge;
+//import net.minecraftforge.client.event.ClientChatReceivedEvent;
+//import net.minecraftforge.fml.common.eventhandler.EventPriority;
+//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+//import net.minecraftforge.fml.common.gameevent.TickEvent;
+//import net.minecraftforge.fml.relauncher.Side;
+//import net.minecraftforge.fml.relauncher.SideOnly;
+//
+//public class ComponentHandler {
+//
+// public static final Pattern SCOREBOARD_CHARACTERS = Pattern.compile("[^]\\[a-z A-Z:0-9/'.()+\\d-ยง?]");
+// private static final Ordering<NetworkPlayerInfo> sortingList = Ordering.from(new PlayerComparator());
+// private static int ticksExisted = 0;
+//
+// @SubscribeEvent
+// public void onClientTick(TickEvent.ClientTickEvent event) {
+// Minecraft mc = Minecraft.getMinecraft();
+// ticksExisted++;
+// boolean eventPass = false;
+// if (mc.theWorld != null) {
+// List<NetworkPlayerInfo> players = sortingList.sortedCopy(mc.thePlayer.sendQueue.getPlayerInfoMap());
+// GuiIngameForge.renderObjective = !LorenzMod.hasSkyblockScoreboard() || !LorenzMod.config.misc.hideScoreboard;
+// if (players != null && LorenzMod.hasSkyblockScoreboard()) {
+// if (ticksExisted % 60 == 0) {
+// for (NetworkPlayerInfo player : players) {
+// if (player.getDisplayName() != null) {
+// String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(player.getDisplayName().getFormattedText())).replaceAll("");
+// if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) {
+// if (formattedTabListPlayer.toLowerCase().contains("secrets found:")) DungeonHandler.parseTotalSecrets(formattedTabListPlayer);
+// if (formattedTabListPlayer.toLowerCase().contains("deaths:")) DungeonHandler.parseDeaths(formattedTabListPlayer);
+// if (formattedTabListPlayer.toLowerCase().contains("crypts:")) DungeonHandler.parseCrypts(formattedTabListPlayer);
+// } else if (LocationHandler.getCurrentLocation().getCategory().isMiningCategory()) {
+// if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")) {
+// MinesHandler.parseMithril(formattedTabListPlayer);
+// }
+// if (formattedTabListPlayer.toLowerCase().contains("gemstone powder:")) {
+// MinesHandler.parseGemstone(formattedTabListPlayer);
+// }
+// } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) {
+// if (formattedTabListPlayer.toLowerCase().contains("pelts:")) {
+// try {
+// FarmingIslandHandler.pelts = Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim());
+// } catch (Exception ignored) {}
+// }
+// }
+// }
+// }
+// if (players.size() > 80) {
+// for (int i = 61; i <= 80; i++) {
+// if (players.get(i).getDisplayName() != null) {
+// String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())).replaceAll("");
+// if (formattedTabListPlayer.toLowerCase().contains("event:")) {
+// if (i < 80) {
+// if (players.get(i + 1).getDisplayName() != null) {
+// String secondLine = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i + 1).getDisplayName().getFormattedText())).replaceAll("");
+// if (!formattedTabListPlayer.contains("N/A")) {
+// SeasonDateHandler.setCurrentEvent(formattedTabListPlayer.replace("Event:", ""), secondLine);
+// eventPass = true;
+// }
+// }
+// }
+// }
+// }
+// if (i == 80 && !eventPass) {
+// SeasonDateHandler.setCurrentEvent("", "");
+// }
+// }
+// }
+// }
+// if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK)) {
+// if (players.size() >= 80) {
+// for (int i = 41; i <= 60; i++) {
+// if (players.get(i).getDisplayName() != null) {
+// String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())).replaceAll("");
+// if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK)) {
+// if (formattedTabListPlayer.toLowerCase().contains("rain:")) {
+// ParkIslandHandler.parseRain(formattedTabListPlayer.toLowerCase());
+// }
+// }
+// }
+// }
+// }
+// } else if (ParkIslandHandler.isRaining()) {
+// ParkIslandHandler.parseRain(null);
+// }
+// }
+// }
+// }
+//
+// @SubscribeEvent(priority = EventPriority.HIGHEST)
+// public void onStatusBar(ClientChatReceivedEvent event) {
+// if (event.type == 2) {
+// if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) DungeonHandler.parseSecrets(event.message.getFormattedText());
+// }
+// }
+//
+// @SideOnly(Side.CLIENT)
+// static class PlayerComparator implements Comparator<NetworkPlayerInfo> {
+//
+// private PlayerComparator() {}
+//
+// public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) {
+// ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam();
+// ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam();
+// return ComparisonChain.start().compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result();
+// }
+// }
+//}