FriendSystem
  • 🚀Friends & Party System Wiki
    • Installation
    • Commands
    • Permissions
    • Placeholders
    • SpecialItems
  • Configs
    • Bungeecord/Velocity Config
    • Spigot Config
  • Bungeecord/Velocity API
    • Developer API
      • Examples
  • Spigot API
    • Developer API
Powered by GitBook
On this page
  • FriendManager
  • FriendPlayer
  • PartyManager
  • Party
  1. Spigot API

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.

PreviousExamples

Last updated 10 months ago

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

You also need to put the FriendSystem-Spigot-API.jar in your plugins folder of your minecraft server and enter your MySQL data in the database.yml file. The MySQL credentials must be the same, as on the bungeecord / velocity server.

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 notifications
void toggleNotifies(FriendPlayer player);
Toggle the option allowing a player to be "jumped to"
void toggleJumping(FriendPlayer player);
Toggle the last seen / online since visibility
void toggleLastSeen(FriendPlayer player);
Toggle server visibility
void toggleShowServer(FriendPlayer player);
Toggle party invites
void togglePartyInvites(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();
Get Messages State. States are ENABLED, DISABLED and FRIENDS_ONLY
boolean getMsgsState();
Check if the player jumping to their server
boolean isJumpingAllowed();
Check if last seen / online since is visible
boolean isShowLastSeen();
Check if server is visible
boolean isShowServer();
Get Party Invites State. States are ENABLED, DISABLED and FRIENDS_ONLY
SettingState getPartyInvitesState();
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();

215KB
FriendSystem-Spigot-API-1.0.zip
archive
FriendSystem-Spigot-API