API: Add methods to get a locale from the locales file

This commit is contained in:
William278 committed 2022-09-04 23:42:43 +03:00
1 parent 0ee8c97a6e
commit a0c34743ef
1 file changed
+26
@@ -1,6 +1,8 @@
package net.william278.huskhomes.api;
import de.themoep.minedown.MineDown;
import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.config.Locales;
import net.william278.huskhomes.player.OnlineUser;
import net.william278.huskhomes.player.User;
import net.william278.huskhomes.player.UserData;
@@ -268,4 +270,28 @@ public abstract class BaseHuskHomesAPI {
plugin.setRandomTeleportEngine(randomTeleportEngine);
}
/**
* Get a {@link MineDown}-formatted locale by key from the plugin {@link Locales} file
*
* @param localeKey The key of the locale to get
* @param replacements Replacement strings to apply to the locale
* @return The {@link MineDown}-formatted locale
* @since 3.0
*/
public final Optional<MineDown> getLocale(@NotNull String localeKey, @NotNull String... replacements) {
return plugin.getLocales().getLocale(localeKey, replacements);
}
/**
* Get a raw locale string by key from the plugin {@link Locales} file
*
* @param localeKey The key of the locale to get
* @param replacements Replacement strings to apply to the locale
* @return The raw locale string
* @since 3.0
*/
public final Optional<String> getRawLocale(@NotNull String localeKey, @NotNull String... replacements) {
return plugin.getLocales().getRawLocale(localeKey, replacements);
}
}