offline user api

Manage player shard balances. Works for both online and offline players.


Package

bg.pikz.shards.api.interfaces.OfflineUserAPI

Accessing OfflineUserAPI

import bg.pikz.shards.api.ShardsAPIProvider;
import bg.pikz.shards.api.interfaces.OfflineUserAPI;

ShardsAPI api = ShardsAPIProvider.getAPI();
OfflineUserAPI user = api.getUserMap().get(player.getUniqueId());

Methods

getUuid()

Gets the player's UUID.

UUID getUuid()

Returns: The player's UUID


getLastUsername()

Gets the player's last known username.

Returns: The last known username


getShards()

Gets the current amount of shards.

Returns: The shard count

Example:


setShards(long shards)

Sets the shard amount to an exact value.

Parameters:

  • shards - The new shard amount

Example:


addShard()

Adds a single shard to the player's balance.

Example:


addShards(long shardsAmount)

Adds multiple shards to the player's balance.

Parameters:

  • shardsAmount - The amount of shards to add

Example:


takeShard(long shards)

Removes shards from the player's balance.

Parameters:

  • shards - The amount of shards to remove

Example:


Complete Example


Purchase Helper Method