public class Translator
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Properly cleans up and closes the file watch service.
|
Translator |
debug(boolean debug) |
@NotNull java.io.File |
getFallback() |
@Nullable org.bukkit.configuration.file.FileConfiguration |
getFileConfiguration(@NotNull org.bukkit.entity.Player target)
Gets the language config for the specified player.
|
@NotNull HookedPlugin |
getHook() |
Language |
getLanguage(org.bukkit.entity.Player player) |
Translation |
getTranslationFor(@NotNull org.bukkit.entity.Player target,
@NotNull TranslationKey key)
Gets the translation for a player.
|
boolean |
isDebug() |
static Translator |
of(@NotNull org.bukkit.plugin.Plugin plugin)
Create a new translator.
|
static Translator |
of(@NotNull org.bukkit.plugin.Plugin plugin,
@NotNull Language defaultLanguage)
Create a new translator.
|
static Translator |
of(@NotNull org.bukkit.plugin.Plugin plugin,
@NotNull java.lang.String folderName,
@NotNull Language defaultLanguage)
Create a new translator.
|
Translator |
setFallback(java.io.File fallback)
Sets the fallback file
|
public void close()
public static Translator of(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
close() in your plugin's onDisable.plugin - your plugin instanceof(Plugin, Language),
of(Plugin, String, Language)public static Translator of(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull Language defaultLanguage)
close() in your plugin's onDisable.plugin - your plugin instancedefaultLanguage - the default language you wish to useof(Plugin),
of(Plugin, String, Language)public static Translator of(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull java.lang.String folderName, @NotNull @NotNull Language defaultLanguage)
close() in your plugin's onDisable.plugin - your plugin instancefolderName - the folder you wish to use for language files, this should match your resources folderdefaultLanguage - the default language you wish to useof(Plugin),
of(Plugin, Language)public Translator setFallback(java.io.File fallback)
fallback - fallback fileTranslator instance@NotNull public @NotNull HookedPlugin getHook()
public Translation getTranslationFor(@NotNull @NotNull org.bukkit.entity.Player target, @NotNull @NotNull TranslationKey key)
target - the target playerkey - the translation keypublic Language getLanguage(org.bukkit.entity.Player player)
@Nullable
public @Nullable org.bukkit.configuration.file.FileConfiguration getFileConfiguration(@NotNull
@NotNull org.bukkit.entity.Player target)
target - the target player@NotNull public @NotNull java.io.File getFallback()
public boolean isDebug()
public Translator debug(boolean debug)