Download Offline Player Cache — Minecraft Mods — MetaMods

Offline Player Cache

Active

Downloads

0

Last update

3 years ago

Versions

1.18.2 — 1.19.2
Server
Fabric
Libraries
Utils

Offline Player Cache

What is this mod?

Offline Player Cache (OPC) is an API mod for Minecraft built on the Fabric framework. Its main purpose is to enable caching of player data on the server while they are in offline mode. This allows other mods to access information about absent players. Originally developed for creating global and persistent leaderboards on Minecraft servers that would include both active and inactive participants.

Main capabilities

Mods can register functions that take player data and return specific values or objects. These data are limited only by what is specified in the key for reading/writing NBT data. When a player disconnects from the server, all registered functions are triggered, and the corresponding data is saved in the cache until disconnection. This information is written to the server level data and can be accessed at any time. When the same player reconnects, their cached data is deleted, and when a function is called, values are returned based on the current state of the online player.

Available commands

  • /opc get uuid|name <uuid|name> <key> — returns the value for the specified UUID or player name. If the player is online, shows the current value; if offline — cached value; otherwise returns null. If the value is a number and the command is executed from a command block, the redstone output signal equals the absolute modulus of 16.

  • /opc remove uuid|name <uuid|name> <key> — if the specified player is offline, removes their cached value by the given key; if the player is online, the command performs no actions.

  • /opc remove uuid|name <uuid|name> — if the specified player is offline, removes all their cached data; if the player is online, the command performs no actions.

Important features

This API mod does not independently register any cacheable values, does not save player data, and by default performs no actions.

To use the API in your mod, add the following settings to the Gradle build file:

repositories {
    maven {
        name = "Modrinth"
        url = "https://api.modrinth.com/maven"
        content {
            includeGroup "maven.modrinth"
        }
    }
}
dependencies {
    modImplementation "maven.modrinth:offline-player-cache:<version>"
    include "maven.modrinth:offline-player-cache:<version>"
}
Project members
clevernucleus

clevernucleus

Developer

Created: 20 Jun 2022

ID: 1327