mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 03:15:35 -04:00
profiles: replace almost all delegates with custom delegates
This commit is contained in:
parent
7d8672309e
commit
007633274c
@ -63,7 +63,7 @@ interface ProfileManager<T : Profile> {
|
||||
val profiles: AbstractMutableBiMap<String, T>
|
||||
var selected: T
|
||||
|
||||
@Deprecated("Should not be accessed") var currentLoadingPath: String?
|
||||
@Deprecated("Should not be accessed", level = DeprecationLevel.ERROR) var currentLoadingPath: String?
|
||||
|
||||
val baseDirectory: File
|
||||
get() = File(RunConfiguration.HOME_DIRECTORY + "config/" + namespace.namespace + "/")
|
||||
@ -92,7 +92,7 @@ interface ProfileManager<T : Profile> {
|
||||
return profile
|
||||
}
|
||||
|
||||
@Deprecated("")
|
||||
@Deprecated("", level = DeprecationLevel.ERROR)
|
||||
fun <V> delegate(value: V, verify: ((V) -> Unit)? = null): ProfileDelegate<V> {
|
||||
return ProfileDelegate(value, this, currentLoadingPath ?: throw IllegalAccessException("Delegate can only be created while loading or creating profiles!"), verify)
|
||||
}
|
||||
@ -106,17 +106,17 @@ interface ProfileManager<T : Profile> {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("")
|
||||
@Deprecated("", level = DeprecationLevel.ERROR)
|
||||
fun <K, V> mapDelegate(default: MutableMap<K, V> = mutableMapOf(), verify: ((MapChangeListener.Change<out K, out V>) -> Unit)? = null): MapDelegateProfile<K, V> {
|
||||
return MapDelegateProfile(FXCollections.synchronizedObservableMap(FXCollections.observableMap(default)), profileManager = this, profileName = currentLoadingPath ?: throw IllegalAccessException("Delegate can only be created while loading or creating profiles!"), verify = verify)
|
||||
}
|
||||
|
||||
@Deprecated("")
|
||||
@Deprecated("", level = DeprecationLevel.ERROR)
|
||||
fun <V> listDelegate(default: MutableList<V> = mutableListOf(), verify: ((ListChangeListener.Change<out V>) -> Unit)? = null): ListDelegateProfile<V> {
|
||||
return ListDelegateProfile(FXCollections.synchronizedObservableList(FXCollections.observableList(default)), profileManager = this, profileName = currentLoadingPath ?: throw IllegalAccessException("Delegate can only be created while loading or creating profiles!"), verify = verify)
|
||||
}
|
||||
|
||||
@Deprecated("")
|
||||
@Deprecated("", level = DeprecationLevel.ERROR)
|
||||
fun <V> setDelegate(default: MutableSet<V> = mutableSetOf(), verify: ((SetChangeListener.Change<out V>) -> Unit)? = null): SetDelegateProfile<V> {
|
||||
return SetDelegateProfile(FXCollections.synchronizedObservableSet(FXCollections.observableSet(default)), profileManager = this, profileName = currentLoadingPath ?: throw IllegalAccessException("Delegate can only be created while loading or creating profiles!"), verify = verify)
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
open class BooleanDelegate(
|
||||
override val profile: Profile,
|
||||
default: Boolean,
|
||||
name: String,
|
||||
name: String = "",
|
||||
) : SimpleDelegate<Boolean>(profile, default, name) {
|
||||
|
||||
override fun validate(value: Boolean) = Unit
|
||||
|
@ -11,8 +11,9 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.config.profile.delegate
|
||||
package de.bixilon.minosoft.config.profile.delegate.types
|
||||
|
||||
import de.bixilon.minosoft.config.profile.delegate.SimpleDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.config.profile.delegate.types
|
||||
|
||||
import de.bixilon.kutil.enums.ValuesEnum
|
||||
import de.bixilon.minosoft.config.profile.delegate.SimpleDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
|
||||
open class EnumDelegate<T : Enum<*>>(
|
||||
override val profile: Profile,
|
||||
default: T,
|
||||
values: ValuesEnum<T>,
|
||||
name: String = "",
|
||||
) : SimpleDelegate<T>(profile, default, name) {
|
||||
|
||||
override fun validate(value: T) = Unit
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.config.profile.delegate.types
|
||||
|
||||
import de.bixilon.minosoft.config.profile.delegate.SimpleDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
|
||||
open class LanguageDelegate(
|
||||
override val profile: Profile,
|
||||
default: String?,
|
||||
name: String = "",
|
||||
) : SimpleDelegate<String?>(profile, default, name) {
|
||||
|
||||
override fun validate(value: String?) = Unit
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.config.profile.delegate.types
|
||||
|
||||
import de.bixilon.minosoft.config.profile.delegate.SimpleDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
|
||||
open class NullableStringDelegate(
|
||||
override val profile: Profile,
|
||||
default: String?,
|
||||
name: String = "",
|
||||
) : SimpleDelegate<String?>(profile, default, name) {
|
||||
|
||||
override fun validate(value: String?) = Unit
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.config.profile.delegate.types
|
||||
|
||||
import de.bixilon.minosoft.config.profile.delegate.SimpleDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
|
||||
open class StringDelegate(
|
||||
override val profile: Profile,
|
||||
default: String,
|
||||
name: String = "",
|
||||
) : SimpleDelegate<String>(profile, default, name) {
|
||||
|
||||
override fun validate(value: String) = Unit
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.config.profile.delegate.types.map
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
|
||||
class LogDelegate(
|
||||
override val profile: Profile,
|
||||
default: MutableMap<LogMessageType, LogLevels>,
|
||||
name: String = "",
|
||||
) : MapDelegate<LogMessageType, LogLevels>(profile, default, name)
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.config.profile.delegate.types.map
|
||||
|
||||
import de.bixilon.kutil.observer.map.MapObserver
|
||||
import de.bixilon.minosoft.config.profile.delegate.AbstractDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.util.KUtil.minosoft
|
||||
|
||||
abstract class MapDelegate<K, V>(
|
||||
override val profile: Profile,
|
||||
default: MutableMap<K, V>,
|
||||
name: String,
|
||||
) : MapObserver<K, V>(default), AbstractDelegate<MutableMap<K, V>> {
|
||||
override val name = minosoft(name)
|
||||
override val description = minosoft("$name.description")
|
||||
|
||||
override fun get() = value
|
||||
override fun set(value: MutableMap<K, V>) {
|
||||
validate(value)
|
||||
this.value.unsafe = value
|
||||
}
|
||||
|
||||
override fun validate(value: MutableMap<K, V>) = Unit
|
||||
}
|
@ -19,9 +19,11 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.random.RandomStringUtil.randomString
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.NullableStringDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.account.AccountProfileManager.backingDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.account.AccountProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.account.AccountProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.account.AccountProfileManager.mapDelegate
|
||||
import de.bixilon.minosoft.data.accounts.Account
|
||||
@ -40,20 +42,20 @@ class AccountProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
/**
|
||||
* The client token.
|
||||
* This 128 length long string is generated randomly while the profile was created
|
||||
* Will be sent to mojang when logging in/refreshing an account
|
||||
*/
|
||||
var clientToken by delegate(KUtil.RANDOM.randomString(128))
|
||||
var clientToken by StringDelegate(this, KUtil.RANDOM.randomString(128))
|
||||
|
||||
/**
|
||||
* Before using an account, it always tries to fetch the profile.
|
||||
* If the fetch is successful, we can be sure that the account is working.
|
||||
*/
|
||||
var alwaysFetchProfile by delegate(true)
|
||||
var alwaysFetchProfile by BooleanDelegate(this, true)
|
||||
|
||||
/**
|
||||
* All accounts
|
||||
@ -66,7 +68,7 @@ class AccountProfile(
|
||||
* The current id of the selected account
|
||||
*/
|
||||
@get:JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@get:JsonProperty("selected") private var _selected: String? by delegate(null)
|
||||
@get:JsonProperty("selected") private var _selected: String? by NullableStringDelegate(this, null)
|
||||
|
||||
@get:JsonIgnore var selected: Account? by backingDelegate(getter = { entries[_selected] }, setter = { _selected = it?.id })
|
||||
|
||||
|
@ -16,8 +16,8 @@ package de.bixilon.minosoft.config.profile.profiles.audio
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.audio.AudioProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.audio.AudioProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.audio.gui.GuiC
|
||||
import de.bixilon.minosoft.config.profile.profiles.audio.types.TypesC
|
||||
@ -36,7 +36,7 @@ class AudioProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
/**
|
||||
* Skips the loading od the AudioPlayer
|
||||
|
@ -16,8 +16,8 @@ package de.bixilon.minosoft.config.profile.profiles.block
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.IntDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.block.BlockProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.block.BlockProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.block.outline.OutlineC
|
||||
import de.bixilon.minosoft.config.profile.profiles.block.rendering.RenderingC
|
||||
@ -36,7 +36,7 @@ class BlockProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
/**
|
||||
* The block view distance in chunks.
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.block.outline
|
||||
|
||||
import de.bixilon.minosoft.config.profile.delegate.ColorDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.ColorDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.block.BlockProfile
|
||||
import de.bixilon.minosoft.data.text.formatting.color.ChatColors
|
||||
|
||||
|
@ -15,8 +15,11 @@ package de.bixilon.minosoft.config.profile.profiles.connection
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.EnumDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.LanguageDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.signature.SignatureC
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.skin.SkinC
|
||||
@ -35,35 +38,35 @@ class ConnectionProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
/**
|
||||
* Language for language files.
|
||||
* Will be sent to the server
|
||||
* If unset (null), uses eros language
|
||||
*/
|
||||
var language: String? by delegate(null)
|
||||
var language: String? by LanguageDelegate(this, null)
|
||||
|
||||
/**
|
||||
* If false, the server should not list us the ping player list
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var playerListing by delegate(true)
|
||||
var playerListing by BooleanDelegate(this, true)
|
||||
|
||||
/**
|
||||
* Main arm to use
|
||||
*/
|
||||
var mainArm by delegate(Arms.RIGHT)
|
||||
var mainArm by EnumDelegate(this, Arms.RIGHT)
|
||||
|
||||
val skin = SkinC()
|
||||
val signature = SignatureC()
|
||||
val skin = SkinC(this)
|
||||
val signature = SignatureC(this)
|
||||
|
||||
var autoRespawn by delegate(false)
|
||||
var autoRespawn by BooleanDelegate(this, false)
|
||||
|
||||
/**
|
||||
* If set, the client will respond with "vanilla" as brand and not "minosoft"
|
||||
*/
|
||||
var fakeBrand by delegate(false)
|
||||
var fakeBrand by BooleanDelegate(this, false)
|
||||
|
||||
override fun toString(): String {
|
||||
return ConnectionProfileManager.getName(this)
|
||||
|
@ -13,27 +13,28 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.connection.signature
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfile
|
||||
|
||||
class SignatureC {
|
||||
class SignatureC(profile: ConnectionProfile) {
|
||||
|
||||
/**
|
||||
* Hides all bad signed messages
|
||||
*/
|
||||
val ignoreBadSignedMessages by delegate(false)
|
||||
val ignoreBadSignedMessages by BooleanDelegate(profile, false)
|
||||
|
||||
/**
|
||||
* Does not fetch/load the private key, thus forcing the unsigned mode
|
||||
*/
|
||||
val disableKeys by delegate(false)
|
||||
val disableKeys by BooleanDelegate(profile, false)
|
||||
|
||||
/**
|
||||
* Send commands as message
|
||||
*/
|
||||
val sendCommandAsMessage by delegate(false)
|
||||
val sendCommandAsMessage by BooleanDelegate(profile, false)
|
||||
|
||||
/**
|
||||
* Signs commands
|
||||
*/
|
||||
val signCommands by delegate(true)
|
||||
val signCommands by BooleanDelegate(profile, true)
|
||||
}
|
||||
|
@ -14,51 +14,52 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.connection.skin
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfile
|
||||
import de.bixilon.minosoft.data.entities.entities.player.SkinParts
|
||||
|
||||
class SkinC {
|
||||
class SkinC(profile: ConnectionProfile) {
|
||||
/**
|
||||
* The cape of use will be hidden
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var cape by delegate(true)
|
||||
var cape by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* The jacket of use will be hidden
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var jacket by delegate(true)
|
||||
var jacket by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* The left sleeve of use will be hidden
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var leftSleeve by delegate(true)
|
||||
var leftSleeve by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* The right sleeve of use will be hidden
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var rightSleeve by delegate(true)
|
||||
var rightSleeve by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* The left pants of use will be hidden
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var leftPants by delegate(true)
|
||||
var leftPants by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* The right pants of use will be hidden
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var rightPants by delegate(true)
|
||||
var rightPants by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* The hat of use will be hidden
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var hat by delegate(true)
|
||||
var hat by BooleanDelegate(profile, true)
|
||||
|
||||
|
||||
@get:JsonIgnore val skinParts: Array<SkinParts>
|
||||
|
@ -16,8 +16,8 @@ package de.bixilon.minosoft.config.profile.profiles.controls
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.config.key.KeyBinding
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfileManager.mapDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.interaction.InteractionC
|
||||
@ -37,13 +37,13 @@ class ControlsProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
var keyBindings: MutableMap<ResourceLocation, KeyBinding> by mapDelegate()
|
||||
private set
|
||||
|
||||
val mouse = MouseC()
|
||||
val interaction = InteractionC()
|
||||
val mouse = MouseC(this)
|
||||
val interaction = InteractionC(this)
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
|
@ -13,22 +13,23 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.controls.interaction
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfile
|
||||
|
||||
class InteractionC {
|
||||
class InteractionC(profile: ControlsProfile) {
|
||||
|
||||
/**
|
||||
* Enables or disables right-clicking with a shovel on grass (…) to create grass paths
|
||||
*/
|
||||
var flattening by delegate(true)
|
||||
var flattening by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* Enables right-clicking with an axe on any logs to create stripped logs
|
||||
*/
|
||||
var stripping by delegate(true)
|
||||
var stripping by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* Enables right-clicking with a hoe on grass (…) to create farmland
|
||||
*/
|
||||
var tilling by delegate(true)
|
||||
var tilling by BooleanDelegate(profile, true)
|
||||
}
|
||||
|
@ -13,20 +13,21 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.controls.mouse
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.FloatDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.controls.ControlsProfile
|
||||
|
||||
class MouseC {
|
||||
class MouseC(profile: ControlsProfile) {
|
||||
|
||||
/**
|
||||
* Mouse sensitivity in percent
|
||||
* Controls how fast the mouse rotates the player around
|
||||
* Must be non-negative
|
||||
*/
|
||||
var sensitivity by delegate(1.0f) { check(it > 0.0f) { "Must be non-negative!" } }
|
||||
var sensitivity by FloatDelegate(profile, 1.0f, "", arrayOf(0.01f..10.0f))
|
||||
|
||||
/**
|
||||
* Controls how fast you scroll (e.g. in the hotbar)
|
||||
* Must be non-negative
|
||||
*/
|
||||
var scrollSensitivity by delegate(1.0) { check(it > 0.0) { "Must be non-negative!" } }
|
||||
var scrollSensitivity by FloatDelegate(profile, 1.0f, "", arrayOf(0.01f..10.0f))
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ package de.bixilon.minosoft.config.profile.profiles.entity
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.EntityProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.EntityProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.hitbox.HitboxC
|
||||
|
||||
@ -33,10 +33,10 @@ class EntityProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
|
||||
val hitbox = HitboxC()
|
||||
val hitbox = HitboxC(this)
|
||||
|
||||
override fun toString(): String {
|
||||
return EntityProfileManager.getName(this)
|
||||
|
@ -13,33 +13,34 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.entity.hitbox
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.EntityProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.EntityProfile
|
||||
|
||||
class HitboxC {
|
||||
class HitboxC(profile: EntityProfile) {
|
||||
/**
|
||||
* Enables or disables hit-boxes for all entities
|
||||
*/
|
||||
var enabled by delegate(true)
|
||||
var enabled by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* Shows your own hit-box when in first person view
|
||||
*/
|
||||
var showLocal by delegate(false)
|
||||
var showLocal by BooleanDelegate(profile, false)
|
||||
|
||||
/**
|
||||
* Shows hit-boxes from invisible entities
|
||||
*/
|
||||
var showInvisible by delegate(false)
|
||||
var showInvisible by BooleanDelegate(profile, false)
|
||||
|
||||
/**
|
||||
* If true: Shows full colored hit-boxes (aka. lazy boxes).
|
||||
* If false: Shows just the outline of the hit-box
|
||||
*/
|
||||
var lazy by delegate(false)
|
||||
var lazy by BooleanDelegate(profile, false)
|
||||
|
||||
/**
|
||||
* Disables the z-buffer when rendering
|
||||
* => Shows the boxes through walls
|
||||
*/
|
||||
var showThroughWalls by delegate(false)
|
||||
var showThroughWalls by BooleanDelegate(profile, false)
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ package de.bixilon.minosoft.config.profile.profiles.eros
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.general.GeneralC
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.server.ServerC
|
||||
@ -36,13 +36,13 @@ class ErosProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
|
||||
val general = GeneralC()
|
||||
val theme = ThemeC()
|
||||
val server = ServerC()
|
||||
val text = TextC()
|
||||
val general = GeneralC(this)
|
||||
val theme = ThemeC(this)
|
||||
val server = ServerC(this)
|
||||
val text = TextC(this)
|
||||
|
||||
override fun toString(): String {
|
||||
return ErosProfileManager.getName(this)
|
||||
|
@ -16,21 +16,24 @@ package de.bixilon.minosoft.config.profile.profiles.eros.general
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import de.bixilon.kutil.locale.LanguageUtil.fullName
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.NullableStringDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
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.ErosProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.mapDelegate
|
||||
import de.bixilon.minosoft.data.language.LanguageUtil
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import java.util.*
|
||||
|
||||
class GeneralC {
|
||||
class GeneralC(profile: ErosProfile) {
|
||||
/**
|
||||
* Language to use for eros. This is also the fallback language for other profiles
|
||||
*/
|
||||
var language: String by delegate(Locale.getDefault()?.fullName ?: LanguageUtil.FALLBACK_LANGUAGE)
|
||||
var language: String by StringDelegate(profile, Locale.getDefault()?.fullName ?: LanguageUtil.FALLBACK_LANGUAGE)
|
||||
|
||||
@get:JsonProperty("account_profile") private var _accountProfile: String? by delegate(null)
|
||||
@get:JsonProperty("account_profile") private var _accountProfile: String? by NullableStringDelegate(profile, null)
|
||||
|
||||
@get:JsonIgnore var accountProfile: AccountProfile
|
||||
get() = AccountProfileManager.profiles[_accountProfile] ?: AccountProfileManager.selected
|
||||
@ -48,11 +51,11 @@ class GeneralC {
|
||||
/**
|
||||
* Renders the skin overlay (hat) above the head (used for avatars)
|
||||
*/
|
||||
var renderSkinOverlay by delegate(true)
|
||||
var renderSkinOverlay by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* Hides eros (all eros windows) once a connection with a server is successfully established.
|
||||
* Will also show it again, once it got disconnected
|
||||
*/
|
||||
var hideErosOnceConnected by delegate(false)
|
||||
var hideErosOnceConnected by BooleanDelegate(profile, false)
|
||||
}
|
||||
|
@ -14,14 +14,15 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.eros.server
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.listDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.server.entries.Server
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.server.list.ListC
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.server.modify.ModifyC
|
||||
|
||||
class ServerC {
|
||||
val modify = ModifyC()
|
||||
val list = ListC()
|
||||
class ServerC(profile: ErosProfile) {
|
||||
val modify = ModifyC(profile)
|
||||
val list = ListC(profile)
|
||||
|
||||
@get:JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
var entries: MutableList<Server> by listDelegate()
|
||||
|
@ -13,21 +13,26 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.eros.server.list
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfile
|
||||
|
||||
class ListC {
|
||||
class ListC(profile: ErosProfile) {
|
||||
/**
|
||||
* Hides all servers in the server list that can not be pinged
|
||||
*/
|
||||
var hideOffline by delegate(false)
|
||||
var hideOffline by BooleanDelegate(profile, false)
|
||||
|
||||
/**
|
||||
* Hides all servers in the server list, when the amount of online players exceeds the slots
|
||||
*/
|
||||
var hideFull by delegate(false)
|
||||
|
||||
/**
|
||||
* Hides all servers in the server list, when the amount of online players exceeds the slots
|
||||
*/
|
||||
var hideFull by BooleanDelegate(profile, false)
|
||||
|
||||
/**
|
||||
* Hides all servers in the server list when <= 0 players are online
|
||||
*/
|
||||
var hideEmpty by delegate(false)
|
||||
var hideEmpty by BooleanDelegate(profile, false)
|
||||
}
|
||||
|
@ -13,19 +13,20 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.eros.server.modify
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfile
|
||||
|
||||
/**
|
||||
* Configuration for the add or edit server dialog
|
||||
*/
|
||||
class ModifyC {
|
||||
class ModifyC(profile: ErosProfile) {
|
||||
/**
|
||||
* Shows releases in the version select dropdown
|
||||
*/
|
||||
var showReleases by delegate(true)
|
||||
var showReleases by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* Shows snapshots in the version select dropdown
|
||||
*/
|
||||
var showSnapshots by delegate(false)
|
||||
var showSnapshots by BooleanDelegate(profile, false)
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,19 +13,20 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.eros.text
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfile
|
||||
|
||||
class TextC {
|
||||
class TextC(profile: ErosProfile) {
|
||||
|
||||
/**
|
||||
* Displays colored text
|
||||
* If disables it displays the css defined language (defaults to white)
|
||||
*/
|
||||
var colored by delegate(true)
|
||||
var colored by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* Enables the obfuscated formatting style
|
||||
* If false, the text will just blink
|
||||
*/
|
||||
var obfuscated by delegate(true)
|
||||
var obfuscated by BooleanDelegate(profile, true)
|
||||
}
|
||||
|
@ -13,13 +13,14 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.eros.theme
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfile
|
||||
|
||||
class ThemeC {
|
||||
class ThemeC(profile: ErosProfile) {
|
||||
|
||||
/**
|
||||
* Name of the theme css file
|
||||
* Located in minosoft:eros/themes/<name>.css
|
||||
*/
|
||||
var theme by delegate("default")
|
||||
var theme by StringDelegate(profile, "default")
|
||||
}
|
||||
|
@ -15,8 +15,9 @@ package de.bixilon.minosoft.config.profile.profiles.gui
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.FloatDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.chat.ChatC
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.confirmation.ConfirmationC
|
||||
@ -36,18 +37,18 @@ class GUIProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
/**
|
||||
* The scale of the hud
|
||||
* Must be non-negative
|
||||
*/
|
||||
var scale by delegate(2.0f) { check(it >= 0.0f) { "GUI scale must be non-negative" } }
|
||||
var scale by FloatDelegate(this, 2.0f, "", arrayOf(1.0f..10.0f))
|
||||
|
||||
val chat = ChatC()
|
||||
val hud = HudC()
|
||||
val confirmation = ConfirmationC()
|
||||
val sign = SignC()
|
||||
val chat = ChatC(this)
|
||||
val hud = HudC(this)
|
||||
val confirmation = ConfirmationC(this)
|
||||
val sign = SignC(this)
|
||||
|
||||
override fun toString(): String {
|
||||
return GUIProfileManager.getName(this)
|
||||
|
@ -13,44 +13,47 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.gui.chat
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.IntDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.EnumDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.chat.internal.InternalC
|
||||
import de.bixilon.minosoft.protocol.packets.c2s.play.SettingsC2SP
|
||||
|
||||
class ChatC {
|
||||
val internal = InternalC()
|
||||
class ChatC(profile: GUIProfile) {
|
||||
val internal = InternalC(profile)
|
||||
|
||||
/**
|
||||
* Hides the chat
|
||||
*/
|
||||
var hidden by delegate(false)
|
||||
var hidden by BooleanDelegate(profile, false)
|
||||
|
||||
/**
|
||||
* The width of the chat in scaled pixels
|
||||
*/
|
||||
var width by delegate(320)
|
||||
var width by IntDelegate(profile, 320, "", arrayOf(100..500))
|
||||
|
||||
/**
|
||||
* The height of the chat in scaled pixels
|
||||
*/
|
||||
var height by delegate(180)
|
||||
var height by IntDelegate(profile, 180, "", arrayOf(40..500))
|
||||
|
||||
/**
|
||||
* ToDo: Unknown purpose
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var textFiltering by delegate(false) // ToDo: Implement in the client
|
||||
var textFiltering by BooleanDelegate(profile, false) // ToDo: Implement in the client
|
||||
|
||||
/**
|
||||
* If false, the chat will appear in white
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var chatColors by delegate(true) // ToDo: Implement in the client
|
||||
var chatColors by BooleanDelegate(profile, true) // ToDo: Implement in the client
|
||||
|
||||
/**
|
||||
* Chat mode
|
||||
* Will be sent to the server
|
||||
*/
|
||||
var chatMode by delegate(SettingsC2SP.ChatModes.EVERYTHING)
|
||||
var chatMode by EnumDelegate(profile, SettingsC2SP.ChatModes.EVERYTHING, SettingsC2SP.ChatModes)
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,22 +13,24 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.gui.chat.internal
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.IntDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfile
|
||||
|
||||
class InternalC {
|
||||
class InternalC(profile: GUIProfile) {
|
||||
|
||||
/**
|
||||
* Hides the internal chat
|
||||
*/
|
||||
var hidden by delegate(false)
|
||||
var hidden by BooleanDelegate(profile, false)
|
||||
|
||||
/**
|
||||
* The width of the internal chat in scaled pixels
|
||||
*/
|
||||
var width by delegate(320)
|
||||
var width by IntDelegate(profile, 320, "", arrayOf(100..500))
|
||||
|
||||
/**
|
||||
* The height of the internal chat in scaled pixels
|
||||
*/
|
||||
var height by delegate(180)
|
||||
var height by IntDelegate(profile, 180, "", arrayOf(40..500))
|
||||
}
|
||||
|
@ -13,11 +13,12 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.gui.confirmation
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfile
|
||||
|
||||
class ConfirmationC {
|
||||
var copyToClipboard by delegate(true)
|
||||
var openFile by delegate(true)
|
||||
var openURL by delegate(true)
|
||||
var sendMessage by delegate(true)
|
||||
class ConfirmationC(profile: GUIProfile) {
|
||||
var copyToClipboard by BooleanDelegate(profile, true)
|
||||
var openFile by BooleanDelegate(profile, true)
|
||||
var openURL by BooleanDelegate(profile, true)
|
||||
var sendMessage by BooleanDelegate(profile, true)
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2022 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,10 +13,11 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.gui.hud
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.hud.crosshair.CrosshairC
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.hud.hotbar.HotbarC
|
||||
|
||||
class HudC {
|
||||
val crosshair = CrosshairC()
|
||||
val hotbar = HotbarC()
|
||||
class HudC(profile: GUIProfile) {
|
||||
val crosshair = CrosshairC(profile)
|
||||
val hotbar = HotbarC(profile)
|
||||
}
|
||||
|
@ -13,17 +13,19 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.gui.hud.crosshair
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.ColorDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfile
|
||||
import de.bixilon.minosoft.data.text.formatting.color.ChatColors
|
||||
|
||||
class CrosshairC {
|
||||
class CrosshairC(profile: GUIProfile) {
|
||||
/**
|
||||
* Inverts the color of the crosshair according to the background color
|
||||
*/
|
||||
var complementaryColor by delegate(true)
|
||||
var complementaryColor by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* The color of the crosshair
|
||||
*/
|
||||
var color by delegate(ChatColors.WHITE)
|
||||
var color by ColorDelegate(profile, ChatColors.WHITE, "")
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2022 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,8 +13,9 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.gui.hud.hotbar
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfile
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.hud.hotbar.hunger.HungerC
|
||||
|
||||
class HotbarC {
|
||||
val hunger = HungerC()
|
||||
class HotbarC(profile: GUIProfile) {
|
||||
val hunger = HungerC(profile)
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2022 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,13 +13,14 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.gui.hud.hotbar.hunger
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfile
|
||||
|
||||
class HungerC {
|
||||
class HungerC(profile: GUIProfile) {
|
||||
/**
|
||||
* Minecraft does not show the saturation by default.
|
||||
* Enabling this option will show how much saturation you have
|
||||
* Enabled by default, might break texture packs
|
||||
*/
|
||||
val saturationBar by delegate(true)
|
||||
val saturationBar by BooleanDelegate(profile, true)
|
||||
}
|
||||
|
@ -13,8 +13,9 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.gui.sign
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.gui.GUIProfile
|
||||
|
||||
class SignC {
|
||||
var limitLength by delegate(true)
|
||||
class SignC(profile: GUIProfile) {
|
||||
var limitLength by BooleanDelegate(profile, true)
|
||||
}
|
||||
|
@ -15,8 +15,9 @@ package de.bixilon.minosoft.config.profile.profiles.other
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.log.LogC
|
||||
|
||||
@ -33,19 +34,19 @@ class OtherProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
/**
|
||||
* Use native network transport if available
|
||||
*/
|
||||
var nativeNetwork by delegate(true)
|
||||
var nativeNetwork by BooleanDelegate(this, true)
|
||||
|
||||
/**
|
||||
* Listens for servers on your LAN network
|
||||
*/
|
||||
var listenLAN by delegate(true)
|
||||
var listenLAN by BooleanDelegate(this, true)
|
||||
|
||||
val log = LogC()
|
||||
val log = LogC(this)
|
||||
|
||||
override fun toString(): String {
|
||||
return OtherProfileManager.getName(this)
|
||||
|
@ -13,23 +13,24 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.other.log
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager.mapDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.map.LogDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfile
|
||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
|
||||
class LogC {
|
||||
class LogC(profile: OtherProfile) {
|
||||
|
||||
/**
|
||||
* Hides various messages (e.g. chunk receiving, entity position updates, ...)
|
||||
* Only relevant if packet logging is on VERBOSE
|
||||
*/
|
||||
var reducedProtocolLog by delegate(true)
|
||||
var reducedProtocolLog by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* All log message types mapped to its log level
|
||||
* @see de.bixilon.minosoft.util.logging.LogLevels
|
||||
* @see de.bixilon.minosoft.util.logging.LogMessageType
|
||||
*/
|
||||
var levels by mapDelegate(LogMessageType.DEFAULT_LOG_MAP.toMutableMap())
|
||||
var levels by LogDelegate(profile, LogMessageType.DEFAULT_LOG_MAP.toMutableMap())
|
||||
private set
|
||||
}
|
||||
|
@ -15,8 +15,10 @@ package de.bixilon.minosoft.config.profile.profiles.particle
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.IntDelegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.particle.ParticleProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.particle.ParticleProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.particle.types.TypesC
|
||||
import de.bixilon.minosoft.gui.rendering.RenderConstants
|
||||
@ -34,18 +36,18 @@ class ParticleProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
/**
|
||||
* Skips the loading of the particle render. Requires to reload the renderer!
|
||||
*/
|
||||
var skipLoading by delegate(false)
|
||||
var skipLoading by BooleanDelegate(this, false)
|
||||
|
||||
/**
|
||||
* Enabled or disables particle renderer
|
||||
* Does not skip loading of particles
|
||||
*/
|
||||
var enabled by delegate(true)
|
||||
var enabled by BooleanDelegate(this, true)
|
||||
|
||||
/**
|
||||
* View distance for particles
|
||||
@ -53,7 +55,7 @@ class ParticleProfile(
|
||||
*
|
||||
* @see de.bixilon.minosoft.config.profile.profiles.block.BlockProfile.viewDistance
|
||||
*/
|
||||
var viewDistance by delegate(10) { check(it in 0..128) { "Distance must be non-negative and must not exceed 128" } }
|
||||
var viewDistance by IntDelegate(this, 10, "", arrayOf(0..128))
|
||||
|
||||
/**
|
||||
* Limits the number of particles.
|
||||
@ -61,9 +63,8 @@ class ParticleProfile(
|
||||
* Must not be negative or exceed $RenderConstants.MAXIMUM_PARTICLE_AMOUNT
|
||||
* @see RenderConstants.MAXIMUM_PARTICLE_AMOUNT
|
||||
*/
|
||||
var maxAmount by delegate(RenderConstants.MAXIMUM_PARTICLE_AMOUNT) { check(it in 0..RenderConstants.MAXIMUM_PARTICLE_AMOUNT) { "Particle amount must be non-negative and may not exceed ${RenderConstants.MAXIMUM_PARTICLE_AMOUNT}" } }
|
||||
|
||||
val types = TypesC()
|
||||
var maxAmount by IntDelegate(this, RenderConstants.MAXIMUM_PARTICLE_AMOUNT, "", arrayOf(0..RenderConstants.MAXIMUM_PARTICLE_AMOUNT))
|
||||
val types = TypesC(this)
|
||||
|
||||
override fun toString(): String {
|
||||
return ParticleProfileManager.getName(this)
|
||||
|
@ -13,16 +13,17 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.particle.types
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.particle.ParticleProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.particle.ParticleProfile
|
||||
|
||||
class TypesC {
|
||||
class TypesC(profile: ParticleProfile) {
|
||||
/**
|
||||
* Shows particles from explosions
|
||||
*/
|
||||
var explosions by delegate(true)
|
||||
var explosions by BooleanDelegate(profile, true)
|
||||
|
||||
/**
|
||||
* Shows custom particles
|
||||
*/
|
||||
var packet by delegate(true)
|
||||
var packet by BooleanDelegate(profile, true)
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ package de.bixilon.minosoft.config.profile.profiles.rendering
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.rendering.advanced.AdvancedC
|
||||
import de.bixilon.minosoft.config.profile.profiles.rendering.animations.AnimationsC
|
||||
@ -43,7 +43,7 @@ class RenderingProfile(
|
||||
override var saved: Boolean = true
|
||||
override var ignoreNextReload: Boolean = false
|
||||
override val version: Int = latestVersion
|
||||
override var description by delegate(description ?: "")
|
||||
override var description by StringDelegate(this, description ?: "")
|
||||
|
||||
val advanced = AdvancedC(this)
|
||||
val animations = AnimationsC(this)
|
||||
|
Loading…
x
Reference in New Issue
Block a user