Download PAPIProxyBridge — Minecraft Mods — MetaMods

PAPIProxyBridge

Active

Downloads

22

Last update

1 month ago

Versions

1.16.5 — 1.21.8
Client
Fabric
Libraries

PAPIProxyBridge

PAPIProxyBridge is a library bridge plugin that is installed on both backend servers and proxy servers. Its main function is to provide proxy plugins with the ability to format text using PlaceholderAPI placeholders.

For Server Owners

This plugin is a library component intended for use with other plugins that implement its API. No configuration is required.

Install the latest version of the plugin along with the PlaceholderAPI plugin on your Spigot server (version 1.16.5 and above) or the PlaceholderAPI mod on your Fabric server (version 1.19.3 and above). Then install the plugin on your BungeeCord or Velocity proxy server.

It is important to note that this plugin does not replace PlaceholderAPI. You still need to install PlaceholderAPI on your Spigot/Fabric server.

For Developers

PAPIProxyBridge provides a cross-platform API that allows formatting text using PlaceholderAPI placeholders.

Adding the Library to Your Project

PAPIProxyBridge is available in the repo.william278.net repository. First, add the Maven repository to your build.gradle:

repositories {
    maven { url 'https://repo.william278.net/releases/' }
}

Then add the dependency:

dependencies {
    implementation 'net.william278:papiproxybridge:1.6'
}

Example Usage

The PlaceholderAPI class provides the API for formatting placeholders. Currently, only single placeholders without brackets are supported (functionality will be expanded in the future).

Get an instance of the class using PlaceholderAPI.getInstance(), then use the #formatPlaceholders method to format a string with placeholders for a player (specified by UUID for cross-platform simplicity).

The method returns a CompletableFuture (since we don't want to block threads during proxy network communication with players on the backend) that you can use to get the formatted string.

// Formatting a string with placeholders
final PlaceholderAPI api = PlaceholderAPI.createInstance();
final UUID player = player.getUniqueId();
api.formatPlaceholders("Hello %player_name%!", player).thenAccept(formatted -> {
    player.sendMessage(formatted);
});

Never call #join() on calls to #formatPlaceholders — this is unsafe.

PAPIProxyBridge caches resolved requests for 30000 milliseconds (30 seconds) to avoid excessive traffic over your server's network channels. You can configure the request caching time using the PlaceholderAPI#setCacheExpiry(long) method.

There is also the #formatComponentPlaceholders method. This method allows you to pass a string containing placeholders and receive an adventure component with formatted text that may contain formatting and chat events.

Project members
WiIIiam278

WiIIiam278

Developer

Created: 7 Mar 2023

ID: 3579