User management
In the API, every player is represented as a SocialUser. This abstraction ensures platform independence and provides additional utility methods for interacting with users.
Retrieving a SocialUser
In Bukkit-based platforms such as Spigot or Paper, SocialUser instances are implemented by the BukkitSocialUser class, which contains helper methods to retrieve users:
BukkitSocialUser userByPlayer = BukkitSocialUser.from(player);
BukkitSocialUser userBySocialUser = BukkitSocialUser.from(socialUser);
BukkitSocialUser userByUuid = BukkitSocialUser.from(uuid);
Sending messages
The SocialUser class implements Adventure's Audience. This means all standard Audience methods are available, including sendMessage:
Sending a parsable message
When working with social's text processing system, you may want messages to be parsed for placeholders, emojis, and other formatting features.
For this purpose, SocialUser provides the sendParsableMessage convenience method:
Accessing the Player instance from a BukkitSocialUser
You can retrieve the underlying Bukkit Player instance from a SocialUser using BukkitSocialUser::player.
This method returns an Optional<Player> because the user may be offline or represent a non-player entity.