# 👥 Friends

It allows players to send friend requests, accept or remove friends, check where friends are playing, transmit to friends, view online/offline counts, and use configurable friend limits.

***

### What It Does

The Friends module adds a complete friend system to your Velocity network.

It can be used for:

* Sending friend requests
* Accepting friend requests
* Removing friends
* Checking where friends are playing
* Transmitting or connecting to friends
* Showing total friends
* Showing online friends
* Showing offline friends
* Friend limits by permission
* Cross-proxy friends support with Redis
* Persistent friend data with MySQL or MongoDB

***

### When To Enable It

Enable this module if you want players to build social connections across your network.

This module is useful for:

* Large networks
* Community-focused servers
* Lobby networks
* Minigame networks
* Cross-proxy player tracking
* Networks that want friend counts in scoreboards, tabs, menus, or lobby systems

{% hint style="info" %}
For production networks, Redis + database storage is recommended for the Friends module.
{% endhint %}

***

### Requirements

The Friends module can work depending on your storage setup, but Redis and a database are recommended for most real networks.

| Dependency     | Required    | Purpose                                                                                         |
| -------------- | ----------- | ----------------------------------------------------------------------------------------------- |
| Redis          | Recommended | Used for online/offline friend status across proxies.                                           |
| MySQL          | Recommended | Used for persistent friend data.                                                                |
| MongoDB        | Recommended | Used for persistent friend data.                                                                |
| PacketEvents   | No          | Not required.                                                                                   |
| Discord        | No          | Not required.                                                                                   |
| PlaceholderAPI | Optional    | Used only if you want backend lobby plugins to show friends placeholders through the expansion. |

{% hint style="warning" %}
For cross-proxy networks, use Redis and MySQL or MongoDB.

Redis handles online presence. The database stores persistent friend data.
{% endhint %}

***

### Configuration File

The Friends module configuration file is located at:

```
plugins/NexusProxy/modules/friends/friends.yml
```

This file can contain settings for:

* Module status
* Command names
* Command aliases
* Permissions
* Friend request behavior
* Friend limits
* Limit permissions
* Messages
* Cooldowns
* Where behavior
* Transmit behavior
* Storage-related options

{% hint style="warning" %}
Command names, aliases, limits, and limit permissions may be configurable in the module file.

The commands and permissions shown here are the default base values.
{% endhint %}

***

### Default Commands

| Command                      | Description                                                    |
| ---------------------------- | -------------------------------------------------------------- |
| `/friends`                   | Opens or shows the main friends command.                       |
| `/friends add <player>`      | Sends a friend request to a player.                            |
| `/friends accept <player>`   | Accepts a friend request.                                      |
| `/friends remove <player>`   | Removes a player from your friends list.                       |
| `/friends where <player>`    | Shows where a friend is playing.                               |
| `/friends transmit <player>` | Sends or connects you to a friend, depending on configuration. |

***

### Permissions

| Permission                           | Description                                                               |
| ------------------------------------ | ------------------------------------------------------------------------- |
| `nexusproxy.command.friends.*`       | Grants access to Friends command permissions, depending on configuration. |
| `nexusproxy.friends.limit.bypass`    | Allows bypassing the configured friend limit.                             |
| `nexusproxy.friends.limit.vip`       | Example friend limit permission for VIP ranks.                            |
| `nexusproxy.friends.limit.mvp`       | Example friend limit permission for MVP ranks.                            |
| `nexusproxy.friends.limit.unlimited` | Example permission for unlimited friends.                                 |

{% hint style="info" %}
Friend limit permissions are configurable.

Check `friends.yml` before assigning rank-based limit permissions.
{% endhint %}

***

### Recommended LuckPerms Setup

#### Default players

```
/lp group default permission set nexusproxy.command.friends.* true
```

#### VIP

```
/lp group vip permission set nexusproxy.command.friends.* true
/lp group vip permission set nexusproxy.friends.limit.vip true
```

#### MVP

```
/lp group mvp permission set nexusproxy.command.friends.* true
/lp group mvp permission set nexusproxy.friends.limit.mvp true
```

#### Admin

```
/lp group admin permission set nexusproxy.command.friends.* true
/lp group admin permission set nexusproxy.friends.limit.bypass true
/lp group admin permission set nexusproxy.friends.limit.unlimited true
```

{% hint style="warning" %}
Review your configured friend limits before giving limit permissions.

The exact limit behavior depends on `friends.yml`.
{% endhint %}

***

### Friend Requests

Players can send friend requests using:

```
/friends add <player>
```

Example:

```
/friends add Steve
```

The target player can accept the request with:

```
/friends accept Steve
```

Depending on your configuration, requests may expire, require confirmation, or be limited by cooldowns.

***

### Removing Friends

Players can remove a friend using:

```
/friends remove <player>
```

Example:

```
/friends remove Steve
```

This removes the friendship from the stored friend data.

***

### Where Command

The where command shows where a friend is currently playing.

Default command:

```
/friends where <player>
```

Example:

```
/friends where Steve
```

This can show location information such as the friend’s current proxy or backend server, depending on your configuration and available presence data.

{% hint style="info" %}
For accurate cross-proxy location data, Redis is recommended.
{% endhint %}

***

### Transmit Command

The transmit command allows a player to move or connect toward a friend, depending on your configuration.

Default command:

```
/friends transmit <player>
```

Example:

```
/friends transmit Steve
```

This is useful for lobby networks, minigames, or social networks where players frequently join friends.

***

### Friend Limits

The Friends module supports configurable friend limits.

Limits can be different by rank or permission.

Example concept:

```yaml
limits:
  default: 25
  vip: 50
  mvp: 100
  unlimited: -1
```

Example permission concept:

```yaml
permissions:
  vip: "nexusproxy.friends.limit.vip"
  mvp: "nexusproxy.friends.limit.mvp"
  unlimited: "nexusproxy.friends.limit.unlimited"
```

{% hint style="info" %}
Use friend limits to create rank perks without making the system messy.
{% endhint %}

***

### Redis Usage

Redis is recommended for online status and cross-proxy presence.

Redis can help the Friends module know:

* Which friends are online
* Which proxy a friend is connected to
* Which backend server a friend is playing on
* Whether friend-related placeholders should show online data correctly

{% hint style="warning" %}
If Redis is not enabled on a multi-proxy network, online friend status may be incomplete or incorrect.
{% endhint %}

***

### Database Usage

Database storage is recommended for persistent friend data.

MySQL or MongoDB can store:

* Friend relationships
* Known player profiles
* Friend counts
* Persistent friend-related data

Supported database types:

```yaml
mysql
mongodb
mongo
```

{% hint style="warning" %}
Without persistent database storage, friend data may not survive restarts depending on your setup.
{% endhint %}

***

### Friends Placeholders

Friends data can also be used by NexusProxy placeholders.

Proxy-side placeholders may include:

```
%friends_total%
%friends_online%
%friends_offline%
%friends_pending%
%friends_limit%
```

If you use the PlaceholderAPI expansion on backend lobby servers, friends placeholders may include:

```
%nexusproxy_friends_total%
%nexusproxy_friends_online%
%nexusproxy_friends_offline%
%nexusproxy_friends_pending%
%nexusproxy_friends_limit%
```

{% hint style="info" %}
For backend PlaceholderAPI friends placeholders, configure the expansion with the same Redis and database settings as NexusProxy.
{% endhint %}

***

### Common Use Cases

#### Send a friend request

```
/friends add Steve
```

***

#### Accept a friend request

```
/friends accept Steve
```

***

#### Remove a friend

```
/friends remove Steve
```

***

#### Check where a friend is playing

```
/friends where Steve
```

***

#### Transmit to a friend

```
/friends transmit Steve
```

***

### Setup Tips

* Use MySQL or MongoDB for persistent friend data.
* Use Redis for online friend status in multi-proxy networks.
* Configure friend limits by rank.
* Give default players access to the main friends command.
* Use higher friend limits as donor or rank perks.
* Keep limit permissions clear and easy to understand.
* Make sure the PlaceholderAPI expansion uses the same Redis and database settings if you use backend placeholders.
* Check `friends.yml` if you want to change command names, aliases, limits, or permissions.

***

### Common Issues

#### Friend data does not save after restart

Check that:

* Database storage is enabled.
* MySQL or MongoDB is configured correctly.
* `/nexusproxy storage` shows the database as connected.
* The Friends module is configured to use persistent storage, if applicable.

***

#### Friends show as offline when they are online

Check that:

* Redis is enabled.
* All proxies use the same Redis settings.
* All proxies use the same `channel_prefix`.
* Every proxy has a unique `cluster.proxy_id`.
* The target friend is actually connected to the network.
* `/nexusproxy storage` shows Redis as connected.

***

#### `/friends where` does not show the correct server

Check that:

* Redis is enabled for cross-proxy presence.
* The friend is online.
* Backend server names are configured correctly in Velocity.
* Presence data is being published correctly by every proxy.

***

#### Friend limit is wrong

Check that:

* The player has the correct limit permission.
* Limit permissions are configured correctly in `friends.yml`.
* No higher-priority permission is overriding the expected limit.
* The player does not have bypass or unlimited permission accidentally.

***

#### PlaceholderAPI friends placeholders return 0

Check that:

* Database storage is enabled.
* Friend data exists in the database.
* Redis is enabled if online status is needed.
* The PlaceholderAPI expansion uses the same database settings.
* The PlaceholderAPI expansion uses the same Redis settings.
* The expansion is installed on the backend server, not on Velocity.

***

#### Another plugin is using `/friends`

If another plugin registers the same command or alias, change the command name or aliases in:

```
plugins/NexusProxy/modules/friends/friends.yml
```

***

### Summary

The Friends module provides a complete social system for NexusProxy.

It is recommended for networks that want friend requests, friend lists, online/offline friend status, friend locations, transmit behavior, rank-based friend limits, and PlaceholderAPI-friendly friend data.


---

# 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://nexusproxy.nemesismc.net/modules/friends.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.
