mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 19:05:02 -04:00
per server and eros profiles
This commit is contained in:
parent
2e60661a36
commit
7e81c67bdb
@ -0,0 +1,40 @@
|
||||
package de.bixilon.minosoft.config.profile
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.audio.AudioProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.audio.AudioProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.block.BlockProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.block.BlockProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.EntityProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.EntityProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.hud.HUDProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.hud.HUDProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.particle.ParticleProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.particle.ParticleProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.resources.ResourcesProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.resources.ResourcesProfileManager
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
|
||||
class ConnectionProfiles(
|
||||
overrides: Map<ResourceLocation, String> = mapOf(),
|
||||
val eros: ErosProfile = overrides[ErosProfileManager.namespace]?.let { return@let ErosProfileManager.profiles[it] } ?: ErosProfileManager.selected,
|
||||
val particle: ParticleProfile = overrides[ParticleProfileManager.namespace]?.let { return@let ParticleProfileManager.profiles[it] } ?: ParticleProfileManager.selected,
|
||||
val audio: AudioProfile = overrides[AudioProfileManager.namespace]?.let { return@let AudioProfileManager.profiles[it] } ?: AudioProfileManager.selected,
|
||||
val entity: EntityProfile = overrides[EntityProfileManager.namespace]?.let { return@let EntityProfileManager.profiles[it] } ?: EntityProfileManager.selected,
|
||||
val resources: ResourcesProfile = overrides[ResourcesProfileManager.namespace]?.let { return@let ResourcesProfileManager.profiles[it] } ?: ResourcesProfileManager.selected,
|
||||
val rendering: RenderingProfile = overrides[RenderingProfileManager.namespace]?.let { return@let RenderingProfileManager.profiles[it] } ?: RenderingProfileManager.selected,
|
||||
val block: BlockProfile = overrides[BlockProfileManager.namespace]?.let { return@let BlockProfileManager.profiles[it] } ?: BlockProfileManager.selected,
|
||||
val connection: ConnectionProfile = overrides[ConnectionProfileManager.namespace]?.let { return@let ConnectionProfileManager.profiles[it] } ?: ConnectionProfileManager.selected,
|
||||
val hud: HUDProfile = overrides[HUDProfileManager.namespace]?.let { return@let HUDProfileManager.profiles[it] } ?: HUDProfileManager.selected,
|
||||
val controls: ControlsProfile = overrides[ControlsProfileManager.namespace]?.let { return@let ControlsProfileManager.profiles[it] } ?: ControlsProfileManager.selected,
|
||||
val other: OtherProfile = overrides[OtherProfileManager.namespace]?.let { return@let OtherProfileManager.profiles[it] } ?: OtherProfileManager.selected,
|
||||
)
|
@ -1,38 +0,0 @@
|
||||
package de.bixilon.minosoft.config.profile
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.audio.AudioProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.audio.AudioProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.block.BlockProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.block.BlockProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.EntityProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.EntityProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.hud.HUDProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.hud.HUDProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.particle.ParticleProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.particle.ParticleProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.resources.ResourcesProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.resources.ResourcesProfileManager
|
||||
|
||||
data class ProfileCollection(
|
||||
val eros: ErosProfile = ErosProfileManager.selected,
|
||||
val particle: ParticleProfile = ParticleProfileManager.selected,
|
||||
val audio: AudioProfile = AudioProfileManager.selected,
|
||||
val entity: EntityProfile = EntityProfileManager.selected,
|
||||
val resources: ResourcesProfile = ResourcesProfileManager.selected,
|
||||
val rendering: RenderingProfile = RenderingProfileManager.selected,
|
||||
val block: BlockProfile = BlockProfileManager.selected,
|
||||
val connection: ConnectionProfile = ConnectionProfileManager.selected,
|
||||
val hud: HUDProfile = HUDProfileManager.selected,
|
||||
val controls: ControlsProfile = ControlsProfileManager.selected,
|
||||
val other: OtherProfile = OtherProfileManager.selected,
|
||||
)
|
@ -171,9 +171,7 @@ interface ProfileManager<T : Profile> {
|
||||
}
|
||||
}
|
||||
|
||||
if (selected != null) {
|
||||
profiles[selected]?.let { this.selected = it } ?: selectDefault()
|
||||
}
|
||||
profiles[selected]?.let { this.selected = it } ?: selectDefault()
|
||||
|
||||
Log.log(LogMessageType.PROFILES, LogLevels.VERBOSE) { "Loaded ${profiles.size} $namespace profiles!" }
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.account.AccountProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.account.AccountProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.mapDelegate
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import java.util.*
|
||||
|
||||
class GeneralC {
|
||||
@ -22,4 +24,10 @@ class GeneralC {
|
||||
_accountProfile = AccountProfileManager.getName(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Profiles to use for connections
|
||||
* If profile is not set or not found, the global default profile is used
|
||||
*/
|
||||
var profileOverrides: MutableMap<ResourceLocation, String> by mapDelegate()
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.backingDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.mapDelegate
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import de.bixilon.minosoft.data.registries.versions.Version
|
||||
import de.bixilon.minosoft.data.registries.versions.Versions
|
||||
import de.bixilon.minosoft.data.text.ChatComponent
|
||||
@ -27,9 +29,23 @@ class Server(
|
||||
name: ChatComponent = ChatComponent.of(address),
|
||||
forcedVersion: Version? = null,
|
||||
) {
|
||||
/**
|
||||
* Server-address as string. May contain the port
|
||||
*/
|
||||
var address by delegate(address)
|
||||
|
||||
/**
|
||||
* Server name (showed in eros)
|
||||
*/
|
||||
var name by delegate(name)
|
||||
|
||||
/**
|
||||
* Profiles to use for the connection to the server.
|
||||
* Changing profiles requires reconnect
|
||||
* If profile is unset, defaults to eros global profiles
|
||||
*/
|
||||
var profiles: MutableMap<ResourceLocation, String> by mapDelegate()
|
||||
|
||||
@get:JsonProperty("forced_version")
|
||||
@get:JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private var _forcedVersion by delegate(forcedVersion?.name)
|
||||
|
@ -14,6 +14,7 @@
|
||||
package de.bixilon.minosoft.gui.eros.main.play.server
|
||||
|
||||
import de.bixilon.minosoft.Minosoft
|
||||
import de.bixilon.minosoft.config.profile.ConnectionProfiles
|
||||
import de.bixilon.minosoft.config.profile.delegate.watcher.SimpleProfileDelegateLWatcher.Companion.profileWatchFX
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.server.entries.Server
|
||||
@ -117,6 +118,7 @@ class ServerListController : EmbeddedJavaFXController<Pane>(), Refreshable {
|
||||
address = ping.realAddress ?: DNSUtil.getServerAddress(server.address),
|
||||
account = account,
|
||||
version = serverCard.server.forcedVersion ?: pingVersion,
|
||||
profiles = ConnectionProfiles(ErosProfileManager.selected.general.profileOverrides.toMutableMap().apply { putAll(server.profiles) })
|
||||
)
|
||||
account.connections[server] = connection
|
||||
serverCard.connections += connection
|
||||
|
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.protocol.network.connection.play
|
||||
|
||||
import de.bixilon.minosoft.Minosoft
|
||||
import de.bixilon.minosoft.config.profile.ProfileCollection
|
||||
import de.bixilon.minosoft.config.profile.ConnectionProfiles
|
||||
import de.bixilon.minosoft.data.ChatTextPositions
|
||||
import de.bixilon.minosoft.data.accounts.Account
|
||||
import de.bixilon.minosoft.data.assets.MultiAssetsManager
|
||||
@ -70,7 +70,7 @@ class PlayConnection(
|
||||
val address: ServerAddress,
|
||||
val account: Account,
|
||||
val version: Version,
|
||||
val profiles: ProfileCollection = ProfileCollection(),
|
||||
val profiles: ConnectionProfiles = ConnectionProfiles(),
|
||||
) : Connection() {
|
||||
val settingsManager = ClientSettingsManager(this)
|
||||
val registries = Registries()
|
||||
|
Loading…
x
Reference in New Issue
Block a user