aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java
diff options
context:
space:
mode:
authorTymanWasTaken <tyman@tyman.tech>2021-07-06 17:20:49 -0400
committerTymanWasTaken <tyman@tyman.tech>2021-07-06 17:20:49 -0400
commitc04ca523f9fb9f7adefa74587db61f76deeae9f0 (patch)
treef148e7bcd9105813d3fe781badcb2cf3892712fd /src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java
parenta8e475fa0a7977f64f072548459d592274169d66 (diff)
downloadSkyblockHud-Death-Defied-c04ca523f9fb9f7adefa74587db61f76deeae9f0.tar.gz
SkyblockHud-Death-Defied-c04ca523f9fb9f7adefa74587db61f76deeae9f0.tar.bz2
SkyblockHud-Death-Defied-c04ca523f9fb9f7adefa74587db61f76deeae9f0.zip
Increase line width
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java174
1 files changed, 36 insertions, 138 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java
index ef2028d..0f4713f 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<NetworkPlayerInfo> sortingList = Ordering.from(
- new PlayerComparator()
- );
+ 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
@@ -36,65 +32,31 @@ public class ComponentHandler {
ticksExisted++;
boolean eventPass = false;
if (mc.theWorld != null) {
- List<NetworkPlayerInfo> players = sortingList.sortedCopy(
- mc.thePlayer.sendQueue.getPlayerInfoMap()
- );
+ List<NetworkPlayerInfo> 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();
}
}