Skip to content

Commit

Permalink
Fixed Master Stars Display
Browse files Browse the repository at this point in the history
they changed the display of stars from
§6✪§6✪§6✪§6✪§6✪§c➋ to §6✪✪✪✪✪§c➋
in a recent patch

Signed-off-by: EmeraldMerchant <[email protected]>
  • Loading branch information
EmeraldMerchant authored Sep 28, 2024
1 parent 4228f9a commit 2b0fa5d
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import gg.skytils.skytilsmod.utils.ifNull
import net.minecraft.item.ItemStack
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable

const val starPattern = "§6✪"
const val starPattern = "§6✪✪✪✪✪"
const val starPatternSingle = ""
val masterStars = (''..'').toList()
val masterStarPattern = Regex("§c[${masterStars.joinToString("")}]")

Expand Down Expand Up @@ -68,18 +69,18 @@ fun modifyDisplayName(s: String): String {
.replace(masterStarPattern, "")
}§c${count}"
}.ifNull {
displayName = "${displayName.replace(starPattern, "")}§6${displayName.countMatches(starPattern)}"
displayName = "${displayName.replace(starPattern, "")}§6${displayName.countMatches(starPatternSingle)}"
}
} else if (Skytils.config.starDisplayType == 1) {
masterStarPattern.find(displayName)?.let {
val star = it.value.last()
val count = masterStars.indexOf(star) + 1
displayName = displayName.replace(masterStarPattern, "")
.replaceFirst(starPattern.repeat(count), "§c✪".repeat(count))
.replaceFirst("§6${starPatternSingle.repeat(count)}", "§c✪§6".repeat(count))
}
}
}
} catch (ignored: Exception) {
}
return displayName
}
}

0 comments on commit 2b0fa5d

Please sign in to comment.