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
How do I install OfflinePlayerLib?
Download the file for your Minecraft version and loader from this page, then drop the .jar into your mods (or plugins) folder and launch the game.
Is OfflinePlayerLib free?
OfflinePlayerLib is free to download on Modgrid — we link straight to the official source, no paywall or bundled installer.
Which Minecraft versions does OfflinePlayerLib support?
Works with Paper. Supports versions 1.21–26.2. See the download section on this page for the full list of supported versions and loaders.

Comments 0
No comments yet. Be the first to share your thoughts.