API Examples

In this page you can see some examples of Parties API usage.

Table of contents

Get OreAnnouncer block instance

OABlock block;
OreAnnouncerAPI api = OreAnnouncer.getApi();
block = api.getBlock("DIAMOND_ORE"); // Can be null

Make a block destroy instance

A BlockDestroy instance, is the number of destroyed block of the given player, it can be generated for a new block or get from an already existing player.

For example, you can get the current player destroy block and increment it by X.

Player somePlayer; // ...
OreAnnouncerAPI api = OreAnnouncer.getApi();
OAPlayer player = api.getPlayer(somePlayer.getUniqueId());
block = api.getBlock("DIAMOND_ORE");
if (block != null) {
OABlockDestroy blockDestroy = api.makeBlockDestroy(player.getPlayerUUID(), block, 5);
// or: blockDestroy = player.getBlockDestroy(block);
player.setBlockDestroy(blockDestroy); // This will override previous block destroy value