Skip to content

Commit

Permalink
Fix version suffix removal
Browse files Browse the repository at this point in the history
  • Loading branch information
viral32111 committed Jul 27, 2023
1 parent d7a31be commit f0da3f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/main/kotlin/com/viral32111/library/GetVersions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ fun getFabricLoaderVersion(): String = getModVersion( "fabricloader" )
* @return The mod version.
* @since 0.1.0
*/
fun getFabricAPIVersion( stripSuffix: Boolean = false ): String = getModVersion( "fabric-api" ).apply { if ( stripSuffix ) this.split( "+" ).first() }
fun getFabricAPIVersion( stripSuffix: Boolean = false ): String =
getModVersion( "fabric-api" ).let { if ( stripSuffix ) it.split( "+", limit = 2 ).first() else it }

/**
* Gets the version of the Fabric Language Kotlin mod.
* @return The mod version.
* @since 0.1.0
*/
fun getFabricLanguageKotlinVersion( stripSuffix: Boolean = false ): String = getModVersion( "fabric-language-kotlin" ).apply { if ( stripSuffix ) this.split( "+" ).first() }
fun getFabricLanguageKotlinVersion( stripSuffix: Boolean = false ): String =
getModVersion( "fabric-language-kotlin" ).let { if ( stripSuffix ) it.split( "+", limit = 2 ).first() else it }
2 changes: 1 addition & 1 deletion src/main/kotlin/com/viral32111/library/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Main: ModInitializer {
override fun onInitialize() {
LOGGER.info( "Library v${ getModVersion() } initialized." )

LOGGER.info( "Running Java ${ getJavaVersion() }, Minecraft ${ getMinecraftVersion() }, Fabric Loader ${ getFabricLoaderVersion() }, Fabric API ${ getFabricAPIVersion() }, Fabric Language Kotlin ${ getFabricLanguageKotlinVersion() }." )
LOGGER.info( "Running Java ${ getJavaVersion() }, Minecraft ${ getMinecraftVersion() }, Fabric Loader ${ getFabricLoaderVersion() }, Fabric API ${ getFabricAPIVersion( true ) }, Fabric Language Kotlin ${ getFabricLanguageKotlinVersion( true ) }." )
LOGGER.info( "The current date & time is ${ getCurrentDateTimeInUTC() } (ISO-8601: ${ getCurrentDateTimeInUTCAsISO8601() }). It has been ${ System.currentTimeMillis().div( 1000 ).toHumanReadableTime() } since the epoch." )
}

Expand Down

0 comments on commit f0da3f9

Please sign in to comment.