Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Deployment (J21)
on:
push:
branches-ignore:
- master
- "**/dev**"
- "**-dev"
- "**-dev**"
- dev

jobs:
build-and-deploy:
env:
BRANCH_PREFIX: $(cat gradle.properties | grep mod_version | cut -d'+' -f2)
strategy:
matrix:
java: [21]
runs-on: ubuntu-latest
steps:
- name: check environment variables
run: env
- name: checkout repository
uses: actions/checkout@v3
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: "microsoft"
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
run: ./gradlew build
- name: capture build artifacts (neoforge)
if: |
${{ matrix.java == '21' }}
github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
uses: actions/upload-artifact@v3
with:
name: Artifacts (NeoForge)
path: neoforge/build/libs/
- name: capture build artifacts (fabric)
if: |
${{ matrix.java == '21' }}
github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
uses: actions/upload-artifact@v3
with:
name: Artifacts (Fabric)
path: fabric/build/libs/
- name: get mod version
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
id: mod_version
run: |
archived_name=$(grep "archives_base_name" gradle.properties | cut -d'=' -f2 | tr -d '\n')
mod_version_val=$(grep "mod_version" gradle.properties | cut -d'=' -f2 | tr -d '\n')
commitish_val=$(grep "mod_version" gradle.properties | cut -d'=' -f2 | cut -d'-' -f1 | tr -d '\n')
echo "archive_name=$archived_name" >> $GITHUB_OUTPUT
echo "mod_version=$mod_version_val" >> $GITHUB_OUTPUT
echo "commitish=$commitish_val/main" >> $GITHUB_OUTPUT
- name: get minecraft version
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
id: minecraft_version
run: |
minecraft_version_val=$(grep "minecraft_version" gradle.properties | cut -d'=' -f2 | tr -d '\n')
echo "minecraft_version=$minecraft_version_val" >> $GITHUB_OUTPUT

- name: deploy fabric! (mc-publish)
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
uses: Kir-Antipov/mc-publish@v3.3
with:
name: ${{ steps.mod_version.outputs.mod_version }}
files: |
fabric/build/libs/!(*-@(dev|sources|javadoc|shadow)).jar
fabric/build/libs/*-@(dev|sources|javadoc|shadow).jar
github-files: |
fabric/build/libs/!(*-@(dev|sources|javadoc|shadow)).jar
fabric/build/libs/*-@(dev|sources|javadoc|shadow).jar

modrinth-id: oLPaySSb
curseforge-id: 1019391

curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

github-tag: ${{ steps.mod_version.outputs.mod_version }}
github-token: ${{ secrets.REPOSITORY_TOKEN }}
github-commitish: ${{ steps.commitish.outputs.commitish }}

version: ${{ steps.mod_version.outputs.mod_version }}-fabric
changelog-file: CHANGELOG.md

loaders: |
fabric
quilt

dependencies: |
fabric-api@0.100.8+1.21(required){modrinth:P7dR8mSH}{curseforge:306612}#(ignore:github)
fabric-language-kotlin@1.9.5+kotlin.1.8.22(required){modrinth:Ha28R6CL}{curseforge:308769}#(ignore:github)

game-versions: "${{ steps.minecraft_version.outputs.minecraft_version }}"
java: "${{ matrix.java }}"

- name: deploy neoforge! (mc-publish)
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
uses: Kir-Antipov/mc-publish@v3.3
with:
name: ${{ steps.mod_version.outputs.mod_version }}

files: |
neoforge/build/libs/!(*-@(dev|sources|javadoc|shadow)).jar
neoforge/build/libs/*-@(dev|sources|javadoc|shadow).jar
github-files: |
neoforge/build/libs/!(*-@(dev|sources|javadoc|shadow)).jar
neoforge/build/libs/*-@(dev|sources|javadoc|shadow).jar

modrinth-id: oLPaySSb
curseforge-id: 1019391

curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
modrinth-token: "${{ secrets.MODRINTH_TOKEN }}"

github-tag: ${{ steps.mod_version.outputs.mod_version }}
github-token: ${{ secrets.REPOSITORY_TOKEN }}
github-commitish: ${{ steps.commitish.outputs.commitish }}

version: ${{ steps.mod_version.outputs.mod_version }}-neoforge
changelog-file: CHANGELOG.md

loaders: |
neoforge

dependencies: |
kotlinforforge@4.10.0(required){modrinth:ordsPcFz}{curseforge:351264}#(ignore:github)

game-versions: "${{ steps.minecraft_version.outputs.minecraft_version }}"
java: "${{ matrix.java }}"
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
build/
*.ipr
run/
*.iws
out/
*.iml
.gradle/
output/
bin/
libs/

.classpath
.project
.idea/
classes/
.metadata
.vscode
.settings
*.launch
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Changes 🌽
- Added extension (reified) functions that could prove to be useful to Kotlin users.
93 changes: 71 additions & 22 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,22 +1,71 @@
# MIT License

Copyright (c) 2022 CleverNucleus
Copyright (c) 2024 Bare Minimum Studios

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The Bare Minimum License (BML) v1.0
-----------------------------------
"This license does the bare minimum to protect you, but at least it does something."

Copyright (c) 2025 Bare Minimum Studios

This Work may include both code (software, scripts, binaries) and assets
(artwork, textures, models, sounds, music, documentation). The following
terms apply:

1. Attribution
You must keep this copyright notice and license text in all copies or
substantial portions of the Work.

2. Code Permissions
You may freely use, copy, modify, merge, publish, distribute,
sublicense, and/or sell the code portions of this Work, provided that
you comply with the Anti-Reposting clause below.

3. Asset Restrictions
Assets included in this Work (artwork, textures, models, sounds,
music, documentation) may only be used as part of this Work. They may
not be extracted, republished, modified, mirrored, or redistributed
separately without the express written permission of the copyright
holder.

Exception: Non-commercial community uses such as screenshots,
gameplay videos, reviews, thumbnails, commentary, and fan art are
permitted, provided they include attribution where reasonable and do
not claim to be official works.

4. Anti-Reposting
You may not redistribute this Work in substantially unmodified form on
third-party modding platforms, websites, or repositories (including but not
limited to CurseForge, Modrinth, 9Minecraft, and their mirrors) unless you
are the copyright holder or have explicit written permission.

This restriction does not apply to derivative works, forks, or independent
projects that incorporate portions of the code under the terms of this License.

5. Patent Protection
Each contributor grants a perpetual, worldwide, non-exclusive,
royalty-free, irrevocable patent license to make, use, and distribute
the code portions of this Work. If you initiate patent litigation
claiming that the Work infringes a patent, your rights under this
License terminate immediately.

6. Contributions
By submitting code, assets, or other materials to this Work, you agree
that your contributions are licensed under the Bare Minimum License.

7. Modpacks
You may include this Work in publicly distributed modpacks provided you
comply with Attribution (Section 1) and Anti-Reposting (Section 4).
Modpacks may not extract or reuse assets outside of this Work.

8. Trademarks & Naming
You may not use the original project name, branding, or trademarks in a
way that suggests your fork, port, or derivative is the official version.
Reasonable descriptive uses (e.g., "Fork of <Project>", "<Project>: Director’s
Cut", or "Unofficial <Project> Port") are permitted, provided they clearly
distinguish your project from the original.

9. Warranty Disclaimer
THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR
OTHER LIABILITY, WHETHER IN CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
OUT OF, OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS IN
THE WORK.
110 changes: 42 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
![Offline Player Cache Banner](https://cdn.modrinth.com/data/cached_images/38a9b779772577bb5924af170e38f9cb1e313855.png)

<p style="text-align: center">
<img href="https://github.com/PlayerEXDirectorsCut/offline-player-cache/blob/1.20.1/main/LICENSE" src="https://img.shields.io/badge/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">
<img href="https://github.com/PlayerEXDirectorsCut/offline-player-cache/stargazers" src="https://img.shields.io/github/stars/PlayerEXDirectorsCut/offline-player-cache?style=for-the-badge&logo=github&labelColor=1A1A1A&color=FFFFFF&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Foffline-player-cache%2Fstargazers">
<img href="https://github.com/PlayerEXDirectorsCut/offline-player-cache/forks" src="https://img.shields.io/github/forks/PlayerEXDirectorsCut/offline-player-cache?style=for-the-badge&logo=github&labelColor=1A1A1A&color=FFFFFF&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Foffline-player-cache%2Fforks">
<img href="https://github.com/PlayerEXDirectorsCut/offline-player-cache/issues" src="https://img.shields.io/github/issues/BareMinimumStudios/offline-player-cache?style=for-the-badge&logo=github&label=ISSUES&link=https%3A%2F%2Fgithub.com%2FBareMinimumStudios%2Foffline-player-cache%2Fissues&labelColor=1A1A1A">
</p>

<p style="text-align: center">
<img alt="fabric" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/fabric_vector.svg">
<img alt="quilt" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/quilt_vector.svg">
<img alt="forge" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/forge_vector.svg">
</p>

<p style="text-align: center">
<a href="https://bareminimumstudios.github.io/Bare-Minimum-Docs/">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/documentation/generic_vector.svg">
</a>
<a href="https://github.com/BareMinimumStudios/offline-player-cache">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/github_vector.svg">
</a>
<img alt="java" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/built-with/java_vector.svg">
<img alt="gradle" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/built-with/gradle_vector.svg">
<a href="https://discord.gg/pcRw79hwey">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/social/discord-plural_vector.svg">
</a>
</p>

---
![Offline Player Cache Banner](https://cdn.modrinth.com/data/cached_images/8bf7b045806b81dba417cabafe08bed2d4fd4a1c.png)
[![GitHub license](https://img.shields.io/badge/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)](https://github.com/PlayerEXDirectorsCut/offline-player-cache/blob/1.20.1/main/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/PlayerEXDirectorsCut/offline-player-cache?style=for-the-badge&logo=github&labelColor=1A1A1A&color=FFFFFF&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Foffline-player-cache%2Fstargazers
)](https://github.com/PlayerEXDirectorsCut/offline-player-cache/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/PlayerEXDirectorsCut/offline-player-cache?style=for-the-badge&logo=github&labelColor=1A1A1A&color=FFFFFF&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Foffline-player-cache%2Fforks
)](https://github.com/PlayerEXDirectorsCut/offline-player-cache/forks)
[![GitHub issues](https://img.shields.io/github/issues/PlayerEXDirectorsCut/offline-player-cache?style=for-the-badge&logo=github&label=ISSUES&labelColor=1A1A1A&link=https%3A%2F%2Fgithub.com%2FPlayerEXDirectorsCut%2Foffline-player-cache%2Fissues
)](https://github.com/PlayerEXDirectorsCut/offline-player-cache/issues)

[![docs](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/documentation/generic_vector.svg)](https://playerexdirectorscut.github.io/Bare-Minimum-Docs/)
![mkdocs](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/built-with/mkdocs_vector.svg)
![java](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/built-with/java_vector.svg)
[![curseforge](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/curseforge_vector.svg)](https://www.curseforge.com/minecraft/mc-mods/opc-directors-cut)
[![modrinth](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/modrinth_vector.svg)](https://modrinth.com/mod/opc-directors-cut)

![fabric](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/fabric_vector.svg)
![quilt](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/quilt_vector.svg)

### Preamble 📝

Expand Down Expand Up @@ -87,7 +74,7 @@ dependencies {
```

<details><summary>Alternatively, if you are using Kotlin DSL:</summary>

**`build.gradle.kts`**

```kotlin
Expand All @@ -110,52 +97,39 @@ dependencies {

</details>

## Migration to `2.*`

- There are no longer any concepts of keys. Instead, you are to register an id, a `Record`, and a `Codec`.
### Migration to 2.0.0

### Creating a Record
- A considerable amount of internal and external changes have happened with the mod (again).
- It's record based, so you are able to register any `Record` with an associated identifier.
- More docs coming soon...

```java
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
### Using the Cache API
- In order to utilize the cache, utilize the new `OfflinePlayerCacheAPI`, which will allow you to register `CachedPlayerKeys` to the cache, and permit you to obtain data based on the keys provided.

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 & Using Keys

### Registering

```java
import maven_group.modid.concept.Contract; // Контракт :)
```kotlin
val LEVEL_KEY = ResourceLocation.tryBuild("opc", "level")!!

// 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);
});
@JvmRecord
data class Level(val level: Int) {
companion object {
val CODEC: Codec<Level> = RecordCodecBuilder.create {
it.group(Codec.INT.fieldOf("level").forGetter(Level::level)).apply(it, ::Level)
}
}
}

// static init
init {
OfflinePlayerCacheAPI.register(LEVEL_KEY, TestingKeys.Level::class.java, TestingKeys.Level.CODEC) { player ->
TestingKeys.Level(player.experienceLevel)
}
}
```
Once your key is registered, you are good to go!

### Obtaining

```java
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
Keys will automatically be managed by the cache, and you should be able to see these keys through the commands we provide.

---

Expand Down
Loading
Loading