Skip to content
Merged
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
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag:
description: 'Release Tag (e.g. v1.2.0)'
required: true
default: 'v1.2.0'

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout OumProfile
uses: actions/checkout@v4

- name: Checkout OumLib
uses: actions/checkout@v4
with:
repository: sun-mc-dev/oumlib
path: oumlib
ref: dev
token: ${{ secrets.GH_PAT || github.token }}

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'

- name: Build and Install OumLib
run: mvn clean install -DskipTests -f oumlib/pom.xml

- name: Determine Release Tag
id: vars
run: |
if [ -n "${{ github.event.inputs.tag }}" ]; then
echo "TAG_NAME=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
else
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
fi

- name: Build OumProfile
run: |
mvn clean package -DskipTests
cp target/oumprofile-*.jar target/OumProfile-${{ env.TAG_NAME }}.jar
cd target
sha256sum OumProfile-${{ env.TAG_NAME }}.jar > checksums.txt
cd ..

- name: Publish GitHub Release
run: |
gh release create ${{ env.TAG_NAME }} \
target/OumProfile-${{ env.TAG_NAME }}.jar \
target/checksums.txt \
--title "OumProfile ${{ env.TAG_NAME }}" \
--generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
444 changes: 236 additions & 208 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>dev.oum</groupId>
<artifactId>oumprofile</artifactId>
<version>1.2-SNAPSHOT</version>
<version>1.2.0</version>
<packaging>jar</packaging>

<properties>
Expand Down Expand Up @@ -43,7 +43,7 @@
<dependency>
<groupId>dev.oum</groupId>
<artifactId>oumlib-core</artifactId>
<version>1.0.8</version>
<version>1.0.9</version>
<scope>compile</scope>
</dependency>

Expand Down
19 changes: 10 additions & 9 deletions src/main/java/dev/oum/profile/OumProfile.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.oum.profile;

import dev.oum.oumlib.OumLib;
import dev.oum.oumlib.config.ConfigManager;
import dev.oum.oumlib.text.Text;
import dev.oum.profile.api.ProfileAPI;
import dev.oum.profile.command.ProfileCommand;
Expand All @@ -22,20 +21,22 @@ public final class OumProfile extends JavaPlugin {
public void onEnable() {
OumLib.init(this);

ConfigManager<ProfileConfig> configManager = ConfigManager.of(ProfileConfig.class,
"config.yml", ProfileConfig::defaults)
.onReload(cfg -> OumLib.setDebug(cfg.debug()))
.enableAutoReload();
ProfileConfig config = ProfileConfig.create(() -> {
if (manager != null) {
OumLib.setDebug(manager.config().main().debug());
manager.startAutoSave();
}
});

OumLib.setDebug(configManager.get().debug());
OumLib.setDebug(config.main().debug());

storage = new ProfileStorage(configManager.get().storage());
manager = new ProfileManager(configManager, storage);
storage = new ProfileStorage(config.main().storage());
manager = new ProfileManager(config, storage);
ProfileAPI.init(manager);

ProfilePlaceholders.register(manager);

new ProfileListener(manager, configManager);
new ProfileListener(manager);
new ProfileCommand(manager).register();

List.of(
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/oum/profile/ProfilePlaceholders.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.oum.profile;

import dev.oum.oumlib.text.Format;
import dev.oum.oumlib.text.placeholder.PlaceholderRegistry;
import dev.oum.oumlib.util.Format;
import dev.oum.profile.integration.SkillData;
import dev.oum.profile.profile.ProfileManager;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -67,7 +67,7 @@ public static void register(@NonNull ProfileManager manager) {
return Format.duration(Duration.ofSeconds(base + elapsed));
});

var config = manager.configManager().get();
var config = manager.config().main();
if (config.economy() != null && config.economy().currencies() != null) {
for (String currency : config.economy().currencies()) {
registerCurrencyPlaceholder(currency, manager);
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/dev/oum/profile/api/ProfileAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,24 @@ public static long getProfilePlaytimeSeconds(@NonNull UUID uuid, @NonNull String
public static boolean renameProfile(@NonNull Player player, @NonNull String oldName, @NonNull String newName) {
return manager().renameProfile(player, oldName, newName);
}

/**
* Triggers an asynchronous batch save of all online players' active profile states to database storage.
*
* @return A Promise completing when all profile saves have concluded.
*/
public static @NonNull Promise<Void> saveAllOnline() {
return manager().saveAllOnline();
}

/**
* Prunes all offline player profiles from the database that haven't been used in the given number of days.
* Profiles belonging to currently online players are preserved.
*
* @param days Inactivity threshold in days (must be greater than 0).
* @return A Promise completing with the number of deleted profile rows.
*/
public static @NonNull Promise<Integer> pruneInactiveProfiles(int days) {
return manager().pruneInactiveProfiles(days);
}
}
2 changes: 1 addition & 1 deletion src/main/java/dev/oum/profile/command/Permissions.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.oum.profile.command;

import dev.oum.oumlib.util.Permission;
import dev.oum.oumlib.bridge.permission.Permission;

public final class Permissions {

Expand Down
Loading
Loading