setPluginPlayerPref

fun setPluginPlayerPref(pluginKey: String, prefKey: String, value: Any)

Sets a plugin-specific preference value.

This method creates or updates a preference within a plugin's namespace. If the plugin namespace doesn't exist, it's created automatically. The operation marks the data as dirty for database persistence.

Namespace Management: Plugin namespaces are created on-demand using computeIfAbsent(), ensuring that each plugin has its own isolated preference space without conflicts between different plugins.

Usage Examples:

playerData.setPluginPlayerPref("MyPlugin", "enabled", true)
playerData.setPluginPlayerPref("Skills", "last_used", System.currentTimeMillis())
playerData.setPluginPlayerPref("RPG", "inventory_config", mapOf("sorted" to true))

Side Effects:

  • Creates plugin namespace if it doesn't exist

  • Updates or creates the preference key within the namespace

  • Marks PlayerData as dirty for database persistence

  • Value must be JSON-serializable for database storage

Parameters

pluginKey

The plugin identifier/namespace

prefKey

The specific preference key within the plugin namespace

value

The value to store (must be JSON-serializable)

See also