From bb75fd7b83b238f1f922ffc64b2a0a535c5524b7 Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Tue, 6 Jul 2021 17:13:01 -0400 Subject: Format --- .../skyblockhud/ComponentHandler.java | 282 ++++++++++++++------- 1 file changed, 186 insertions(+), 96 deletions(-) (limited to 'src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java') diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java index 3c671f00a..03bfe04aa 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -5,6 +5,9 @@ import com.google.common.collect.Ordering; import com.thatgravyboat.skyblockhud.dungeons.DungeonHandler; import com.thatgravyboat.skyblockhud.location.*; import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler; +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; @@ -17,108 +20,195 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.Comparator; -import java.util.List; -import java.util.regex.Pattern; - public class ComponentHandler { - public static final Pattern SCOREBOARD_CHARACTERS = Pattern.compile("[^]\\[a-z A-Z:0-9/'.()+\\d-§?]"); - private static final Ordering 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 players = sortingList.sortedCopy(mc.thePlayer.sendQueue.getPlayerInfoMap()); - GuiIngameForge.renderObjective = !SkyblockHud.hasSkyblockScoreboard() || !SkyblockHud.config.misc.hideScoreboard; - if (players != null && SkyblockHud.hasSkyblockScoreboard()){ + public static final Pattern SCOREBOARD_CHARACTERS = Pattern.compile( + "[^]\\[a-z A-Z:0-9/'.()+\\d-§?]" + ); + private static final Ordering sortingList = Ordering.from( + new PlayerComparator() + ); + private static int ticksExisted = 0; - 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().equals(LocationCategory.DWARVENMINES)){ - if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")){ - DwarvenMineHandler.parseMithril(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(""); - 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 + public void onClientTick(TickEvent.ClientTickEvent event) { + Minecraft mc = Minecraft.getMinecraft(); + ticksExisted++; + boolean eventPass = false; + if (mc.theWorld != null) { + List players = sortingList.sortedCopy( + mc.thePlayer.sendQueue.getPlayerInfoMap() + ); + GuiIngameForge.renderObjective = + !SkyblockHud.hasSkyblockScoreboard() || + !SkyblockHud.config.misc.hideScoreboard; + if (players != null && SkyblockHud.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() + .equals(LocationCategory.DWARVENMINES) + ) { + if ( + formattedTabListPlayer + .toLowerCase() + .contains("mithril powder:") + ) { + DwarvenMineHandler.parseMithril(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(""); + 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()); - } - } + @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 - { - private PlayerComparator() - { - } + @SideOnly(Side.CLIENT) + static class PlayerComparator implements Comparator { - 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(); - } - } + 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(); + } + } } -- cgit From a8e475fa0a7977f64f072548459d592274169d66 Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Tue, 6 Jul 2021 17:15:21 -0400 Subject: Format v2 --- .../skyblockhud/ComponentHandler.java | 398 ++++++++++++--------- 1 file changed, 224 insertions(+), 174 deletions(-) (limited to 'src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java') diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java index 03bfe04aa..ef2028dc4 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -22,193 +22,243 @@ 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 sortingList = Ordering.from( - new PlayerComparator() - ); - private static int ticksExisted = 0; + public static final Pattern SCOREBOARD_CHARACTERS = Pattern.compile( + "[^]\\[a-z A-Z:0-9/'.()+\\d-§?]" + ); + private static final Ordering 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 players = sortingList.sortedCopy( - mc.thePlayer.sendQueue.getPlayerInfoMap() - ); - GuiIngameForge.renderObjective = - !SkyblockHud.hasSkyblockScoreboard() || - !SkyblockHud.config.misc.hideScoreboard; - if (players != null && SkyblockHud.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() - .equals(LocationCategory.DWARVENMINES) - ) { - if ( - formattedTabListPlayer - .toLowerCase() - .contains("mithril powder:") - ) { - DwarvenMineHandler.parseMithril(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(""); - SeasonDateHandler.setCurrentEvent( - formattedTabListPlayer.replace("Event:", ""), - secondLine - ); - eventPass = true; + @SubscribeEvent + public void onClientTick(TickEvent.ClientTickEvent event) { + Minecraft mc = Minecraft.getMinecraft(); + ticksExisted++; + boolean eventPass = false; + if (mc.theWorld != null) { + List players = sortingList.sortedCopy( + mc.thePlayer.sendQueue.getPlayerInfoMap() + ); + GuiIngameForge.renderObjective = + !SkyblockHud.hasSkyblockScoreboard() || + !SkyblockHud.config.misc.hideScoreboard; + if (players != null && SkyblockHud.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() + .equals(LocationCategory.DWARVENMINES) + ) { + if ( + formattedTabListPlayer + .toLowerCase() + .contains("mithril powder:") + ) { + DwarvenMineHandler.parseMithril( + 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(""); + SeasonDateHandler.setCurrentEvent( + formattedTabListPlayer.replace( + "Event:", + "" + ), + secondLine + ); + eventPass = true; + } + } + } + } + if (i == 80 && !eventPass) { + SeasonDateHandler.setCurrentEvent("", ""); + } + } } - } } - } - 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) + LocationHandler + .getCurrentLocation() + .getCategory() + .equals(LocationCategory.PARK) ) { - if (formattedTabListPlayer.toLowerCase().contains("rain:")) { - ParkIslandHandler.parseRain( - formattedTabListPlayer.toLowerCase() - ); - } + 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); } - } } - } - } 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()); + @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 { + @SideOnly(Side.CLIENT) + static class PlayerComparator implements Comparator { - private PlayerComparator() {} + 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(); + 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(); + } } - } } -- cgit From c04ca523f9fb9f7adefa74587db61f76deeae9f0 Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Tue, 6 Jul 2021 17:20:49 -0400 Subject: Increase line width --- .../skyblockhud/ComponentHandler.java | 174 +++++---------------- 1 file changed, 36 insertions(+), 138 deletions(-) (limited to 'src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java') diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java index ef2028dc4..0f4713f26 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -22,12 +22,8 @@ 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 sortingList = Ordering.from( - new PlayerComparator() - ); + public static final Pattern SCOREBOARD_CHARACTERS = Pattern.compile("[^]\\[a-z A-Z:0-9/'.()+\\d-§?]"); + private static final Ordering sortingList = Ordering.from(new PlayerComparator()); private static int ticksExisted = 0; @SubscribeEvent @@ -36,65 +32,31 @@ public class ComponentHandler { ticksExisted++; boolean eventPass = false; if (mc.theWorld != null) { - List players = sortingList.sortedCopy( - mc.thePlayer.sendQueue.getPlayerInfoMap() - ); + List players = sortingList.sortedCopy(mc.thePlayer.sendQueue.getPlayerInfoMap()); GuiIngameForge.renderObjective = - !SkyblockHud.hasSkyblockScoreboard() || - !SkyblockHud.config.misc.hideScoreboard; + !SkyblockHud.hasSkyblockScoreboard() || !SkyblockHud.config.misc.hideScoreboard; if (players != null && SkyblockHud.hasSkyblockScoreboard()) { if (ticksExisted % 60 == 0) { for (NetworkPlayerInfo player : players) { if (player.getDisplayName() != null) { String formattedTabListPlayer = SCOREBOARD_CHARACTERS - .matcher( - Utils.removeColor( - player - .getDisplayName() - .getFormattedText() - ) - ) + .matcher(Utils.removeColor(player.getDisplayName().getFormattedText())) .replaceAll(""); - if ( - LocationHandler - .getCurrentLocation() - .equals(Locations.CATACOMBS) - ) { + if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { if ( - formattedTabListPlayer - .toLowerCase() - .contains("secrets found:") - ) DungeonHandler.parseTotalSecrets( - formattedTabListPlayer - ); + formattedTabListPlayer.toLowerCase().contains("secrets found:") + ) DungeonHandler.parseTotalSecrets(formattedTabListPlayer); if ( - formattedTabListPlayer - .toLowerCase() - .contains("deaths:") - ) DungeonHandler.parseDeaths( - formattedTabListPlayer - ); + formattedTabListPlayer.toLowerCase().contains("deaths:") + ) DungeonHandler.parseDeaths(formattedTabListPlayer); if ( - formattedTabListPlayer - .toLowerCase() - .contains("crypts:") - ) DungeonHandler.parseCrypts( - formattedTabListPlayer - ); + formattedTabListPlayer.toLowerCase().contains("crypts:") + ) DungeonHandler.parseCrypts(formattedTabListPlayer); } else if ( - LocationHandler - .getCurrentLocation() - .getCategory() - .equals(LocationCategory.DWARVENMINES) + LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.DWARVENMINES) ) { - if ( - formattedTabListPlayer - .toLowerCase() - .contains("mithril powder:") - ) { - DwarvenMineHandler.parseMithril( - formattedTabListPlayer - ); + if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")) { + DwarvenMineHandler.parseMithril(formattedTabListPlayer); } } else if ( LocationHandler @@ -102,18 +64,11 @@ public class ComponentHandler { .getCategory() .equals(LocationCategory.MUSHROOMDESERT) ) { - if ( - formattedTabListPlayer - .toLowerCase() - .contains("pelts:") - ) { + if (formattedTabListPlayer.toLowerCase().contains("pelts:")) { try { FarmingIslandHandler.pelts = Integer.parseInt( - formattedTabListPlayer - .toLowerCase() - .replace("pelts:", "") - .trim() + formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim() ); } catch (Exception ignored) {} } @@ -124,42 +79,20 @@ public class ComponentHandler { 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() - ) - ) + .matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())) .replaceAll(""); - if ( - formattedTabListPlayer - .toLowerCase() - .contains("event:") - ) { + if (formattedTabListPlayer.toLowerCase().contains("event:")) { if (i < 80) { - if ( - players - .get(i + 1) - .getDisplayName() != - null - ) { + if (players.get(i + 1).getDisplayName() != null) { String secondLine = SCOREBOARD_CHARACTERS .matcher( Utils.removeColor( - players - .get(i + 1) - .getDisplayName() - .getFormattedText() + players.get(i + 1).getDisplayName().getFormattedText() ) ) .replaceAll(""); SeasonDateHandler.setCurrentEvent( - formattedTabListPlayer.replace( - "Event:", - "" - ), + formattedTabListPlayer.replace("Event:", ""), secondLine ); eventPass = true; @@ -173,39 +106,16 @@ public class ComponentHandler { } } } - if ( - LocationHandler - .getCurrentLocation() - .getCategory() - .equals(LocationCategory.PARK) - ) { + 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() - ) - ) + .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() - ); + if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK)) { + if (formattedTabListPlayer.toLowerCase().contains("rain:")) { + ParkIslandHandler.parseRain(formattedTabListPlayer.toLowerCase()); } } } @@ -221,9 +131,9 @@ public class ComponentHandler { @SubscribeEvent(priority = EventPriority.HIGHEST) public void onStatusBar(ClientChatReceivedEvent event) { if (event.type == 2) { - if ( - LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS) - ) DungeonHandler.parseSecrets(event.message.getFormattedText()); + if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) DungeonHandler.parseSecrets( + event.message.getFormattedText() + ); } } @@ -232,32 +142,20 @@ public class ComponentHandler { private PlayerComparator() {} - public int compare( - NetworkPlayerInfo p_compare_1_, - NetworkPlayerInfo p_compare_2_ - ) { + 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() - : "" + p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, + p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR ) .compare( - p_compare_1_.getGameProfile().getName(), - p_compare_2_.getGameProfile().getName() + scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", + scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "" ) + .compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()) .result(); } } -- cgit From 98ee5a2ae8090c061b1e61e7955d793416991822 Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Tue, 6 Jul 2021 17:24:20 -0400 Subject: 140? --- .../skyblockhud/ComponentHandler.java | 47 +++++++--------------- 1 file changed, 15 insertions(+), 32 deletions(-) (limited to 'src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java') diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java index 0f4713f26..ad7b1e8c3 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -33,8 +33,7 @@ public class ComponentHandler { boolean eventPass = false; if (mc.theWorld != null) { List players = sortingList.sortedCopy(mc.thePlayer.sendQueue.getPlayerInfoMap()); - GuiIngameForge.renderObjective = - !SkyblockHud.hasSkyblockScoreboard() || !SkyblockHud.config.misc.hideScoreboard; + GuiIngameForge.renderObjective = !SkyblockHud.hasSkyblockScoreboard() || !SkyblockHud.config.misc.hideScoreboard; if (players != null && SkyblockHud.hasSkyblockScoreboard()) { if (ticksExisted % 60 == 0) { for (NetworkPlayerInfo player : players) { @@ -43,33 +42,24 @@ public class ComponentHandler { .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().equals(LocationCategory.DWARVENMINES) - ) { + 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().equals(LocationCategory.DWARVENMINES)) { if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")) { DwarvenMineHandler.parseMithril(formattedTabListPlayer); } - } else if ( - LocationHandler - .getCurrentLocation() - .getCategory() - .equals(LocationCategory.MUSHROOMDESERT) - ) { + } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { if (formattedTabListPlayer.toLowerCase().contains("pelts:")) { try { FarmingIslandHandler.pelts = - Integer.parseInt( - formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim() - ); + Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim()); } catch (Exception ignored) {} } } @@ -85,16 +75,9 @@ public class ComponentHandler { if (i < 80) { if (players.get(i + 1).getDisplayName() != null) { String secondLine = SCOREBOARD_CHARACTERS - .matcher( - Utils.removeColor( - players.get(i + 1).getDisplayName().getFormattedText() - ) - ) + .matcher(Utils.removeColor(players.get(i + 1).getDisplayName().getFormattedText())) .replaceAll(""); - SeasonDateHandler.setCurrentEvent( - formattedTabListPlayer.replace("Event:", ""), - secondLine - ); + SeasonDateHandler.setCurrentEvent(formattedTabListPlayer.replace("Event:", ""), secondLine); eventPass = true; } } -- cgit From 804767ebfc26e2a1252bc327def02389b35dfc6e Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Tue, 6 Jul 2021 17:27:11 -0400 Subject: fine --- .../skyblockhud/ComponentHandler.java | 48 +++++----------------- 1 file changed, 10 insertions(+), 38 deletions(-) (limited to 'src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java') diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java index ad7b1e8c3..d56fd30d8 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -38,19 +38,11 @@ public class ComponentHandler { if (ticksExisted % 60 == 0) { for (NetworkPlayerInfo player : players) { if (player.getDisplayName() != null) { - String formattedTabListPlayer = SCOREBOARD_CHARACTERS - .matcher(Utils.removeColor(player.getDisplayName().getFormattedText())) - .replaceAll(""); + 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 - ); + 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().equals(LocationCategory.DWARVENMINES)) { if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")) { DwarvenMineHandler.parseMithril(formattedTabListPlayer); @@ -58,8 +50,7 @@ public class ComponentHandler { } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { if (formattedTabListPlayer.toLowerCase().contains("pelts:")) { try { - FarmingIslandHandler.pelts = - Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim()); + FarmingIslandHandler.pelts = Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim()); } catch (Exception ignored) {} } } @@ -68,15 +59,11 @@ public class ComponentHandler { 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(""); + 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(""); + String secondLine = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i + 1).getDisplayName().getFormattedText())).replaceAll(""); SeasonDateHandler.setCurrentEvent(formattedTabListPlayer.replace("Event:", ""), secondLine); eventPass = true; } @@ -93,9 +80,7 @@ public class ComponentHandler { 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(""); + 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()); @@ -114,9 +99,7 @@ public class ComponentHandler { @SubscribeEvent(priority = EventPriority.HIGHEST) public void onStatusBar(ClientChatReceivedEvent event) { if (event.type == 2) { - if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) DungeonHandler.parseSecrets( - event.message.getFormattedText() - ); + if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) DungeonHandler.parseSecrets(event.message.getFormattedText()); } } @@ -128,18 +111,7 @@ public class ComponentHandler { 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(); + 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(); } } } -- cgit