Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Jun 13, 2024
1 parent c6e39ad commit 7a5e4ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
import org.jetbrains.annotations.NotNull;

public class HotmConfig {

Expand Down Expand Up @@ -36,7 +37,7 @@ public class HotmConfig {
@Expose
@ConfigOption(name = "Powder Spent Design", desc = "Changes the design of the powder spent display.")
@ConfigEditorDropdown
public PowderSpentDesign powderSpentDesign = PowderSpentDesign.NUMBER_AND_PERCENTAGE;
public @NotNull PowderSpentDesign powderSpentDesign = PowderSpentDesign.NUMBER_AND_PERCENTAGE;

@Expose
@ConfigOption(name = "Powder for 10 Levels", desc = "Shows the amount of powder needed to level a perk 10 times when pressing shift.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object PowderPerHotmPerk {

if (perk.getLevelUpCost() == null) return

if (config.powderSpent) event.toolTip.add(2, handlePowderSpend(event, perk))
if (config.powderSpent) event.toolTip.add(2, handlePowderSpend(perk))
if (config.powderFor10Levels) handlePowderFor10Levels(event, perk)
}

Expand All @@ -45,7 +45,7 @@ object PowderPerHotmPerk {
event.toolTip.add(indexOfCost + 2, "§7Powder for 10 levels: §e${powderFor10Levels.addSeparators()}")
}

private fun handlePowderSpend(event: LorenzToolTipEvent, perk: HotmData): String {
private fun handlePowderSpend(perk: HotmData): String {
val currentPowderSpend = perk.calculateTotalCost(perk.activeLevel)
val maxPowderNeeded = perk.totalCostMaxLevel
val percentage = (currentPowderSpend.fractionOf(maxPowderNeeded) * 100).round(2)
Expand Down Expand Up @@ -85,6 +85,6 @@ object PowderPerHotmPerk {
override fun toString() = str
}

private fun isEnabled() =
(config.powderSpent || config.powderFor10Levels) && LorenzUtils.inSkyBlock && HotmData.inInventory
private fun isEnabled() = (config.powderSpent || config.powderFor10Levels) &&
LorenzUtils.inSkyBlock && HotmData.inInventory
}

0 comments on commit 7a5e4ff

Please sign in to comment.