API

This API allows you, plugin coder, to have your internal messages translated in real time directly to player location without additional files and no confugiration.

To use this API follow this steps:


Dependency

Include the plugin as an API on your pom.xml or IDE. Heres the code to include as pom.xml:

                <dependency>
			<groupId>UltimateTranslate</groupId>
			<artifactId>UltimateTranslate</artifactId>
			<version>v1.2</version>
			<scope>system</scope>
			<systemPath>"yourAPIPath"/UltimateTranslate.jar</systemPath>
		</dependency>

Invoque Methods

To start use the API methods and include in your plugin, include this package:

import br.net.FabioZumbi12.UltimateTranslate.API

Now you can invoque methods from class UltimateAPI.


Usage

You can use this API as optional. An exemple to check if the API is installed is:

package com.user.MyPlugin;
...
static boolean UTranslate;
...
public void onEnable() {
        UTranslate = checkUTranslate();
}
...
private boolean checkUTranslate(){
    	Plugin UT = Bukkit.getPluginManager().getPlugin("UltimateTranslate");
    	if (UT != null){
    		return true;
    	}
    	return false;
    }

And using in your logger or message listener:

Using Default server codes

package com.user.MyPlugin;
...
import br.net.FabioZumbi12.UltimateTranslate.API.UltimateAPI;
...
public static String logTranslated(String Message){
        if (MyPlugin.UTranslate){
        	String from = UltimateAPI.getDefaultFrom();
        	String to = UltimateAPI.getDefaultTo();
        	Message = UltimateAPI.TranslateFromTo(from, to, Message);
        }        
        return Message;
    }

Using Player language codes

package com.user.MyPlugin;
...
import br.net.FabioZumbi12.UltimateTranslate.API.UltimateAPI;
...
public static String logTranslated(Player p, String Message){
        if (MyPlugin.UTranslate){
        	String from = UltimateAPI.getFrom(p);
        	String to = UltimateAPI.getTo(p);
        	Message = UltimateAPI.TranslateFromTo(from, to, Message);
        }        
        return Message;
    }

This plugin make the translation like Google works, then, try to use color codes after translation!


Comments

Posts Quoted:
Reply
Clear All Quotes