-
Notifications
You must be signed in to change notification settings - Fork 0
Developer API
fren_gor edited this page Apr 19, 2021
·
16 revisions
Welcome to the official UltimateScoreboards Developer API Wiki.
UltimateScoreboards comes with an extensive and easy API to create and manage scoreboards.
To see a complete usage guide check out the API Usage page.
The LATEST version of the API is the 1.0
.
Javadocs: https://us-docs.frengor.com (alternative link)
The API is published on jitpack.io.
If you're using Maven add these lines to your POM file.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
</dependencies>
<dependency>
<groupId>com.frengor</groupId>
<artifactId>UltimateScoreboardsAPI</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
If you're using Gradle add these lines to your build script.
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compileOnly 'com.frengor:UltimateScoreboardsAPI:1.0'
}
Download the last API jar from releases. Add it to the build path of your project.
To get an instance of the API you need to use one of the next two method:
Remember to add
depend: [UltimateScoreboards]
orsoftdepend: [UltimateScoreboards]
to your plugin.yml.
RegisteredServiceProvider<UltimateScoreboardsAPI> provider = Bukkit.getServicesManager().getRegistration(UltimateScoreboardsAPI.class);
if (provider != null) {
UltimateScoreboardsAPI api = provider.getProvider();
}
// Returns null if the API hasn't been loaded yet
UltimateScoreboardsAPI api = UltimateScoreboardsAPI.getAPI();
// Get the API instance
UltimateScoreboardsAPI api = UltimateScoreboardsAPI.getAPI();
// Create a text line
TextLine line = api.craftTextLine("This is a line");
// Get the API instance
UltimateScoreboardsAPI api = UltimateScoreboardsAPI.getAPI();
// Create title
Line title = api.craftTextLine("&eThis is the title");
// Create some lines
Line line1 = api.craftSlidingLine("Sliding!!!");
Line line2 = api.craftSlidingLine("Just another line", true);
// Create the scoreboard
Scoreboard scoreboard = api.craftLongScoreboard(title, Arrays.asList(line1, line2));
scoreboard.addViewer(aplayer);