Mod

Offline Player Cache: Directors Cut

Quick rating

Offline Player Cache: Directors Cut

No reviews yet

A port of Offline Player Cache which is a API Mod using Fabric to allow caching player data on the server while the player is offline.

QoL & Tweaks
Storage & Organization
API/Library
Mod Loaders
Forge
NeoForge
Fabric
Quilt
Minecraft
1.21

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Dev Environment
Client Unsupported
Server Required

About

Project Details

Type
Mod
License
MIT License
Latest Version
2.0.0+1.20.1-beta.4

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

CurseForge ID
Modrinth ID

Resources

External Links

Source Issues Wiki Discord

About

Description

Offline Player Cache Banner LICENSE stargazers forks issues&labelColor=1A1A1A fabric quilt forge generic_vector.svg github_vector.svg java gradle discord-plural_vector.svg

Preamble 📝

Offline Player Cache: Directors Cut has been completely redone from the ground up, and its framework predates 1.* and below. This was developed in mind to have persistent leaderboards for servers for their offline players.

Content 📦

Modders may register Record's linked with an id and a Codec to serialize/deserialize it. Upon a player's disconnection from the server, their cached data is stored into the servers level data, which then can be accessed through code or through the commands the mod provides. Upon a player's reconnection to the server, their cached data is deleted.

Commands

/opc get <uuid>|<name> <key>

Provides details about the current player value. If they are online, it will provide their current value, but if they are offline, it will provide their cached value.

/opc remove <uuid>|<name> <key>

If the player with the associated username or UUID is offline, it will remove that players cached value based on the selected key. If the player is online, nothing will occur with this command.

/opc list <uuid>|<name>

Lists all the keys and values this player has stored if they are offline, or if they are online, their current ones.

Developers Guide

Setup

Offline Player Cache has a Modrinth and Curseforge page. In order to develop with the API, please add the following: gradle.properties
opc_version=...
build.gradle
repositories {
    maven {
        name = "Modrinth"
        url = "" rel="noopener nofollow" target="_blank">https://api.modrinth.com/maven&quot;
        content {
            includeGroup "maven.modrinth"
        }
    }
}
dependencies {
modImplementation "maven.modrinth:opc-directors-cut:$"
// include this if you do not want to force your users to install the mod.
include "maven.modrinth:opc-directors-cut:$"
}
<details><summary>Alternatively, if you are using Kotlin DSL:</summary> build.gradle.kts
repositories {
    maven {
        name = "Modrinth"
        url = uri("" rel="noopener nofollow" target="_blank">https://api.modrinth.com/maven&quot;)
        content {
            includeGroup("maven.modrinth")
        }
    }
}

dependencies {
    modImplementation("maven.modrinth:opc-directors-cut:${properties["opc_version"]}")
    // include this if you do not want to force your users to install the mod.
    include("maven.modrinth:opc-directors-cut:${properties["opc_version"]}")
}
</details>

Migration to 2.*

  • There are no longer any concepts of keys. Instead, you are to register an id, a Record, and a Codec.

Creating a Record

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
public record Contract(String label, boolean signed) {
public static Codec<Contract> CODEC = RecordCodecBuilder.create((instance) ->
instance.group(
Codec.STRING.fieldOf("label").forGetter(Contractlabel),
Codec.BOOL.fieldOf("signed").forGetter(Contractsigned)
).apply(instance, Contract::new)
);
}

Registering

import maven_group.modid.concept.Contract; // Контракт :)
// somewhere during static/mod initialization
private void init() {
OfflinePlayerCacheAPI.register(CONTRACT_RECORD_ID, Contract.class, Contract.CODEC, (Player player) -> {
// within this block, you decide how to translate a player's data to the Record you chose.
return new Contract(player.getName() + ":contracted", true);
});
}

Obtaining

var cache = OfflinePlayerCacheAPI.getCache(server);
cache.getEntry(Contract.class, "bibi_reden").ifPresent(contract -> {
    // we now know that there is a valid Contract entry for this player.
    // You can also use a UUID to fetch an entry as well.
});

A Special Thanks to our Sponsor


Sponsor Banner Use code "BAREMINIMUM" to get 15% off your first month!

Offline Player Cache Banner

MIT-MIT?style=for-the-badge&label=LICENCE&labelColor=1A1A1A&color=FFFFFF&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Foffline-player-cache%2Fblob%2F1.20.1%2Fmain%2FLICENSE offline-player-cache?style=for-the-badge&logo=github&labelColor=1A1A1A&color=FFFFFF&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Foffline-player-cache%2Fstargazers offline-player-cache?style=for-the-badge&logo=github&labelColor=1A1A1A&color=FFFFFF&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Foffline-player-cache%2Fforks offline-player-cache?style=for-the-badge&logo=github&label=ISSUES&link=https%3A%2F%2Fgithub.com%2FBareMinimumStudios%2Foffline-player-cache%2Fissues&labelColor=1A1A1A

fabric quilt forge

generic_vector.svg github_vector.svg java gradle discord-plural_vector.svg


Preamble 📝

Offline Player Cache: Directors Cut has been completely redone from the ground up, and its framework predates 1.* and below. This was developed in mind to have persistent leaderboards for servers for their offline players.

Content 📦

Modders may register Record's linked with an id and a Codec to serialize/deserialize it.

Upon a player's disconnection from the server, their cached data is stored into the servers level data, which then can be accessed through code or through the commands the mod provides.

Upon a player's reconnection to the server, their cached data is deleted.

Commands

/opc get <uuid>|<name> <key>

Provides details about the current player value. If they are online, it will provide their current value, but if they are offline, it will provide their cached value.

/opc remove <uuid>|<name> <key>

If the player with the associated username or UUID is offline, it will remove that players cached value based on the selected key. If the player is online, nothing will occur with this command.

/opc list <uuid>|<name>

Lists all the keys and values this player has stored if they are offline, or if they are online, their current ones.

Developers Guide

Setup

Offline Player Cache has a Modrinth and Curseforge page.

In order to develop with the API, please add the following:

gradle.properties

opc_version=...

build.gradle

repositories {
    maven {
        name = "Modrinth"
        url = "https://api.modrinth.com/maven"
        content {
            includeGroup "maven.modrinth"
        }
    }
}

dependencies {
    modImplementation "maven.modrinth:opc-directors-cut:${project.opc_version}"
    // include this if you do not want to force your users to install the mod.
    include "maven.modrinth:opc-directors-cut:${project.opc_version}"
}
Alternatively, if you are using Kotlin DSL:

build.gradle.kts

repositories {
    maven {
        name = "Modrinth"
        url = uri("https://api.modrinth.com/maven")
        content {
            includeGroup("maven.modrinth")
        }
    }
}

dependencies {
    modImplementation("maven.modrinth:opc-directors-cut:${properties["opc_version"]}")
    // include this if you do not want to force your users to install the mod.
    include("maven.modrinth:opc-directors-cut:${properties["opc_version"]}")
}

Migration to 2.*

  • There are no longer any concepts of keys. Instead, you are to register an id, a Record, and a Codec.

Creating a Record

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;

public record Contract(String label, boolean signed) {
    public static Codec<Contract> CODEC = RecordCodecBuilder.create((instance) ->
        instance.group(
            Codec.STRING.fieldOf("label").forGetter(Contract::label),
            Codec.BOOL.fieldOf("signed").forGetter(Contract::signed)
        ).apply(instance, Contract::new)
    );
}

Registering

import maven_group.modid.concept.Contract; // Контракт :)

// somewhere during static/mod initialization
private void init() {
    OfflinePlayerCacheAPI.register(CONTRACT_RECORD_ID, Contract.class, Contract.CODEC, (Player player) -> {
        // within this block, you decide how to translate a player's data to the Record you chose.
        return new Contract(player.getName() + ":contracted", true);
    });
}

Obtaining

var cache = OfflinePlayerCacheAPI.getCache(server);
cache.getEntry(Contract.class, "bibi_reden").ifPresent(contract -> {
    // we now know that there is a valid Contract entry for this player.
    // You can also use a UUID to fetch an entry as well.
});

A Special Thanks to our Sponsor


Sponsor Banner

Use code "BAREMINIMUM" to get 15% off your first month!

Screenshots

Gallery

This project has no gallery images yet.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

~8,000
Total Downloads
CurseForge
~1,000
Modrinth
~7,000
Last Updated
CurseForge
Modrinth
Created
CurseForge
Modrinth
Last synced
When ModDex last fetched and imported data for this project from CurseForge or Modrinth. High-traffic and active projects are checked more often.
Next pipeline sync