FileValue

class FileValue(name: String, default: File?, val dialogMode: FileDialogMode, val supportedExtensions: Set<String>?) : Value<File>

A value file input that supports different file dialog modes and optional file type filtering. It will be treated as a relative path if it starts with ConfigSystem.rootFolder.

Parameters

name

The name of the configuration option.

default

The default selected file. The default value is ConfigSystem.rootFolder.

dialogMode

Specifies the type of file dialog to show (e.g., open file, save file, choose folder).

supportedExtensions

A set of allowed file extensions (without the dot), e.g., setOf("txt", "json"). Use null to allow any file type. This is ignored if dialogMode is set to select directories.

Constructors

Link copied to clipboard
constructor(name: String, default: File?, dialogMode: FileDialogMode, supportedExtensions: Set<String>?)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The absolute file path.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

If true, value will not be included in generated public config

Link copied to clipboard
Link copied to clipboard

If true, value will always keep inner equals defaultValue

Link copied to clipboard
var key: String?
Link copied to clipboard
@SerializedName(value = "name")
val name: String
Link copied to clipboard

If true, value will not be included in generated RestAPI config

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun asStateFlow(): StateFlow<File>
Link copied to clipboard

Binds to the given input name.

fun Value<InputBind>.bind(key: InputConstants.Key, action: InputBind.BindAction, modifiers: Set<InputBind.Modifier>)

Binds to the given input type and code.

Link copied to clipboard
open override fun deserializeFrom(gson: Gson, element: JsonElement)

Deserialize value from JSON

Link copied to clipboard
Link copied to clipboard
fun doNotIncludeWhen(condition: () -> Boolean): Value<File>
Link copied to clipboard
fun get(): File
Link copied to clipboard
@JvmName(name = "getTagValue")
fun getTagValue(): Any
Link copied to clipboard
@JvmName(name = "getValue")
fun getValue(): Any

operator fun getValue(u: Any?, property: KProperty<*>): File

Support for delegated properties example: var autoaim by boolean(name = "autoaim", default = true) if(!autoaim) autoaim = true

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun restore()

Restore value to default value

Link copied to clipboard
fun set(t: File)
fun set(t: File, apply: Consumer<in File>)
Link copied to clipboard
open fun setByString(string: String)
Link copied to clipboard
@JvmName(name = "setValue")
fun setValue(t: Value): Result<Unit>
operator fun setValue(u: Any?, property: KProperty<*>, t: File)
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun <V : EventListener, Value<*>> FileValue.toTextureProperty(owner: V, printErrorToChat: Boolean = true): ReadOnlyProperty<Any?, DynamicTexture?>

Convert the FileValue to a ReadOnlyProperty of DynamicTexture.

Link copied to clipboard
Link copied to clipboard

Unbinds the key by setting it to UNKNOWN_KEY.