EffectiveLocale

abstract class EffectiveLocale

Base class for a plugin's localized messages.

The plugin must ship its language files under src/main/resources/languages/ (e.g. en.yml, ru.yml). On construction the class copies every bundled YAML from that folder into the plugin's data folder (plugins/<PluginName>/languages/), then loads the file for the language configured in EffectiveSpigot's own config (falling back to en.yml). Look up messages with getMessage (legacy string) or getComponent (Adventure component).

object ExampleLocale : EffectiveLocale() {
override fun getPlugin() = ExamplePlugin.instance
}
// ExampleLocale.getComponent("items.example.name")

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun getComponent(key: String, vararg args: Any): Component

Resolves key to an Adventure Component, applying String.format. Strings containing legacy codes (&c, §a) are parsed with the legacy serializer; otherwise MiniMessage is used (<red>, <gradient:...>). Returns the key itself (parsed) if missing.

Link copied to clipboard
fun getMessage(key: String, vararg args: Any): String

Resolves key to a legacy string, applying String.format and translating & color codes. Returns the key itself if missing.

Link copied to clipboard
abstract fun getPlugin(): JavaPlugin

The plugin whose languages/ resources and data folder are used.