Мова

OfflinePlayerLib

OfflinePlayerLib

Modrinth

A Library for Handling Offline Players in PaperMC Plugins

6 завантажень оновлено 8d ago
остання v1.0.0 Modrinth
Paper 1.21 – 26.2
OfflinePlayerLib-Icon

OfflinePlayerLib

How Lookups Work

When doing a Lookup, Saved Players in the DB are checked first, then the User Cache and GeyserMC/Floodgate + LibreLogin are used.

A lookup returns with null when the Identity cannot be determined.

GetAllOfflinePlayers returns a List<CachedOfflinePlayer>.

GetOfflinePlayerByName and GetOfflinePlayerByUUID return a CompletableFuture<CachedOfflinePlayer>.

CachedOfflinePlayer holds the Name and UUID and provides getOfflinePlayer() when a Bukkit Player is needed.

Using the OfflinePlayer API

Add it as a provided dependency when compiling your Plugin:

<dependency>
  <groupId>com.pixelcatt.offlineplayerlib</groupId>
  <artifactId>OfflinePlayerLib</artifactId>
  <version>VERSION-HERE</version>
  <scope>provided</scope>
</dependency>

Declare OfflinePlayerLib as a dependency in your plugin's plugin.yml so it loads first:

depend: [OfflinePlayerLib]

Import OfflinePlayerLib and the ChachedPlayer Type:

import com.pixelcatt.offlineplayerlib.OfflinePlayerLib;
import com.pixelcatt.offlineplayerlib.CachedOfflinePlayer;

Then get the Plugin Instance:

OfflinePlayerLib offlinePlayerLib = (OfflinePlayerLib) getServer().getPluginManager().getPlugin("OfflinePlayerLib");

And use these Methods to Lookup Offline Players:

// Look up by Username
offlinePlayerLib.GetOfflinePlayerByName(username).thenAccept(playerByName -> {
    if (playerByName != null) {
        System.out.println(playerByName.getUniqueId());
    }
});

// Look up by UUID
offlinePlayerLib.GetOfflinePlayerByUUID(UUID).thenAccept(playerByUUID -> {
    if (playerByUUID != null) {
        System.out.println(playerByName.getName());
    }
});

// Get a list of All Saved Offline Players
offlinePlayerLib.GetAllOfflinePlayers().thenAccept(players -> {
    players.forEach(player ->
        System.out.println(player.getName() + " - " + player.getUniqueId())
    );
});

Версії

Release
1.0.0
paper · 1.21, 1.21.1, 1.21.2 · 8d ago
Added these Methods to Lookup Offline Players: ```java // Look up by Username offlinePlayerLib.GetOfflinePlayerByName(username).thenAccept(playerByName -> { …
6

Коментарі 0

Поки немає коментарів. Будь першим, хто поділиться думкою.

FAQ

Як встановити OfflinePlayerLib?

Завантажте файл під свою версію Minecraft і завантажувач із цієї сторінки, потім покладіть .jar у папку mods (або plugins) і запустіть гру.

OfflinePlayerLib безкоштовний?

OfflinePlayerLib можна завантажити безкоштовно на Modgrid — ми ведемо прямо до офіційного джерела.

Які версії Minecraft підтримує OfflinePlayerLib?

Працює з Paper. Підтримуються версії 1.21–26.2. Перелік підтримуваних версій і завантажувачів — у блоці завантаження на цій сторінці.

Завантажити OfflinePlayerLib

Файли надаються напряму з першоджерела. Modgrid не зберігає та не змінює їх.