This class will help you to get the title, the description, and the frame type of advancement. If you are using PaperMC as the base of your project, use its method instead of this.
- Add this class to your project by copying it or adding it via Maven or Gradle.
- Call a new instance for it:
Advancement adv = Bukkit.getAdvancement(key);
AdvancementInfo info = AdvancementInfo.from(adv);
- Get the desired object(s):
String frame = info.getFrame().toString();
String title = info.getTitle();
String description = info.getDescription();
String[] descArray = info.getDescriptionArray(24);
ItemStack item = info.getItem();
- Use it in whatever you want. Check the ExampleClass here.
- Example Output:
Maven - add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.CroaBeast</groupId>
<artifactId>AdvancementInfo</artifactId>
<version>c9d33fd7e7</version>
</dependency>
</dependencies>
Gradle - add to build.gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.CroaBeast:AdvancementInfo:c9d33fd7e7'
}