[1.8-1.19] Harmony Scoreboard | NMS Async | PlaceHolderAPI Support icon

[1.8-1.19] Harmony Scoreboard | NMS Async | PlaceHolderAPI Support -----

NMS Asnyc Lightweight Scoreboard Plugin



Fixed 1.16.5 Compatibility Issue + Added Developer API
API
Harmony Scoreboard has an easy-to-use API for registering placeholders and changing the player's scoreboard.

If you want to register placeholders when your plugin loads, make sure to have Harmony Scoreboard as a dependency.

depend: [HarmonyScoreboard]

Registering Placeholders
Every placeholder needs to be of type HarmonyPlaceholder. Here is an example of a placeholder that replaces %health% with the player's health.

Code (Java):
public class HealthPlaceholder extends HarmonyPlaceholder {
   @Override
    public String getName ( ) {
        return "health" ;
    }
   @Override
    public String getValue (Player player ) {
        return String. valueOf (player. getHealth ( ) ) ;
    }
}
Then we need to register the placeholder. That can be easily done with

HarmonyBoardAPI.registerPlaceholder(new HealthPlaceholder());

All HarmonyBoardAPI functions are static, there is no need to create an instance.

In order to remove the placeholder, you can either remove it based on its instance or on its name.

Code (Java):
HarmonyBoardAPI. unregisterPlaceholder (healthplaceholder ) ;
HarmonyBoardAPI. unregisterPlaceholder ( "health" ) ;
Setting Scoreboards
You can set a player's scoreboard with the setScoreboard function. It takes as parameters the player and the name of the scoreboard you want to set. It bypasses and permission / world check.

Code (Java):
try {
   HarmonyBoardAPI. setScoreboard (player, "examplescoreboard" ) ;
} catch (HarmonyBoardException e ) {
   e. printStackTrace ( ) ;
}
HarmonyBoardException is thrown if the player is null or if the name of the scoreboard is invalid.
----------, Jan 31, 2021
Resource Information
Author:
----------
Total Downloads: 5,317
First Release: Jan 30, 2021
Last Update: Jul 29, 2022
Category: ---------------
All-Time Rating:
13 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings