Coder Social home page Coder Social logo

merryweatherlost / offline-player-cache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bareminimumstudios/offline-player-cache

0.0 0.0 0.0 229 KB

A Minecraft Fabric API to cache specific player data when they are offline.

License: MIT License

offline-player-cache's Introduction

Offline Player Cache

Notice

Readme is in-progress as we stabilize our first versions of the OfflinePlayerCache.

What is Offline Player Cache?

Offline Player Cache (OPC) is a Minecraft API mod built using the Fabric framework to allow caching player data on the server while the player is offline. This means that mods can use this API to access offline player's data. This was primarily developed as a way to allow global and persistent leaderboards for Minecraft servers that included offline players.

Specific Capabilities

Mods can register functions that take in a player and output a value/object; this value/object is limited only by what is specified in the key's read/write to/from nbt data. When a player disconnects from a server, all registered functions are called and the respective data is cached on the server before the player disconnects. This data is saved to the server's level data, and can be accessed any time. When the same player connects to the server, their cached data is deleted and instead when a value function is called, it returns the current value/object based on the online player.

Commands

  • /opc get uuid|name <uuid|name> <key> Returns the input uuid/name player's value; if they are online, returns their current value, if they are offline returns their cached value; else returns null. If the value is an instanceof Number and run from a command block, the redstone output is the absolute modulus of 16.
  • /opc remove uuid|name <uuid|name> <key> If the input uuid/name player is offline, removes that player's cached value determined by the input key; if the player is online, does nothing.
  • /opc remove uuid|name <uuid|name> If the input uuid/name player is offline, removes all of their cached data; if the player is online, does nothing.

Notes

  • This API mod does not itself register any cacheable values, and hence does not cache any player data, and therefore does nothing by itself.
  • To use this API in your mod, you can include the following in your gradle build (see Modrinth Maven for more details):
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>"
}

offline-player-cache's People

Contributors

bibi-reden avatar clevernucleus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.