Skip to content

uSkyBlock API

Razorax edited this page Jan 22, 2015 · 8 revisions

uSkyBlock has an API

Environment - Maven

First off, add the following to your pom.xml

<repositories>
  <repository>
    <id>uSkyBlock-mvn-repo</id>
    <url>https://raw.github.com/rlf/uSkyBlock/mvn-repo/</url>
    <snapshots>
      <enabled>true</enabled>
      <updatePolicy>always</updatePolicy>
    </snapshots>
  </repository>
</repositories>

And in your dependency-section:

<dependency>
  <groupId>us.talabrek.ultimateskyblock</groupId>
  <artifactId>uSkyBlock</artifactId>
  <version>2.1.0-SNAPSHOT</version>
  <classifier>api</classifier>
</dependency>

If you are not using maven, grab the api-jar from the Releases, and put it in your classpath.

Java Integration

Write some code along these lines:

Plugin plugin = Bukkit.getPluginManager().getPlugin("uSkyBlock");
if (plugin instanceof uSkyBlockAPI && plugin.isEnabled()) {
  uSkyBlockAPI usb = (uSkyBlockAPI) plugin;
  player.sendMessage(String.format(
    "\u00a79Your island score is \u00a74%5.2f!", 
    usb.getIslandLevel(player)
  ));
}