Developer API

The plugin offers a complete developer Spigot API, which allows other plugins on the server to manage friends, parties, settings and much more.

To use the API, simply add the 'FriendSystem-Spigot-API.jar' to your project.

You can then access the API through

SpigotAPI api = SpigotAPI.getInstance();

FriendManager

The FriendManager provides functionality related to managing friends and their interactions. You can retrieve the FriendManagerby using:

FriendManager friendManager = api.getFriendManager();

You can use the FriendManager for the following:

Retrieve a FriendPlayer from MySQL async
void getFriendPlayer(UUID uuid, Consumer<FriendPlayer> friendPlayer);
Retrieve a FriendPlayer from MySQL async
void getFriendPlayer(String name, Consumer<FriendPlayer> friendPlayer);
Retrieve a FriendPlayer from MySQL
FriendPlayer getFriendPlayer(UUID uuid);
Retrieve a FriendPlayer from MySQL
FriendPlayer getFriendPlayer(String name);
Toggle friend invites
void toggleInvites(FriendPlayer player);
Toggle private messages
void toggleMsgs(FriendPlayer player);
Toggle join/leave notifies
void toggleNotifies(FriendPlayer player);
Toggle the option allowing a player to be "jumped to"
void toggleJumping(FriendPlayer player);
Update the status message
updateStatus(FriendPlayer player, String status);
Send a friend request
addFriendRequest(Player sender, UUID receiver);
Accept a friend request
acceptFriendRequest(Player sender, UUID receiver);
Deny friend request
denyFriendRequest(Player denier, UUID requester);
Remove a friend
removeFriend(Player remover, UUID removed);
Mark/unmark a friend as favourite
toggleFavouriteFriend(Player sender, UUID favourite);

FriendPlayer

The FriendPlayer represents a player within the Friend System. You can retrieve the following informations from a FriendPlayer

Retrieve name of the player
String getName();
Check if the player allows friend invites
boolean isInvitesAllowed();
Check if messages are allowed
boolean isMsgsAllowed();
Check if the player jumping to their server
boolean isJumpingAllowed();
Get the last date when the player logged in or out
LocalDateTime getLastSeen();
Retrieves the current status of the player
String getStatus();
Retrieves the list of all friends. The boolean indicates if the friend is marked as favourite
HashMap<String, Boolean> getFriends();
Retrieves the list of online friends. The boolean indicates if the friend is marked as favourite
HashMap<ProxiedPlayer, Boolean> getOnlineFriends();
Retrieves the list of offline friends. The boolean indicates if the player is marked as favourite
HashMap<String, Boolean> getOfflineFriends();
Check if the friend player is friends with another player
boolean isFriendsWith(String uuid);
Check if the friend player has received a friend request from a player
boolean isRequestedBy(String uuid);
Retrieves the list of all pending friend requests
ArrayList<String> getRequests();

PartyManager

The PartyManager provides functionality related to managing or retrieving parties.

Get instance of PartyManager
PartyManager partyManager = api.getPartyManager();

You can use the PartyManager for the following:

Retrieve a Party from MySQL async
void getParty(UUID player, Consumer<Party> party);
Retrieve a Party from MySQL
Party getParty(UUID player);
Get a List of all Parties from MySQL async
void getAllParties(Consumer<List<Party>> parties);
Get a List of all Parties from MySQL
List<Party> getAllParties();
Create a party
void createParty(Player leader, String... memberUUIDs)
Close a party
void disbandParty(Player leader);
Invite a player to a party
void invitePlayer(UUID leader, Player player);
Remove a party invite
void removeInvite(UUID leader, Player player);
add a player to a party
addPlayer(UUID leader, Player player);
kick a player from a party
kickPlayer(UUID leader, Player player);
promote a player to the next rank in a party
promotePlayer(UUID leader, Player player);
demote a player to the next rank in a party
demotePlayer(UUID leader, Player player);

Party

The Partyrepresents a party within the Friend System. You can retrieve the following informations from a Party

Get the id of the party
int getPartyId();
Get the leader UUID
UUID getLeaderUUID();
Get a list of the members (only players)
List<UUID> getMemberUUIDs();
get a list of all members (leader, moderators, players)
List<UUID> getAllMembers();

Last updated