-
Notifications
You must be signed in to change notification settings - Fork 7
Start Guide
The API is published on maven.
Javadoc can be found at https://frengor.com/javadocs/UltimateAdvancementAPI/latest/.
Builds can be found on Jenkins: https://jenkins.frengor.com/job/UltimateAdvancementAPI/.
If you're using Maven, import UltimateAdvancementAPI adding these lines to your POM file.
<repositories>
<repository>
<id>fren_gor</id>
<url>https://nexus.frengor.com/repository/public/</url>
</repository>
</repositories>
<dependency>
<groupId>com.frengor</groupId>
<artifactId>ultimateadvancementapi</artifactId>
<version>2.2.8</version>
<scope>provided</scope>
</dependency>
If you're using Gradle, import UltimateAdvancementAPI adding these lines to your build script.
repositories {
maven { url 'https://nexus.frengor.com/repository/public/' }
}
dependencies {
compileOnly 'com.frengor:ultimateadvancementapi:2.2.8'
}
Note: I don't use Gradle, if there are any errors please open an issue or make a pull request.
Download the lastest API jar from the downlaod page or Jenkins and add it to the build path of your project.
Shadeable version installation process can be found at this page.
To get an instance of the API use the UltimateAdvancementAPI#getInstance(Plugin plugin)
method:
UltimateAdvancementAPI api = UltimateAdvancementAPI.getInstance(yourPluginInstance);
If UltimateAdvancementAPI is not enabled it will throw a APINotInstantiatedException.
Remember to add
depend: [UltimateAdvancementAPI]
orsoftdepend: [UltimateAdvancementAPI]
to your plugin.yml.
Simple example with the creation of an advancement tab with only one advancement.
public class MainClass extends JavaPlugin implements Listener {
private AdvancementTab advancementTab;
private RootAdvancement root;
private UltimateAdvancementAPI api;
@Override
public void onEnable() {
api = UltimateAdvancementAPI.getInstance(this);
advancementTab = api.createAdvancementTab("your_tab_name");
AdvancementDisplay rootDisplay = new AdvancementDisplay(Material.GRASS_BLOCK, "Example root", AdvancementFrameType.TASK, true, true, 0, 0, "description");
root = new RootAdvancement(advancementTab, "root", rootDisplay, "textures/block/stone.png");
advancementTab.registerAdvancements(root);
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onJoin(PlayerLoadingCompletedEvent e) {
// Called after a player has successfully been loaded by the API
Player p = e.getPlayer();
// Here you can show tabs to players
advancementTab.showTab(p);
}
}
Result:
UltimateAdvancementAPI Wiki © 2021 fren_gor, EscanorTargaryen is licensed under CC BY-SA 4.0.
Except where otherwise noted, code snippets inside the wiki are licensed under The Unlicense.