diff options
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java | 648 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java | 13 |
2 files changed, 389 insertions, 272 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java index 94dbdc1e..75ad33a2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java @@ -75,7 +75,12 @@ public class MiningPage extends GuiProfileViewerPage { if (levelObjhotm == null) { float hotmXp = Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.experience"), 0); levelObjhotm = - ProfileViewer.getLevel(Utils.getElementOrDefault(leveling, "HOTM", new JsonArray()).getAsJsonArray(), hotmXp, 7, false); + ProfileViewer.getLevel( + Utils.getElementOrDefault(leveling, "HOTM", new JsonArray()).getAsJsonArray(), + hotmXp, + 7, + false + ); levelObjhotms.put(profileId, levelObjhotm); } @@ -83,37 +88,63 @@ public class MiningPage extends GuiProfileViewerPage { //The stats that show float mithrilPowder = Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.powder_mithril"), 0); float gemstonePowder = Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.powder_gemstone"), 0); - float mithrilPowderTotal = Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.powder_spent_mithril"), 0); - float gemstonePowderTotal = (Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.powder_spent_gemstone"), 0)); + float mithrilPowderTotal = Utils.getElementAsFloat(Utils.getElement( + profileInfo, + "mining_core.powder_spent_mithril" + ), 0); + float gemstonePowderTotal = (Utils.getElementAsFloat(Utils.getElement( + profileInfo, + "mining_core.powder_spent_gemstone" + ), 0)); String jadeCrystal = (Utils.getElementAsString(Utils.getElement(profileInfo, "mining_core.crystals.jade_crystal.state"), "Not Found")); float crystalPlacedAmount = (Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.crystals.jade_crystal.total_placed"), 0)); String jadeCrystalString = "§c✖"; String amethystCrystal = - (Utils.getElementAsString(Utils.getElement(profileInfo, "mining_core.crystals.amethyst_crystal.state"), "Not Found")); + (Utils.getElementAsString( + Utils.getElement(profileInfo, "mining_core.crystals.amethyst_crystal.state"), + "Not Found" + )); String amethystCrystalString = "§c✖"; String amberCrystal = - (Utils.getElementAsString(Utils.getElement(profileInfo, "mining_core.crystals.amber_crystal.state"), "Not Found")); + (Utils.getElementAsString( + Utils.getElement(profileInfo, "mining_core.crystals.amber_crystal.state"), + "Not Found" + )); String amberCrystalString = "§c✖"; String sapphireCrystal = - (Utils.getElementAsString(Utils.getElement(profileInfo, "mining_core.crystals.sapphire_crystal.state"), "Not Found")); + (Utils.getElementAsString( + Utils.getElement(profileInfo, "mining_core.crystals.sapphire_crystal.state"), + "Not Found" + )); String sapphireCrystalString = "§c✖"; String topazCrystal = - (Utils.getElementAsString(Utils.getElement(profileInfo, "mining_core.crystals.topaz_crystal.state"), "Not Found")); + (Utils.getElementAsString( + Utils.getElement(profileInfo, "mining_core.crystals.topaz_crystal.state"), + "Not Found" + )); String topazCrystalString = "§c✖"; String jasperCrystal = - (Utils.getElementAsString(Utils.getElement(profileInfo, "mining_core.crystals.jasper_crystal.state"), "Not Found")); + (Utils.getElementAsString( + Utils.getElement(profileInfo, "mining_core.crystals.jasper_crystal.state"), + "Not Found" + )); String jasperCrystalString = "§c✖"; String rubyCrystal = (Utils.getElementAsString(Utils.getElement(profileInfo, "mining_core.crystals.ruby_crystal.state"), "Not Found")); String rubyCrystalString = "§c✖"; int miningFortune = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mining_fortune"), 0))); - int miningFortuneStat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mining_fortune"), 0)) * 5); + int miningFortuneStat = ((Utils.getElementAsInt( + Utils.getElement(profileInfo, "mining_core.nodes.mining_fortune"), + 0 + )) * 5); int miningSpeed = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mining_speed"), 0))); - int miningSpeedStat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mining_speed"), 0)) * 20); + int miningSpeedStat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mining_speed"), 0)) * + 20); int dailyPowder = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.daily_powder"), 0))); - int dailyPowderStat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.daily_powder"), 0)) * 36 + 364); + int dailyPowderStat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.daily_powder"), 0)) * + 36 + 364); int effMiner = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.efficient_miner"), 0))); float effMinerStat = (float) ( (Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.nodes.efficient_miner"), 0)) * 0.4 + 10.4 @@ -121,7 +152,10 @@ public class MiningPage extends GuiProfileViewerPage { float effMinerStat2 = (float) ( (Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.nodes.efficient_miner"), 0)) * .06 + 0.31 ); - int tittyInsane = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.titanium_insanium"), 0))); + int tittyInsane = ((Utils.getElementAsInt( + Utils.getElement(profileInfo, "mining_core.nodes.titanium_insanium"), + 0 + ))); float tittyInsaneStat = (float) ( (Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.nodes.titanium_insanium"), 0)) * .1 + 2 ); @@ -143,23 +177,48 @@ public class MiningPage extends GuiProfileViewerPage { float orbitStat = (float) ( (Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.nodes.experience_orbs"), 0)) * .01 + 0.2 ); - int crystallized = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.fallen_star_bonus"), 0))); - int crystallizedStat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.fallen_star_bonus"), 0)) * 6 + 14); + int crystallized = ((Utils.getElementAsInt( + Utils.getElement(profileInfo, "mining_core.nodes.fallen_star_bonus"), + 0 + ))); + int crystallizedStat = ((Utils.getElementAsInt( + Utils.getElement(profileInfo, "mining_core.nodes.fallen_star_bonus"), + 0 + )) * 6 + 14); int professional = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.professional"), 0))); - int professionalStat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.professional"), 0)) * 5 + 50); + int professionalStat = ((Utils.getElementAsInt( + Utils.getElement(profileInfo, "mining_core.nodes.professional"), + 0 + )) * 5 + 50); int greatExplorer = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.great_explorer"), 0))); - int greatExplorerStat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.great_explorer"), 0)) * 4 + 16); + int greatExplorerStat = ((Utils.getElementAsInt( + Utils.getElement(profileInfo, "mining_core.nodes.great_explorer"), + 0 + )) * 4 + 16); int fortunate = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.fortunate"), 0))); - int fortunateStat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.fortunate"), 0)) * 4 + 20); + int fortunateStat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.fortunate"), 0)) * 4 + + 20); int lonesomeMiner = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.lonesome_miner"), 0))); float lonesomeMinerStat = (float) ( (Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.nodes.lonesome_miner"), 0)) * .5 + 5 ); - int miningFortune2 = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mining_fortune_2"), 0))); - int miningFortune2Stat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mining_fortune_2"), 0)) * 5); + int miningFortune2 = ((Utils.getElementAsInt( + Utils.getElement(profileInfo, "mining_core.nodes.mining_fortune_2"), + 0 + ))); + int miningFortune2Stat = ((Utils.getElementAsInt(Utils.getElement( + profileInfo, + "mining_core.nodes.mining_fortune_2" + ), 0)) * 5); int miningSpeed2 = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mining_speed_2"), 0))); - int miningSpeed2Stat = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mining_speed_2"), 0)) * 40); - int miningSpeedBoost = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mining_speed_boost"), 0))); + int miningSpeed2Stat = ((Utils.getElementAsInt( + Utils.getElement(profileInfo, "mining_core.nodes.mining_speed_2"), + 0 + )) * 40); + int miningSpeedBoost = ((Utils.getElementAsInt(Utils.getElement( + profileInfo, + "mining_core.nodes.mining_speed_boost" + ), 0))); int veinSeeker = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.vein_seeker"), 0))); int powderBuff = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.powder_buff"), 0))); int potm = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.special_0"), 0))); @@ -172,7 +231,8 @@ public class MiningPage extends GuiProfileViewerPage { effMinerStat2 = 1; } int mole = ((Utils.getElementAsInt(Utils.getElement(profileInfo, "mining_core.nodes.mole"), 0))); - float moleStat = (float) ((Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.nodes.mole"), 0)) * 0.051); + float moleStat = (float) ((Utils.getElementAsFloat(Utils.getElement(profileInfo, "mining_core.nodes.mole"), 0)) * + 0.051); double moleperkstat = (double) mole / 20 - 0.55 + 50; double moleperkstat2 = (double) Math.round(moleperkstat * 100) / 100; @@ -320,35 +380,35 @@ public class MiningPage extends GuiProfileViewerPage { () -> miningSpeed != 50 && miningSpeed != 0 ? Lists.newArrayList( - "Mining Speed", - EnumChatFormatting.GRAY + "Level " + miningSpeed + EnumChatFormatting.DARK_GRAY + "/50", - "", - EnumChatFormatting.GRAY + + "Mining Speed", + EnumChatFormatting.GRAY + "Level " + miningSpeed + EnumChatFormatting.DARK_GRAY + "/50", + "", + EnumChatFormatting.GRAY + "Grants " + EnumChatFormatting.GREEN + "+" + miningSpeedStat + EnumChatFormatting.GOLD + " ⸕ Mining", - EnumChatFormatting.GOLD + "Speed" + EnumChatFormatting.GRAY + ".", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + + EnumChatFormatting.GOLD + "Speed" + EnumChatFormatting.GRAY + ".", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + GuiProfileViewer.numberFormat.format(Math.pow(miningSpeed + 2, 3)) + " Mithril Powder" - ) + ) : Lists.newArrayList( "Mining Speed", EnumChatFormatting.GRAY + "Level " + miningSpeed + EnumChatFormatting.DARK_GRAY + "/50", "", EnumChatFormatting.GRAY + - "Grants " + - EnumChatFormatting.GREEN + - "+" + - miningSpeedStat + - EnumChatFormatting.GOLD + - " ⸕ Mining", + "Grants " + + EnumChatFormatting.GREEN + + "+" + + miningSpeedStat + + EnumChatFormatting.GOLD + + " ⸕ Mining", EnumChatFormatting.GOLD + "Speed" + EnumChatFormatting.GRAY + "." ), 50 @@ -363,35 +423,35 @@ public class MiningPage extends GuiProfileViewerPage { () -> miningFortune != 0 && miningFortune != 50 ? Lists.newArrayList( - "Mining Fortune", - EnumChatFormatting.GRAY + "Level " + miningFortune + EnumChatFormatting.DARK_GRAY + "/50", - "", - EnumChatFormatting.GRAY + + "Mining Fortune", + EnumChatFormatting.GRAY + "Level " + miningFortune + EnumChatFormatting.DARK_GRAY + "/50", + "", + EnumChatFormatting.GRAY + "Grants " + EnumChatFormatting.GREEN + "+" + miningFortuneStat + EnumChatFormatting.GOLD + " ☘ Mining", - EnumChatFormatting.GOLD + "Fortune" + EnumChatFormatting.GRAY + ".", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + + EnumChatFormatting.GOLD + "Fortune" + EnumChatFormatting.GRAY + ".", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + GuiProfileViewer.numberFormat.format(Math.pow(miningFortune + 2, 3)) + " Mithril Powder" - ) + ) : Lists.newArrayList( "Mining Fortune", EnumChatFormatting.GRAY + "Level " + miningFortune + EnumChatFormatting.DARK_GRAY + "/50", "", EnumChatFormatting.GRAY + - "Grants " + - EnumChatFormatting.GREEN + - "+" + - miningFortuneStat + - EnumChatFormatting.GOLD + - " ☘ Mining", + "Grants " + + EnumChatFormatting.GREEN + + "+" + + miningFortuneStat + + EnumChatFormatting.GOLD + + " ☘ Mining", EnumChatFormatting.GOLD + "Fortune" + EnumChatFormatting.GRAY + "." ), 50 @@ -406,38 +466,38 @@ public class MiningPage extends GuiProfileViewerPage { () -> tittyInsane != 0 && tittyInsane != 50 ? Lists.newArrayList( - "Titanium Insanium", - EnumChatFormatting.GRAY + "Level " + tittyInsane + EnumChatFormatting.DARK_GRAY + "/50", - "", - EnumChatFormatting.GRAY + "When mining Mithril Ore, you", - EnumChatFormatting.GRAY + + "Titanium Insanium", + EnumChatFormatting.GRAY + "Level " + tittyInsane + EnumChatFormatting.DARK_GRAY + "/50", + "", + EnumChatFormatting.GRAY + "When mining Mithril Ore, you", + EnumChatFormatting.GRAY + "have a " + EnumChatFormatting.GREEN + tittyInsaneStat + "% " + EnumChatFormatting.GRAY + "chance to", - EnumChatFormatting.GRAY + "convert the block into Titanium", - EnumChatFormatting.GRAY + "Ore.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + + EnumChatFormatting.GRAY + "convert the block into Titanium", + EnumChatFormatting.GRAY + "Ore.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(tittyInsane + 2, 3)) + " Mithril Powder" - ) + ) : Lists.newArrayList( "Titanium Insanium", EnumChatFormatting.GRAY + "Level " + tittyInsane + EnumChatFormatting.DARK_GRAY + "/50", "", EnumChatFormatting.GRAY + "When mining Mithril Ore, you", EnumChatFormatting.GRAY + - "have a " + - EnumChatFormatting.GREEN + - tittyInsaneStat + - "% " + - EnumChatFormatting.GRAY + - "chance to", + "have a " + + EnumChatFormatting.GREEN + + tittyInsaneStat + + "% " + + EnumChatFormatting.GRAY + + "chance to", EnumChatFormatting.GRAY + "convert the block into Titanium", EnumChatFormatting.GRAY + "Ore." ), @@ -453,31 +513,33 @@ public class MiningPage extends GuiProfileViewerPage { () -> potm == 0 ? Lists.newArrayList( // Peak of the mountain == 0 - "Mining Speed Boost", - "", - EnumChatFormatting.GRAY + "Pickaxe Ability: Mining Speed Boost", - EnumChatFormatting.GRAY + "Grants " + EnumChatFormatting.GREEN + "200% " + EnumChatFormatting.GOLD + "⸕ Mining", - EnumChatFormatting.GOLD + + "Mining Speed Boost", + "", + EnumChatFormatting.GRAY + "Pickaxe Ability: Mining Speed Boost", + EnumChatFormatting.GRAY + "Grants " + EnumChatFormatting.GREEN + "200% " + EnumChatFormatting.GOLD + + "⸕ Mining", + EnumChatFormatting.GOLD + "Speed " + EnumChatFormatting.GRAY + "for " + EnumChatFormatting.GREEN + "15s" + EnumChatFormatting.GRAY, - EnumChatFormatting.DARK_GRAY + "Cooldown: " + EnumChatFormatting.GREEN + "120s" - ) + EnumChatFormatting.DARK_GRAY + "Cooldown: " + EnumChatFormatting.GREEN + "120s" + ) : Lists.newArrayList( // Peak of the mountain > 0 "Mining Speed Boost", "", EnumChatFormatting.GRAY + "Pickaxe Ability: Mining Speed Boost", - EnumChatFormatting.GRAY + "Grants " + EnumChatFormatting.GREEN + "300% " + EnumChatFormatting.GOLD + "⸕ Mining", + EnumChatFormatting.GRAY + "Grants " + EnumChatFormatting.GREEN + "300% " + EnumChatFormatting.GOLD + + "⸕ Mining", EnumChatFormatting.GOLD + - "Speed " + - EnumChatFormatting.GRAY + - "for " + - EnumChatFormatting.GREEN + - "20s" + - EnumChatFormatting.GRAY, + "Speed " + + EnumChatFormatting.GRAY + + "for " + + EnumChatFormatting.GREEN + + "20s" + + EnumChatFormatting.GRAY, EnumChatFormatting.DARK_GRAY + "Cooldown: " + EnumChatFormatting.GREEN + "120s" ) ); @@ -509,19 +571,19 @@ public class MiningPage extends GuiProfileViewerPage { () -> luckofcave != 0 && luckofcave != 45 ? Lists.newArrayList( - "Luck of the Cave", - "§7Level " + luckofcave + EnumChatFormatting.DARK_GRAY + "/45", - "", - "§7Increases the chance for you to", - "§7trigger rare occurrences im", - "§2Dwarven Mines " + EnumChatFormatting.GRAY + "by " + EnumChatFormatting.GREEN + luckofcaveStat + "%§7.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + + "Luck of the Cave", + "§7Level " + luckofcave + EnumChatFormatting.DARK_GRAY + "/45", + "", + "§7Increases the chance for you to", + "§7trigger rare occurrences im", + "§2Dwarven Mines " + EnumChatFormatting.GRAY + "by " + EnumChatFormatting.GREEN + luckofcaveStat + "%§7.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(luckofcave + 2, 3.07)) + " Mithril Powder" - ) + ) : Lists.newArrayList( "Luck of the Cave", "§7Level " + luckofcave + EnumChatFormatting.DARK_GRAY + "/45", @@ -542,33 +604,33 @@ public class MiningPage extends GuiProfileViewerPage { () -> dailyPowder != 0 && dailyPowder != 100 ? Lists.newArrayList( - "Daily Powder", - EnumChatFormatting.GRAY + "Level " + dailyPowder + EnumChatFormatting.DARK_GRAY + "/100", - "", - EnumChatFormatting.GRAY + + "Daily Powder", + EnumChatFormatting.GRAY + "Level " + dailyPowder + EnumChatFormatting.DARK_GRAY + "/100", + "", + EnumChatFormatting.GRAY + "Gains " + EnumChatFormatting.GREEN + dailyPowderStat + " Powder" + EnumChatFormatting.GRAY + " from the", - EnumChatFormatting.GRAY + "first ore you mine every day.", - EnumChatFormatting.GRAY + "Works for all Powder types.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + (200 + ((dailyPowder) * 18)) + " Mithril Powder" - ) + EnumChatFormatting.GRAY + "first ore you mine every day.", + EnumChatFormatting.GRAY + "Works for all Powder types.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + (200 + ((dailyPowder) * 18)) + " Mithril Powder" + ) : Lists.newArrayList( "Daily Powder", EnumChatFormatting.GRAY + "Level " + dailyPowder + EnumChatFormatting.DARK_GRAY + "/100", "", EnumChatFormatting.GRAY + - "Gains " + - EnumChatFormatting.GREEN + - dailyPowderStat + - " Powder" + - EnumChatFormatting.GRAY + - " from the", + "Gains " + + EnumChatFormatting.GREEN + + dailyPowderStat + + " Powder" + + EnumChatFormatting.GRAY + + " from the", EnumChatFormatting.GRAY + "first ore you mine every day.", EnumChatFormatting.GRAY + "Works for all Powder types." ), @@ -585,11 +647,11 @@ public class MiningPage extends GuiProfileViewerPage { () -> effMiner != 0 && effMiner != 100 ? Lists.newArrayList( - "Efficient Miner", - EnumChatFormatting.GRAY + "Level " + effMiner + EnumChatFormatting.DARK_GRAY + "/100", - "", - EnumChatFormatting.GRAY + "When mining ores, you have a", - EnumChatFormatting.GREEN + + "Efficient Miner", + EnumChatFormatting.GRAY + "Level " + effMiner + EnumChatFormatting.DARK_GRAY + "/100", + "", + EnumChatFormatting.GRAY + "When mining ores, you have a", + EnumChatFormatting.GREEN + "" + effMinerStat + "%" + @@ -597,27 +659,27 @@ public class MiningPage extends GuiProfileViewerPage { " chance to mine " + EnumChatFormatting.GREEN + Math.round(finalEffMinerStat2), - EnumChatFormatting.GRAY + "adjacent ores.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + + EnumChatFormatting.GRAY + "adjacent ores.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(effMiner + 2, 2.6)) + " Mithril Powder" - ) + ) : Lists.newArrayList( "Efficient Miner", EnumChatFormatting.GRAY + "Level " + effMiner + EnumChatFormatting.DARK_GRAY + "/100", "", EnumChatFormatting.GRAY + "When mining ores, you have a", EnumChatFormatting.GREEN + - "" + - effMinerStat + - "%" + - EnumChatFormatting.GRAY + - " chance to mine " + - EnumChatFormatting.GREEN + - Math.round(finalEffMinerStat2), + "" + + effMinerStat + + "%" + + EnumChatFormatting.GRAY + + " chance to mine " + + EnumChatFormatting.GREEN + + Math.round(finalEffMinerStat2), EnumChatFormatting.GRAY + "adjacent ores." ), 100 @@ -634,7 +696,7 @@ public class MiningPage extends GuiProfileViewerPage { case 0: return Lists.newArrayList( EnumChatFormatting.RED + "Peak of the Mountain", - EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/5", + EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/7", "", EnumChatFormatting.GRAY + "Cost", EnumChatFormatting.DARK_GREEN + "50000 Mithril Powder" @@ -642,7 +704,7 @@ public class MiningPage extends GuiProfileViewerPage { case 1: return Lists.newArrayList( EnumChatFormatting.YELLOW + "Peak of the Mountain", - EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/5", + EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/7", "", "§7§8+§c1 Pickaxe Ability Level", "§7§8+§51 Token of the Mountain", @@ -653,7 +715,7 @@ public class MiningPage extends GuiProfileViewerPage { case 2: return Lists.newArrayList( EnumChatFormatting.YELLOW + "Peak of the Mountain", - EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/5", + EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/7", "", "§7§8+§c1 Pickaxe Ability Level", "§7§8+§51 Token of the Mountain", @@ -665,7 +727,7 @@ public class MiningPage extends GuiProfileViewerPage { case 3: return Lists.newArrayList( EnumChatFormatting.YELLOW + "Peak of the Mountain", - EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/5", + EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/7", "", "§7§8+§c1 Pickaxe Ability Level", "§7§8+§51 Token of the Mountain", @@ -678,7 +740,7 @@ public class MiningPage extends GuiProfileViewerPage { case 4: return Lists.newArrayList( EnumChatFormatting.YELLOW + "Peak of the Mountain", - EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/5", + EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/7", "", "§7§8+§c1 Pickaxe Ability Level", "§7§8+§51 Token of the Mountain", @@ -693,7 +755,41 @@ public class MiningPage extends GuiProfileViewerPage { case 5: return Lists.newArrayList( EnumChatFormatting.GREEN + "Peak of the Mountain", - EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/5", + EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/7", + "", + "§7§8+§c1 Pickaxe Ability Level", + "§7§8+§51 Token of the Mountain", + "§7§8+§a1 Forge Slot", + "§7§8+§a1 Commission Slot", + "§7§8+§21 Mithril Powder §7when", + "§7mining §fMithril", + "§7§8+§51 Token of the Mountain", + "", + "§7Cost", + "§d500000 Gemstone Powder" + ); + case 6: + return Lists.newArrayList( + EnumChatFormatting.GREEN + "Peak of the Mountain", + EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/7", + "", + "§7§8+§c1 Pickaxe Ability Level", + "§7§8+§51 Token of the Mountain", + "§7§8+§a1 Forge Slot", + "§7§8+§a1 Commission Slot", + "§7§8+§21 Mithril Powder §7when", + "§7mining §fMithril", + "§7§8+§51 Token of the Mountain", + "§7§8+§d2 Gemstone Powder §7when", + "§7mining §dGemstones", + "", + "§7Cost", + "§d750000 Gemstone Powder" + ); + case 7: + return Lists.newArrayList( + EnumChatFormatting.GREEN + "Peak of the Mountain", + EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/7", "", "§7§8+§c1 Pickaxe Ability Level", "§7§8+§51 Token of the Mountain", @@ -701,10 +797,18 @@ public class MiningPage extends GuiProfileViewerPage { "§7§8+§a1 Commission Slot", "§7§8+§21 Mithril Powder §7when", "§7mining §fMithril", + "§7§8+§51 Token of the Mountain", + "§7§8+§d2 Gemstone Powder §7when", + "§7mining §dGemstones", "§7§8+§51 Token of the Mountain" ); } - return null; + return Lists.newArrayList( + EnumChatFormatting.GREEN + "Peak of the Mountain", + EnumChatFormatting.GRAY + "Level " + potm + EnumChatFormatting.DARK_GRAY + "/???", + EnumChatFormatting.RED + "It looks like your NEU doesn't understand your peak of the mountain perks.", + EnumChatFormatting.RED + "Please patiently await an update to your NEU installation." + ); }, potm > 0 ? new ItemStack(Blocks.redstone_block) : new ItemStack(Blocks.bedrock), true // A redstone block or bedrock is being rendered, so standard GUI item lighting needs to be enabled. @@ -720,11 +824,11 @@ public class MiningPage extends GuiProfileViewerPage { () -> mole != 0 && mole != 190 ? Lists.newArrayList( - "Mole", - EnumChatFormatting.GRAY + "Level " + mole + EnumChatFormatting.DARK_GRAY + "/190", - "", - EnumChatFormatting.GRAY + "When mining hard stone, you have", - EnumChatFormatting.GRAY + + "Mole", + EnumChatFormatting.GRAY + "Level " + mole + EnumChatFormatting.DARK_GRAY + "/190", + "", + EnumChatFormatting.GRAY + "When mining hard stone, you have", + EnumChatFormatting.GRAY + "a " + EnumChatFormatting.GREEN + finalOutput + @@ -732,38 +836,38 @@ public class MiningPage extends GuiProfileViewerPage { EnumChatFormatting.GRAY + "chance to mine " + EnumChatFormatting.GREEN, - EnumChatFormatting.GREEN + + EnumChatFormatting.GREEN + "" + Math.round(moleStat) + EnumChatFormatting.GRAY + " adjacent hard stone block" + (moleStat == 1.0 ? "." : "s."), - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.LIGHT_PURPLE + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(mole + 2, 2.2)) + " Gemstone Powder" - ) + ) : Lists.newArrayList( "Mole", EnumChatFormatting.GRAY + "Level " + mole + EnumChatFormatting.DARK_GRAY + "/190", "", EnumChatFormatting.GRAY + "When mining hard stone, you have", EnumChatFormatting.GRAY + - "a " + - EnumChatFormatting.GREEN + - finalOutput + - "% " + - EnumChatFormatting.GRAY + - "chance to mine " + - EnumChatFormatting.GREEN, + "a " + + EnumChatFormatting.GREEN + + finalOutput + + "% " + + EnumChatFormatting.GRAY + + "chance to mine " + + EnumChatFormatting.GREEN, EnumChatFormatting.GREEN + - "" + - Math.round(moleStat) + - EnumChatFormatting.GRAY + - " adjacent hard stone block" + - (moleStat == 1.0 ? "." : "s.") + "" + + Math.round(moleStat) + + EnumChatFormatting.GRAY + + " adjacent hard stone block" + + (moleStat == 1.0 ? "." : "s.") ), 190 ); @@ -777,35 +881,35 @@ public class MiningPage extends GuiProfileViewerPage { () -> powderBuff != 0 && powderBuff != 50 ? Lists.newArrayList( - "Powder Buff", - EnumChatFormatting.GRAY + "Level " + powderBuff + EnumChatFormatting.DARK_GRAY + "/50", - "", - EnumChatFormatting.GRAY + + "Powder Buff", + EnumChatFormatting.GRAY + "Level " + powderBuff + EnumChatFormatting.DARK_GRAY + "/50", + "", + EnumChatFormatting.GRAY + "Gain " + EnumChatFormatting.GREEN + powderBuff + "% " + EnumChatFormatting.GRAY + "more Mithril", - EnumChatFormatting.GRAY + "Powder and Gemstone Powder§7.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + + EnumChatFormatting.GRAY + "Powder and Gemstone Powder§7.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.LIGHT_PURPLE + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(powderBuff + 2, 3.2)) + " Gemstone Powder" - ) + ) : Lists.newArrayList( "Powder Buff", EnumChatFormatting.GRAY + "Level " + powderBuff + EnumChatFormatting.DARK_GRAY + "/50", "", EnumChatFormatting.GRAY + - "Gain " + - EnumChatFormatting.GREEN + - powderBuff + - "% " + - EnumChatFormatting.GRAY + - "more Mithril", + "Gain " + + EnumChatFormatting.GREEN + + powderBuff + + "% " + + EnumChatFormatting.GRAY + + "more Mithril", EnumChatFormatting.GRAY + "Powder and Gemstone Powder§7." ), 50 @@ -865,17 +969,17 @@ public class MiningPage extends GuiProfileViewerPage { () -> seasonMine != 0 && seasonMine != 100 ? Lists.newArrayList( - "Seasoned Mineman", - "§7Level " + seasonMine + "§8/100", - "", - "§7Grants §3+" + EnumChatFormatting.DARK_AQUA + seasonMineStat + "☯ Mining Wisdom§7.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + + "Seasoned Mineman", + "§7Level " + seasonMine + "§8/100", + "", + "§7Grants §3+" + EnumChatFormatting.DARK_AQUA + seasonMineStat + "☯ Mining Wisdom§7.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(seasonMine + 2, 2.3)) + " Mithril Powder" - ) + ) : Lists.newArrayList( "Seasoned Mineman", "§7Level " + seasonMine + "§8/100", @@ -904,21 +1008,21 @@ public class MiningPage extends GuiProfileViewerPage { () -> lonesomeMiner != 0 && lonesomeMiner != 45 ? Lists.newArrayList( - "Lonesome Miner", - "§7Level " + lonesomeMiner + EnumChatFormatting.DARK_GRAY + "/45", - "", - "§7Increases §c❁ Strength, §9☣ Crit", - "§9Chance, §9☠ Crit Damage, §a❈", - "§aDefense, and §c❤ Health", - "§c§7statistics gain by " + EnumChatFormatting.GREEN + lonesomeMinerStat + "%§7", - "§7while in the Crystal Hollows.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + + "Lonesome Miner", + "§7Level " + lonesomeMiner + EnumChatFormatting.DARK_GRAY + "/45", + "", + "§7Increases §c❁ Strength, §9☣ Crit", + "§9Chance, §9☠ Crit Damage, §a❈", + "§aDefense, and §c❤ Health", + "§c§7statistics gain by " + EnumChatFormatting.GREEN + lonesomeMinerStat + "%§7", + "§7while in the Crystal Hollows.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.LIGHT_PURPLE + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(lonesomeMiner + 2, 3.07)) + " Gemstone Powder" - ) + ) : Lists.newArrayList( "Lonesome Miner", "§7Level " + lonesomeMiner + EnumChatFormatting.DARK_GRAY + "/45", @@ -940,18 +1044,18 @@ public class MiningPage extends GuiProfileViewerPage { () -> professional != 0 && professional != 140 ? Lists.newArrayList( - "Professional", - "§7Level " + professional + EnumChatFormatting.DARK_GRAY + "/140", - "", - "§7Gain §a+" + professionalStat + "§6 ⸕ Mining", - "§6Speed§7 when mining Gemstones.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + + "Professional", + "§7Level " + professional + EnumChatFormatting.DARK_GRAY + "/140", + "", + "§7Gain §a+" + professionalStat + "§6 ⸕ Mining", + "§6Speed§7 when mining Gemstones.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.LIGHT_PURPLE + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(professional + 2, 2.3)) + " Gemstone Powder" - ) + ) : Lists.newArrayList( "Professional", "§7Level " + professional + EnumChatFormatting.DARK_GRAY + "/140", @@ -971,18 +1075,18 @@ public class MiningPage extends GuiProfileViewerPage { () -> miningSpeed2 != 0 && miningSpeed2 != 50 ? Lists.newArrayList( - "Mining Speed 2", - "§7Level " + miningSpeed2 + EnumChatFormatting.DARK_GRAY + "/50", - "", - "§7Grants " + EnumChatFormatting.GREEN + "+" + miningSpeed2Stat + EnumChatFormatting.GOLD + " ⸕ Mining", - "§6Speed§7.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + + "Mining Speed 2", + "§7Level " + miningSpeed2 + EnumChatFormatting.DARK_GRAY + "/50", + "", + "§7Grants " + EnumChatFormatting.GREEN + "+" + miningSpeed2Stat + EnumChatFormatting.GOLD + " ⸕ Mining", + "§6Speed§7.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.LIGHT_PURPLE + "" + GuiProfileViewer.numberFormat.format(Math.pow(miningSpeed2 + 2, 3)) + " Gemstone Powder" - ) + ) : Lists.newArrayList( "Mining Speed 2", "§7Level " + miningSpeed2 + EnumChatFormatting.DARK_GRAY + "/50", @@ -1002,18 +1106,18 @@ public class MiningPage extends GuiProfileViewerPage { () -> quickForge != 0 && quickForge != 20 ? Lists.newArrayList( - "Quick Forge", - "§7Level " + quickForge + EnumChatFormatting.DARK_GRAY + "/20", - "", - "§7Decreases the time it takes to", - "§7forge by §a" + (quickForgeStat < 20 ? quickForgeStat : 30) + "%§7.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + + "Quick Forge", + "§7Level " + quickForge + EnumChatFormatting.DARK_GRAY + "/20", + "", + "§7Decreases the time it takes to", + "§7forge by §a" + (quickForgeStat < 20 ? quickForgeStat : 30) + "%§7.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(quickForge + 2, 4)) + " Mithril Powder" - ) + ) : Lists.newArrayList( "Quick Forge", "§7Level " + quickForge + EnumChatFormatting.DARK_GRAY + "/20", @@ -1033,18 +1137,18 @@ public class MiningPage extends GuiProfileViewerPage { () -> fortunate != 0 && fortunate != 20 ? Lists.newArrayList( - "Fortunate", - "§7Level " + fortunate + EnumChatFormatting.DARK_GRAY + "/20", - "", - "§7Gain " + EnumChatFormatting.GREEN + "+" + fortunateStat + " §6☘ Mining", - "§6Fortune§7 when mining Gemstone.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + + "Fortunate", + "§7Level " + fortunate + EnumChatFormatting.DARK_GRAY + "/20", + "", + "§7Gain " + EnumChatFormatting.GREEN + "+" + fortunateStat + " §6☘ Mining", + "§6Fortune§7 when mining Gemstone.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(fortunate + 2, 3.05)) + " Mithril Powder" - ) + ) : Lists.newArrayList( "Fortunate", "§7Level " + fortunate + EnumChatFormatting.DARK_GRAY + "/20", @@ -1064,23 +1168,25 @@ public class MiningPage extends GuiProfileViewerPage { () -> greatExplorer != 0 && greatExplorer != 20 ? Lists.newArrayList( - "Great Explorer", - "§7Level " + greatExplorer + EnumChatFormatting.DARK_GRAY + "/20", - "", - "§7Grants " + EnumChatFormatting.GREEN + "+" + greatExplorerStat + "% " + EnumChatFormatting.GRAY + "chance to", - "§7find treasure.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + + "Great Explorer", + "§7Level " + greatExplorer + EnumChatFormatting.DARK_GRAY + "/20", + "", + "§7Grants " + EnumChatFormatting.GREEN + "+" + greatExplorerStat + "% " + EnumChatFormatting.GRAY + + "chance to", + "§7find treasure.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.LIGHT_PURPLE + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(greatExplorer + 2, 4)) + " Gemstone Powder" - ) + ) : Lists.newArrayList( "Great Explorer", "§7Level " + greatExplorer + EnumChatFormatting.DARK_GRAY + "/20", "", - "§7Grants " + EnumChatFormatting.GREEN + "+" + greatExplorerStat + "% " + EnumChatFormatting.GRAY + "chance to", + "§7Grants " + EnumChatFormatting.GREEN + "+" + greatExplorerStat + "% " + EnumChatFormatting.GRAY + + "chance to", "§7find treasure." ), 20 @@ -1095,18 +1201,18 @@ public class MiningPage extends GuiProfileViewerPage { () -> miningFortune2 != 0 && miningFortune2 != 50 ? Lists.newArrayList( - "Mining Fortune 2", - "§7Level " + miningFortune2 + EnumChatFormatting.DARK_GRAY + "/50", - "", - "§7Grants §a+§a" + miningFortune2Stat + "§7 §6☘ Mining", - "§6Fortune§7.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.LIGHT_PURPLE + + "Mining Fortune 2", + "§7Level " + miningFortune2 + EnumChatFormatting.DARK_GRAY + "/50", + "", + "§7Grants §a+§a" + miningFortune2Stat + "§7 §6☘ Mining", + "§6Fortune§7.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.LIGHT_PURPLE + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(miningFortune2 + 2, 3.2)) + " Gemstone Powder" - ) + ) : Lists.newArrayList( "Mining Fortune 2", "§7Level " + miningFortune2 + EnumChatFormatting.DARK_GRAY + "/50", @@ -1126,16 +1232,16 @@ public class MiningPage extends GuiProfileViewerPage { () -> orbit != 0 && orbit != 80 ? Lists.newArrayList( - "Orbiter", - "§7Level " + orbit + EnumChatFormatting.DARK_GRAY + "/80", - "", - "§7When mining ores, you have a", - EnumChatFormatting.GREEN + "" + orbitStat + "%" + EnumChatFormatting.GRAY + " chance to get a random", - "§7amount of experience orbs.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + "" + ((orbit + 1) * 70) + " Mithril Powder" - ) + "Orbiter", + "§7Level " + orbit + EnumChatFormatting.DARK_GRAY + "/80", + "", + "§7When mining ores, you have a", + EnumChatFormatting.GREEN + "" + orbitStat + "%" + EnumChatFormatting.GRAY + " chance to get a random", + "§7amount of experience orbs.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + ((orbit + 1) * 70) + " Mithril Powder" + ) : Lists.newArrayList( "Orbiter", "§7Level " + orbit + EnumChatFormatting.DARK_GRAY + "/80", @@ -1206,20 +1312,20 @@ public class MiningPage extends GuiProfileViewerPage { () -> crystallized != 0 && crystallized != 30 ? Lists.newArrayList( - "Crystallized", - "§7Level " + crystallized + EnumChatFormatting.DARK_GRAY + "/30", - "", - "§7Grants §a+§a" + crystallizedStat + "§7 §6⸕ Mining", - "§6Speed §7and a §a" + crystallizedStat + "%§7 §7chance", - "§7to deal §a+1 §7extra damage near", - "§7§5Fallen Stars§7.", - "", - EnumChatFormatting.GRAY + "Cost", - EnumChatFormatting.DARK_GREEN + + "Crystallized", + "§7Level " + crystallized + EnumChatFormatting.DARK_GRAY + "/30", + "", + "§7Grants §a+§a" + crystallizedStat + "§7 §6⸕ Mining", + "§6Speed §7and a §a" + crystallizedStat + "%§7 §7chance", + "§7to deal §a+1 §7extra damage near", + "§7§5Fallen Stars§7.", + "", + EnumChatFormatting.GRAY + "Cost", + EnumChatFormatting.DARK_GREEN + "" + GuiProfileViewer.numberFormat.format((int) Math.pow(crystallized + 2, 2.4)) + " Mithril Powder" - ) + ) : Lists.newArrayList( "Crystallized", "§7Level " + crystallized + EnumChatFormatting.DARK_GRAY + "/30", @@ -1320,7 +1426,9 @@ public class MiningPage extends GuiProfileViewerPage { ItemStack itemStack; if (isPickaxeAbility) { RenderHelper.enableGUIStandardItemLighting(); // GUI standard item lighting must be enabled for items that are rendered as blocks, like emerald blocks. - itemStack = new ItemStack(unlocked ? Blocks.emerald_block : Blocks.coal_block); // Pickaxe abilities are rendered as blocks + itemStack = new ItemStack(unlocked + ? Blocks.emerald_block + : Blocks.coal_block); // Pickaxe abilities are rendered as blocks } else { // Non-pickaxe abilities are rendered as items itemStack = new ItemStack(unlocked ? (perkLevel >= maxLevel ? Items.diamond : Items.emerald) : Items.coal); } @@ -1329,8 +1437,10 @@ public class MiningPage extends GuiProfileViewerPage { // Prepend the green, yellow, or red color on the first line of each tooltip depending on if the perk is unlocked tooltip.set( 0, - (unlocked ? (perkLevel >= maxLevel ? EnumChatFormatting.GREEN : EnumChatFormatting.YELLOW) : EnumChatFormatting.RED) + - tooltip.get(0) + (unlocked + ? (perkLevel >= maxLevel ? EnumChatFormatting.GREEN : EnumChatFormatting.YELLOW) + : EnumChatFormatting.RED) + + tooltip.get(0) ); NBTTagCompound nbt = new NBTTagCompound(); //Adding NBT Data for Custom Resource Packs diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java index b2aeeb11..8c594911 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java @@ -127,8 +127,9 @@ public class ApiUtil { return buildUrl().thenApplyAsync(url -> { try { InputStream inputStream = null; + URLConnection conn = null; try { - URLConnection conn = url.openConnection(); + conn = url.openConnection(); if (conn instanceof HttpsURLConnection && ctx != null) { HttpsURLConnection sslConn = (HttpsURLConnection) conn; sslConn.setSSLSocketFactory(ctx.getSocketFactory()); @@ -151,8 +152,14 @@ public class ApiUtil { // but in the sense that any violation of this better have a good reason. return IOUtils.toString(inputStream, StandardCharsets.UTF_8); } finally { - if (inputStream != null) { - inputStream.close(); + try { + if (inputStream != null) { + inputStream.close(); + } + } finally { + if (conn instanceof HttpURLConnection) { + ((HttpURLConnection) conn).disconnect(); + } } } } catch (IOException e) { |