# Developer API

To use the API, simply add the 'FriendSystem-Velocity.jar' or 'FriendSystem-Bungee.jar' to your project.

You can then access the API through&#x20;

```java
FriendSystemAPI api = FriendSystem.getAPI();
```

## FriendManager

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

```java
IFriendManager friendManager = api.getFriendManagerAPI();
```

\
**You can use the `FriendManager` for the following:**

{% code title="Retrieve a FriendPlayer" %}

```java
IFriendPlayer getFriendPlayer(String uuidOrName);
```

{% endcode %}

{% code title="Toggle friend invites " %}

```java
void toggleInvites(IFriendPlayer player);
```

{% endcode %}

{% code title="Toggle private messages" %}

```java
void toggleMsgs(IFriendPlayer player);
```

{% endcode %}

{% code title="Toggle join/leave notifies" %}

```java
void toggleNotifies(IFriendPlayer player);
```

{% endcode %}

{% code title="Toggle the option allowing a player to be "jumped to"" %}

```java
void toggleJumping(IFriendPlayer player);
```

{% endcode %}

{% code title="Update the status message" %}

```java
updateStatus(IFriendPlayer player, String status);
```

{% endcode %}

{% code title="Send a friend request" %}

```java
addFriendRequest(IFriendPlayer requester, IFriendPlayer target);
```

{% endcode %}

{% code title="Accept a friend request " %}

```java
acceptFriendRequest(IFriendPlayer accepter, IFriendPlayer requester);
```

{% endcode %}

{% code title="Deny friend request" %}

```java
denyFriendRequest(IFriendPlayer denier, IFriendPlayer requester);
```

{% endcode %}

{% code title="Remove a friend" %}

```java
removeFriend(IFriendPlayer remover, IFriendPlayer removed);
```

{% endcode %}

{% code title="Mark/unmark a friend as favourite" %}

```java
toggleFavouriteFriend(IFriendPlayer remover, IFriendPlayer removed);
```

{% endcode %}

## FriendPlayer

The `IFriendPlayer` represents a player within the Friend System.\
You can retrieve the following informations from a `IFriendPlayer`

{% code title="Retrieve name of the player" %}

```java
String getName();
```

{% endcode %}

{% code title="Check if the player allows friend invites" %}

```java
boolean isInvitesAllowed();
```

{% endcode %}

{% code title="Check if messages are allowed" %}

```java
boolean isMsgsAllowed();
```

{% endcode %}

{% code title="Check if the player jumping to their server" %}

```java
boolean isJumpingAllowed();
```

{% endcode %}

{% code title="Get the last date when the player logged in or out" %}

```java
LocalDateTime getLastSeen();
```

{% endcode %}

{% code title="Retrieves the current status of the player" %}

```java
String getStatus();
```

{% endcode %}

{% code title="Retrieves the list of all friends. The boolean indicates if the friend is marked as favourite" %}

```java
HashMap<String, Boolean> getFriends();
```

{% endcode %}

{% code title="Retrieves the list of online friends. The boolean indicates if the friend is marked as favourite" %}

```java
HashMap<ProxiedPlayer, Boolean> getOnlineFriends();
```

{% endcode %}

{% code title="Retrieves the list of offline friends. The boolean indicates if the player is marked as favourite" %}

```java
HashMap<String, Boolean> getOfflineFriends();
```

{% endcode %}

{% code title="Check if the friend player is friends with another player" %}

```java
boolean isFriendsWith(String uuid);
```

{% endcode %}

{% code title="Check if the friend player has received a friend request from a player " %}

```java
boolean isRequestedBy(String uuid);
```

{% endcode %}

{% code title="Retrieves the list of all pending friend requests" %}

```java
ArrayList<String> getRequests();
```

{% endcode %}

## PartyManager

The `PartyManager` provides functionality related to managing or retrieving parties.

{% code title="Get instance of PartyManager" %}

```java
IPartyManager partyManager = api.getPartyManagerAPI();
```

{% endcode %}

<br>

**You can use the PartyManager for the following:**

{% code title="Retrieve a Party from a player" %}

```java
IParty getPartyFromPlayer(ProxiedPlayer);
```

{% endcode %}

{% code title="Create a party" %}

```java
void addParty(IParty party);
```

{% endcode %}

{% code title="Close a party" %}

```java
void removeParty(IParty party);
```

{% endcode %}

{% code title="Invite a player to a party" %}

```java
void invitePlayer(IParty party, ProxiedPlayer player);
```

{% endcode %}

{% code title="Remove a party invite" %}

```java
void removeInvite(IParty party, ProxiedPlayer player);
```

{% endcode %}

{% code title="add a player to a party" %}

```java
addPlayer(IParty party, ProxiedPlayer player);
```

{% endcode %}

{% code title="kick a player from a party" %}

```java
kickPlayer(IParty party, ProxiedPlayer player);
```

{% endcode %}

{% code title="promote a player to the next rank in a party" %}

```java
promotePlayer(IParty party, ProxiedPlayer player);
```

{% endcode %}

{% code title="demote a player to the next rank in a party" %}

```java
demotePlayer(IParty party, ProxiedPlayer player);
```

{% endcode %}

{% code title="set a new random leader for a party" %}

```java
setNewLeader(IParty party);
```

{% endcode %}

{% code title="set a new specific leader for a party" %}

```java
setNewLeader(IParty party, ProxiedPlayer player);
```

{% endcode %}

## IParty

The `IParty`represents a party within the Friend System.\
You can retrieve the following informations from a `IParty`

{% code title="Get the id of the party" %}

```java
int getPartyId();
```

{% endcode %}

{% code title="Get the leader" %}

```java
ProxiedPlayer getLeader();
```

{% endcode %}

{% code title="Get a list of the moderators" %}

```java
List<ProxiedPlayer> getModerators();
```

{% endcode %}

{% code title="get a list of all players" %}

```java
List<ProxiedPlayer> getPlayers();
```

{% endcode %}

{% code title="Get a list of the requests" %}

```java
List<ProxiedPlayer> getInvites();
```

{% endcode %}

{% code title="get a list of all players (leader, moderators, players)" %}

```java
List<ProxiedPlayer> getAllPlayers();
```

{% endcode %}

{% code title="check if a player is part of a party" %}

```java
boolean containsPlayer(ProxiedPlayer player);
```

{% endcode %}

{% code title="Returns leader, moderator or player" %}

```java
String getRole(ProxiedPlayer);
```

{% endcode %}

{% code title="get the prefix of a specific group in a party" %}

```java
String getPrefixOfGroup(String group);
```

{% endcode %}

{% code title="broadcast a message to all players in the party" %}

```java
void broadcastMessage(BaseComponent[] baseComponents);
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sk8ingduck.gitbook.io/friendsystem/bungeecord-velocity-api/developer-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
