Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
Feature: more open identities & addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFruxz committed Jan 22, 2022
1 parent bba8d73 commit 10fcc8e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface AppExtension<RUNTIME, ACCESSOR_OUT, UNIT> : Identifiable<AppExtension<
* @author Fruxz
* @since 1.0
*/
val extensionIdentity: Identity<AppExtension<RUNTIME, ACCESSOR_OUT, UNIT>>
val extensionIdentity: Identity<out AppExtension<RUNTIME, ACCESSOR_OUT, UNIT>>
get() = identityObject

/**
Expand Down
2 changes: 1 addition & 1 deletion JET-Paper/src/main/kotlin/de/jet/paper/app/JetApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class JetApp : App() {

companion object : AppCompanion<JetApp>() {

override val predictedIdentity = Identity<App>("JET")
override val predictedIdentity = Identity<JetApp>("JET")

var debugMode: Boolean = false

Expand Down
10 changes: 5 additions & 5 deletions JET-Paper/src/main/kotlin/de/jet/paper/extension/Developer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal val lang: LanguageSpeaker
get() = JET.languageSpeaker

// TODO: 12.10.21 LanguageSpeaker bei Address austauschen mit sinvoller, erst dann existierender Klasse
fun getSystemTranslated(@Suppress("UNUSED_PARAMETER") vendor: Identifiable<App>, address: Address<LanguageData>): String {
fun getSystemTranslated(@Suppress("UNUSED_PARAMETER") vendor: Identifiable<out App>, address: Address<LanguageData>): String {
return lang(id = address.addressString) //todo replace with real system
}

Expand All @@ -32,16 +32,16 @@ operator fun LanguageSpeaker.get(id: String) = lang(id)
internal fun lang(id: String, smartColor: Boolean = true) = lang.message(id, smartColor)

internal val system: JetApp
get() = JET.appInstance
get() = JET.appInstance

@Throws(NoSuchElementException::class)
fun app(id: String) = JetCache.registeredApplications.first { it.appIdentity == id }

@Throws(NoSuchElementException::class)
fun app(vendor: Identifiable<App>) = JetCache.registeredApplications.first { it.appIdentity == vendor.identity }
fun app(vendor: Identifiable<out App>) = JetCache.registeredApplications.first { it.appIdentity == vendor.identity }

@Throws(NoSuchElementException::class)
fun app(vendorIdentity: Identity<App>) = JetCache.registeredApplications.first { it.appIdentity == vendorIdentity.identity }
fun app(vendorIdentity: Identity<out App>) = JetCache.registeredApplications.first { it.appIdentity == vendorIdentity.identity }

@Throws(NoSuchElementException::class)
fun Identifiable<App>.getApp() = app(identity)
fun Identifiable<out App>.getApp() = app(identity)
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ abstract class AppCompanion<T : App> : Identifiable<App> {
* @author Fruxz
* @since 1.0
*/
abstract val predictedIdentity: Identity<App>
abstract val predictedIdentity: Identity<T>

}

0 comments on commit 10fcc8e

Please sign in to comment.