Api

OpenTexon API

Heres the API for OpenTexonMod

First you need to get OpenTexonMod, heres how you do it.

First create a new class and call it OpenTexonModApi.

In that class add the following

        public static OpenTexonMod otm;
        public static boolean useOTM = false;

	public static void init() {
		final PluginManager pluginManager = Bukkit.getServer()
				.getPluginManager();
		final Plugin GMplugin = pluginManager.getPlugin("OpenTexonMod");

		if (GMplugin != null && GMplugin.isEnabled()) {
			otm = (OpenTexonMod) GMplugin;
			useOTM = true;
		}
	}

Then in your main class you need to add:

OpenTexonModApi.init();

Then make sure to check if OpenTexonMod is installed on the server with

if (!OpenTexonModApi.useOTM) {
       System.out.println("Could not find OpenTexonMod");
}

Api functions

Now that we have the API initialized we can get started using it.

Example of how to get a players group access from the API:

public static ArrayList<String> getPlayerGroups(Player p) {
	return OpenTexonModApi.otm.api.getUserGroups(p);
}

Here are the things you can get from OpenTexonMod API:

  • Plugin version
  • Config version
  • Motd config version
  • Plugin revision
  • Api version
  • Player groups
  • Broadcast staff message
  • Get config entry
  • Check if a player is in a protected area

You can also get a extend player using OTM_Player, heres how

OTM_Player player = OpenTexonModApi.otm.api.getOTMExtendedPlayer("username");

And from that OTM_Player you can get alot of information. The OTM_Player works with offline or online players just provide a valid username.

More functions will be coming to the API soon.

The current API version is: 0.0.2

Make sure to check the API version so that all functions will be avaiable.


Comments

Posts Quoted:
Reply
Clear All Quotes