OfflinePlayerLib
ModrinthA Library for Handling Offline Players in PaperMC Plugins
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())
);
});
Versions
FAQ
Comment installer OfflinePlayerLib ?
Téléchargez le fichier pour votre version de Minecraft et votre loader sur cette page, puis placez le .jar dans le dossier mods (ou plugins) et lancez le jeu.
OfflinePlayerLib est-il gratuit ?
OfflinePlayerLib est gratuit sur Modgrid — nous renvoyons directement vers la source officielle, sans paywall.
Quelles versions de Minecraft OfflinePlayerLib prend-il en charge ?
Compatible avec Paper. Prend en charge les versions 1.21–26.2. La liste des versions et loaders pris en charge est dans la section de téléchargement de cette page.

Commentaires 0
Aucun commentaire pour l'instant. Sois le premier à donner ton avis.