API

Here you can find possible interfaces of the LanguageAPI to be able to use them in your plugin.

To include the LanguageAPI in your project, you can put the .jar file in the folder recources of your project and make this entry in the pom.xml under the dependencies:

pom.xml
<dependency>
    <groupId>de.herrtechniker</groupId>
    <artifactId>LanguageAPI</artifactId>
    <version>1.0-SNAPSHOT</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/LanguageAPI-1.0.0-SNAPSHOT-OBF.jar</systemPath>
</dependency>

Or for the BungeeCord version:

pom.xml
<dependency>
    <groupId>de.herrtechniker</groupId>
    <artifactId>LanguageAPI</artifactId>
    <version>1.0-SNAPSHOT</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/LanguageAPI-Bungee-1.0.0-SNAPSHOT-OBF.jar</systemPath>
</dependency>

LanguageAPI

To see if the player is already registered in the database, you can check it with the following query.

LanguageAPI().getApi().isPlayerEntryExists(UUID uuid); // return boolean

To get the language of the player, you can query the following.

LanguageAPI().getApi().getPlayerLanguage(UUID uuid); // return String

To set the player's language, do the following.

LanguageAPI().getApi().setPlayerLanguage(UUID uuid, String language);

To change the language, you can simply do the following.

LanguageAPI().getApi().changePlayerLanguage(UUID uuid, String language);

To add a language that you want your server network to support, you can do the following.

LanguageAPI().getApi().addSupportedLanguage(String language);

Of course, you can also remove a language that you have supported and no longer want to support. To do this, simply execute the following.

LanguageAPI().getApi().removeSupportedLanguage(String language);

To see if the language is already supported, you can do the following.

LanguageAPI().getApi().isLanguageSupported(String language); // return boolean

To get all supported languages in one list, simply execute the following

LanguageAPI().getApi().getAllSupportedLanguage(); // return List<String>

To see if the default language is set, do the following.

LanguageAPI().getApi().isDefaultLanguageSet(); // return boolean

To set the default language do the following.

LanguageAPI().getApi().setDefaultLanguage(String defaultLanguage);

To get the default language, perform the following.

LanguageAPI().getApi().getDefaultLanguage(); // return String

To change the default language, do the following.

LanguageAPI().getApi().changeDefaultLanguage(String defaultLanguage);

To see if the LanguageAPI is running in the multi-file system, run the following.

LanguageAPI().getApi().isMultiFile(); // return boolean

To get a message from the file from the single-file system, do the following.

LanguageAPI().getApi().getSingleFileMessage(String language, String path); // return String

To get a message from a file when multi-file system is enabled, do the following. Pass the name of the file as fileName.

LanguageAPI().getApi().getMultiFileMessage(String fileName, String language, String path); // return String

Namefetcher

The Namefetcher is a "module" which stores the name and the corresponding UUID of the player.

To check if a player's entry already exists, do the following.

LanguageAPI().getApi().isNamefetcherEntryExists(UUID uuid); // return boolean

To check if a player's entry already exists, do the following.

LanguageAPI().getApi().isNamefetcherEntryExists(String name); // return boolean

To enter an entry in the Namefetcher for a player, do the following.

Make sure that there is only one entry per player, if possible.

LanguageAPI().getApi().setNamefetcher(UUID uuid, String name);

To change a player's entry, for example if the player has changed his name, do the following.

LanguageAPI().getApi().changeNamefetcher(UUID uuid, String name);

To get the name of a player by UUID, do the following.

LanguageAPI().getApi().getName(UUID uuid); // return String

To get the UUID of a player by name, do the following.

LanguageAPI().getApi().getUUID(String name); // return UUID

Last updated