FeatherBoard developer API
The API lets your plugin show, hide and inspect FeatherBoard scoreboards without depending on the FeatherBoard implementation. It is a separate Maven artifact, so you compile against the interfaces and FeatherBoard provides the implementation at runtime.
Maven
xml
<repository>
<id>mvdw-software</id>
<name>MVdW Public Repositories</name>
<url>https://repo.mvdw-software.com/repository/public/</url>
</repository>xml
<dependency>
<groupId>org.featherboard</groupId>
<artifactId>FeatherBoard-API</artifactId>
<version>7.0.2</version>
<scope>provided</scope>
</dependency>Gradle
kotlin
repositories {
maven {
name = "mvdw"
url = uri("https://repo.mvdw-software.com/repository/public/")
}
}
dependencies {
compileOnly("org.featherboard:FeatherBoard-API:7.0.2")
}Add FeatherBoard as a dependency in your plugin.yml:
yaml
depend: [FeatherBoard]
# or, if your plugin can work without it:
softdepend: [FeatherBoard]Get the API instance
Cast the FeatherBoard plugin to the FeatherBoardPlugin interface:
java
import org.bukkit.plugin.java.JavaPlugin;
import org.featherboard.api.FeatherBoardPlugin;
import org.featherboard.api.ScoreboardManager;
public final class MyPlugin extends JavaPlugin {
private ScoreboardManager scoreboards;
@Override
public void onEnable() {
FeatherBoardPlugin featherBoard =
(FeatherBoardPlugin) getServer().getPluginManager().getPlugin("FeatherBoard");
if (featherBoard == null) {
getLogger().severe("FeatherBoard is not installed; scoreboard features disabled.");
return;
}
if (featherBoard.getAPIVersion() < 1) {
getLogger().severe("Unsupported FeatherBoard API version: " + featherBoard.getAPIVersion());
return;
}
scoreboards = featherBoard.getScoreboardManager();
}
public void showBoard(org.bukkit.entity.Player player) {
scoreboards.showScoreboard(player, "myboard");
}
}FeatherBoardPlugin also exposes:
| Method | Returns |
|---|---|
getScoreboardManager() | The scoreboard manager. |
getGameManager() | The ArcadeBoard game manager. |
getResourceManager() | The global resource pack manager. |
getScoreboardDirectory() | The scoreboards/ folder. |
getGamesDirectory() | The games/ folder. |
getAPIVersion() | API compatibility version (1). |
The artifact version (7.0.2) tracks the plugin release; the API version is the compatibility number you should check.
Quick example
java
import org.bukkit.entity.Player;
import org.featherboard.api.ScoreboardManager;
import org.featherboard.api.scoreboard.Scoreboard;
public final class BoardService {
private final ScoreboardManager manager;
public BoardService(ScoreboardManager manager) {
this.manager = manager;
}
public void show(Player player, String boardName) {
manager.showScoreboard(player, boardName);
}
public void hide(Player player, String boardName) {
manager.hideScoreboard(player, boardName);
}
public void toggle(Player player) {
manager.toggle(player);
}
public String currentBoard(Player player) {
Scoreboard board = manager.getCurrentScoreboardByPlayer(player);
return board == null ? "none" : board.getName();
}
}What to read next
Scoreboard API
Manager methods, board objects, events and thread-safety notes.
Game API
ArcadeBoard games, game manager and the game lifecycle.
Source code
Browse the interfaces and implementations on GitLab.
Source code
The API and plugin are split into two repositories:
