Skip to content

refactor: update Rarity enum to use string display names and simplify…#302

Merged
ammodev merged 1 commit intoversion/26.1from
fix/fix-rarity-displayname
Apr 9, 2026
Merged

refactor: update Rarity enum to use string display names and simplify…#302
ammodev merged 1 commit intoversion/26.1from
fix/fix-rarity-displayname

Conversation

@ammodev
Copy link
Copy Markdown
Contributor

@ammodev ammodev commented Apr 9, 2026

… component creation

Copilot AI review requested due to automatic review settings April 9, 2026 02:53
@ammodev ammodev merged commit 3196c19 into version/26.1 Apr 9, 2026
3 of 4 checks passed
@ammodev ammodev deleted the fix/fix-rarity-displayname branch April 9, 2026 02:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the core Rarity enum to define display names as plain strings and build the corresponding Adventure components via the lightweight text(...) helper, along with a patch version bump.

Changes:

  • Replace per-enum SurfComponentBuilder lambdas with string display names and construct displayName via text(displayName, color).
  • Remove buildText/SurfComponentBuilder usage from Rarity.
  • Bump project version from 3.0.6 to 3.0.7.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/rarity/Rarity.kt Simplifies rarity display name construction to a string + color-based TextComponent.
gradle.properties Updates the project version to 3.0.7.

Comment on lines 13 to 18
* @property displayName The visual display name of the rarity level.
* @property color The textual color associated with the rarity level.
*/
enum class Rarity(
displayName: SurfComponentBuilder.() -> Unit,
displayName: String,
val color: TextColor
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The KDoc uses @property displayName, but displayName is no longer a constructor property (the constructor parameter is not declared as val/var). This can lead to Dokka/KDoc being misleading or emitting warnings. Consider removing the @property displayName tag and instead documenting the val displayName property directly, or rename/store the constructor parameter as a (private) property (e.g., private val displayNameText) and document accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +45 to 46
val displayName = text(displayName, color)
override fun asComponent() = displayName
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

val displayName = text(displayName, color) reuses the same identifier as the constructor parameter, relying on Kotlin's name shadowing rules. This is easy to misread and can confuse future refactors. Rename the constructor parameter to something like displayNameText/displayNameRaw (or store it as a private property) so the initializer reads unambiguously.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants