Compare commits
3 Commits
5f0085d2ce
..
v0.4.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f3bb68719 | |||
| fa52df1d39 | |||
| 32165b87e7 |
@@ -0,0 +1,77 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up JDK 21
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: "21"
|
||||||
|
|
||||||
|
- name: Build jar
|
||||||
|
run: ./gradlew build
|
||||||
|
|
||||||
|
- name: Find release artifact
|
||||||
|
id: artifact
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
jar=$(find build/libs -maxdepth 1 -type f -name '*.jar' ! -name '*-sources.jar' ! -name '*-javadoc.jar' | head -n 1)
|
||||||
|
if [ -z "${jar}" ]; then
|
||||||
|
echo "No jar artifact found in build/libs" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "path=${jar}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "name=$(basename "$jar")" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Create Gitea release
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [ -z "${GITEA_TOKEN:-}" ]; then
|
||||||
|
echo "Missing GITEA_TOKEN secret" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
api="${GITHUB_SERVER_URL}/api/v1"
|
||||||
|
repo="${GITHUB_REPOSITORY}"
|
||||||
|
tag="${GITHUB_REF_NAME}"
|
||||||
|
release_name="${tag}"
|
||||||
|
jar_path="${{ steps.artifact.outputs.path }}"
|
||||||
|
jar_name="${{ steps.artifact.outputs.name }}"
|
||||||
|
|
||||||
|
payload=$(jq -n \
|
||||||
|
--arg tag_name "$tag" \
|
||||||
|
--arg name "$release_name" \
|
||||||
|
--arg body "Automated release for $tag" \
|
||||||
|
'{tag_name:$tag_name,name:$name,body:$body,draft:false,prerelease:false}')
|
||||||
|
|
||||||
|
release=$(curl -fsSL \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "$payload" \
|
||||||
|
"${api}/repos/${repo}/releases")
|
||||||
|
|
||||||
|
release_id=$(printf '%s' "$release" | jq -r '.id')
|
||||||
|
upload_url="${api}/repos/${repo}/releases/${release_id}/assets?name=${jar_name}"
|
||||||
|
|
||||||
|
curl -fsSL \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary @"${jar_path}" \
|
||||||
|
"${upload_url}"
|
||||||
+1
-1
@@ -10,7 +10,7 @@ loom_version=1.16.1
|
|||||||
fabric_api_version=0.141.3+1.21.11
|
fabric_api_version=0.141.3+1.21.11
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=0.4.0
|
mod_version=0.4.1
|
||||||
maven_group=com.g2806.soulsteal
|
maven_group=com.g2806.soulsteal
|
||||||
archives_base_name=soul-steal
|
archives_base_name=soul-steal
|
||||||
|
|
||||||
|
|||||||
@@ -5,23 +5,23 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* Main configuration tree for the mod's economy, bounty, tracker, and permission settings.
|
* Main configuration tree for the mod's economy, bounty, tracker, and permission settings.
|
||||||
*/
|
*/
|
||||||
public record SoulStealConfig(
|
public record SoulStealConfig(
|
||||||
EconomyConfig economy,
|
EconomyConfig economy,
|
||||||
BountyConfig bounty,
|
BountyConfig bounty,
|
||||||
TrackerConfig tracker,
|
TrackerConfig tracker,
|
||||||
ContractConfig contracts,
|
ContractConfig contracts,
|
||||||
ShopUiConfig shop,
|
ShopUiConfig shop,
|
||||||
HudConfig hud,
|
HudConfig hud,
|
||||||
PermissionConfig permissions
|
PermissionConfig permissions
|
||||||
) {
|
) {
|
||||||
public static SoulStealConfig fromMap(Map<String, Object> root) {
|
public static SoulStealConfig fromMap(Map<String, Object> root) {
|
||||||
Map<String, Object> economySection = YamlConfigHelper.section(root, "economy");
|
Map<String, Object> economySection = YamlConfigHelper.section(root, "economy");
|
||||||
Map<String, Object> deathPenaltySection = YamlConfigHelper.section(economySection, "death_penalty");
|
Map<String, Object> deathPenaltySection = YamlConfigHelper.section(economySection, "death_penalty");
|
||||||
Map<String, Object> transferSection = YamlConfigHelper.section(economySection, "transfer");
|
Map<String, Object> transferSection = YamlConfigHelper.section(economySection, "transfer");
|
||||||
Map<String, Object> bountySection = YamlConfigHelper.section(root, "bounties");
|
Map<String, Object> bountySection = YamlConfigHelper.section(root, "bounties");
|
||||||
Map<String, Object> trackerSection = YamlConfigHelper.section(root, "tracker");
|
Map<String, Object> trackerSection = YamlConfigHelper.section(root, "tracker");
|
||||||
Map<String, Object> contractsSection = YamlConfigHelper.section(root, "contracts");
|
Map<String, Object> contractsSection = YamlConfigHelper.section(root, "contracts");
|
||||||
Map<String, Object> shopSection = YamlConfigHelper.section(root, "shop");
|
Map<String, Object> shopSection = YamlConfigHelper.section(root, "shop");
|
||||||
Map<String, Object> hudSection = YamlConfigHelper.section(root, "hud");
|
Map<String, Object> hudSection = YamlConfigHelper.section(root, "hud");
|
||||||
Map<String, Object> scoreboardSection = YamlConfigHelper.section(hudSection, "scoreboard");
|
Map<String, Object> scoreboardSection = YamlConfigHelper.section(hudSection, "scoreboard");
|
||||||
Map<String, Object> bossbarSection = YamlConfigHelper.section(hudSection, "bounty_bossbar");
|
Map<String, Object> bossbarSection = YamlConfigHelper.section(hudSection, "bounty_bossbar");
|
||||||
@@ -64,21 +64,21 @@ public record SoulStealConfig(
|
|||||||
bountyConfig = bountyConfig.withMaxDurationSeconds(bountyConfig.minDurationSeconds());
|
bountyConfig = bountyConfig.withMaxDurationSeconds(bountyConfig.minDurationSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackerConfig trackerConfig = new TrackerConfig(
|
TrackerConfig trackerConfig = new TrackerConfig(
|
||||||
YamlConfigHelper.bool(trackerSection, "enabled", true),
|
YamlConfigHelper.bool(trackerSection, "enabled", true),
|
||||||
Math.max(30L, YamlConfigHelper.longValue(trackerSection, "duration_seconds", 900L)),
|
Math.max(30L, YamlConfigHelper.longValue(trackerSection, "duration_seconds", 900L)),
|
||||||
Math.max(1, YamlConfigHelper.intValue(trackerSection, "update_interval_ticks", 20)),
|
Math.max(1, YamlConfigHelper.intValue(trackerSection, "update_interval_ticks", 20)),
|
||||||
YamlConfigHelper.bool(trackerSection, "expire_if_target_offline", false)
|
YamlConfigHelper.bool(trackerSection, "expire_if_target_offline", false)
|
||||||
);
|
);
|
||||||
|
|
||||||
ContractConfig contractConfig = new ContractConfig(
|
ContractConfig contractConfig = new ContractConfig(
|
||||||
YamlConfigHelper.bool(contractsSection, "enabled", true),
|
YamlConfigHelper.bool(contractsSection, "enabled", true),
|
||||||
YamlConfigHelper.bool(contractsSection, "auto_claim", true),
|
YamlConfigHelper.bool(contractsSection, "auto_claim", true),
|
||||||
new ContractHudConfig(
|
new ContractHudConfig(
|
||||||
YamlConfigHelper.bool(contractsSection, "hud_enabled", true),
|
YamlConfigHelper.bool(contractsSection, "hud_enabled", true),
|
||||||
YamlConfigHelper.string(contractsSection, "hud_title", "Active Contract")
|
YamlConfigHelper.string(contractsSection, "hud_title", "Active Contract")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
ShopUiConfig shopUiConfig = new ShopUiConfig(
|
ShopUiConfig shopUiConfig = new ShopUiConfig(
|
||||||
YamlConfigHelper.string(shopSection, "title", "Soul Shop"),
|
YamlConfigHelper.string(shopSection, "title", "Soul Shop"),
|
||||||
@@ -117,80 +117,82 @@ public record SoulStealConfig(
|
|||||||
YamlConfigHelper.string(permissionsSection, "leaderboard_node", "soulsteal.leaderboard")
|
YamlConfigHelper.string(permissionsSection, "leaderboard_node", "soulsteal.leaderboard")
|
||||||
);
|
);
|
||||||
|
|
||||||
return new SoulStealConfig(economyConfig, bountyConfig, trackerConfig, contractConfig, shopUiConfig, hudConfig, permissionConfig);
|
return new SoulStealConfig(economyConfig, bountyConfig, trackerConfig, contractConfig, shopUiConfig, hudConfig, permissionConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String defaultYaml() {
|
public static String defaultYaml() {
|
||||||
return """
|
return """
|
||||||
economy:
|
economy:
|
||||||
starting_souls: 0
|
starting_souls: 0
|
||||||
max_souls: 1000000
|
max_souls: 1000000
|
||||||
kill_reward: 25
|
kill_reward: 25
|
||||||
death_penalty:
|
death_penalty:
|
||||||
flat: 15
|
flat: 15
|
||||||
percent: 0.10
|
percent: 0.10
|
||||||
minimum: 5
|
minimum: 5
|
||||||
maximum: 100
|
maximum: 100
|
||||||
transfer:
|
transfer:
|
||||||
enabled: true
|
enabled: true
|
||||||
minimum: 1
|
minimum: 1
|
||||||
|
|
||||||
bounties:
|
bounties:
|
||||||
enabled: true
|
enabled: true
|
||||||
min_value: 25
|
min_value: 25
|
||||||
max_value: 10000
|
max_value: 10000
|
||||||
default_duration_seconds: 7200
|
default_duration_seconds: 7200
|
||||||
min_duration_seconds: 600
|
min_duration_seconds: 600
|
||||||
max_duration_seconds: 86400
|
max_duration_seconds: 86400
|
||||||
survivor_reward_percent: 0.50
|
survivor_reward_percent: 0.50
|
||||||
placement_cooldown_seconds: 60
|
placement_cooldown_seconds: 60
|
||||||
max_active_per_target: 5
|
max_active_per_target: 5
|
||||||
max_active_per_placer: 3
|
max_active_per_placer: 3
|
||||||
|
|
||||||
tracker:
|
tracker:
|
||||||
enabled: true
|
enabled: true
|
||||||
duration_seconds: 900
|
duration_seconds: 900
|
||||||
update_interval_ticks: 20
|
update_interval_ticks: 20
|
||||||
expire_if_target_offline: false
|
expire_if_target_offline: false
|
||||||
|
|
||||||
contracts:
|
|
||||||
enabled: true
|
|
||||||
auto_claim: true
|
|
||||||
hud_enabled: true
|
|
||||||
hud_title: "Active Contract"
|
|
||||||
|
|
||||||
shop:
|
|
||||||
title: "Soul Shop"
|
|
||||||
rows: 3
|
|
||||||
filler_item: "minecraft:black_stained_glass_pane"
|
|
||||||
default_purchase_cooldown_seconds: 0
|
|
||||||
enable_custom_amount_selector: true
|
|
||||||
default_max_custom_amount: 64
|
|
||||||
|
|
||||||
hud:
|
contracts:
|
||||||
scoreboard:
|
enabled: true
|
||||||
enabled: true
|
auto_claim: true
|
||||||
default_visible: false
|
hud_enabled: true
|
||||||
title: "Soul HUD"
|
hud_title: "Active Contract"
|
||||||
bounty_bossbar:
|
|
||||||
enabled: true
|
|
||||||
title: "Bounty on You"
|
|
||||||
leaderboard:
|
|
||||||
page_size: 10
|
|
||||||
|
|
||||||
permissions:
|
shop:
|
||||||
# soulsteal.admin grants every admin-only action below.
|
title: "Soul Shop"
|
||||||
admin_node: "soulsteal.admin"
|
rows: 3
|
||||||
reload_node: "soulsteal.admin.reload"
|
filler_item: "minecraft:light_gray_stained_glass_pane"
|
||||||
shop_node: "soulsteal.shop"
|
default_purchase_cooldown_seconds: 0
|
||||||
bounty_node: "soulsteal.bounty"
|
enable_custom_amount_selector: true
|
||||||
balance_others_node: "soulsteal.admin.balance.others"
|
default_max_custom_amount: 64
|
||||||
set_node: "soulsteal.admin.balance.set"
|
|
||||||
add_node: "soulsteal.admin.balance.add"
|
hud:
|
||||||
take_node: "soulsteal.admin.balance.take"
|
scoreboard:
|
||||||
scoreboard_node: "soulsteal.scoreboard"
|
enabled: true
|
||||||
leaderboard_node: "soulsteal.leaderboard"
|
default_visible: false
|
||||||
""";
|
title: "Soul HUD"
|
||||||
|
|
||||||
|
bounty_bossbar:
|
||||||
|
enabled: true
|
||||||
|
title: "Bounty on You"
|
||||||
|
|
||||||
|
leaderboard:
|
||||||
|
page_size: 10
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
# soulsteal.admin grants every admin-only action below.
|
||||||
|
admin_node: "soulsteal.admin"
|
||||||
|
reload_node: "soulsteal.admin.reload"
|
||||||
|
shop_node: "soulsteal.shop"
|
||||||
|
bounty_node: "soulsteal.bounty"
|
||||||
|
balance_others_node: "soulsteal.admin.balance.others"
|
||||||
|
set_node: "soulsteal.admin.balance.set"
|
||||||
|
add_node: "soulsteal.admin.balance.add"
|
||||||
|
take_node: "soulsteal.admin.balance.take"
|
||||||
|
scoreboard_node: "soulsteal.scoreboard"
|
||||||
|
leaderboard_node: "soulsteal.leaderboard"
|
||||||
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double clampPercent(double value) {
|
private static double clampPercent(double value) {
|
||||||
@@ -198,7 +200,7 @@ public record SoulStealConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int clampRows(int rows) {
|
private static int clampRows(int rows) {
|
||||||
return Math.max(2, Math.min(6, rows));
|
return Math.max(2, Math.min(6, rows));
|
||||||
}
|
}
|
||||||
|
|
||||||
public record EconomyConfig(long startingSouls, long maxSouls, long killReward, DeathPenaltyConfig deathPenalty, TransferConfig transfer) {
|
public record EconomyConfig(long startingSouls, long maxSouls, long killReward, DeathPenaltyConfig deathPenalty, TransferConfig transfer) {
|
||||||
@@ -233,14 +235,14 @@ public record SoulStealConfig(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public record TrackerConfig(boolean enabled, long durationSeconds, int updateIntervalTicks, boolean expireIfTargetOffline) {
|
public record TrackerConfig(boolean enabled, long durationSeconds, int updateIntervalTicks, boolean expireIfTargetOffline) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public record ContractConfig(boolean enabled, boolean autoClaim, ContractHudConfig hud) {
|
public record ContractConfig(boolean enabled, boolean autoClaim, ContractHudConfig hud) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public record ContractHudConfig(boolean enabled, String title) {
|
public record ContractHudConfig(boolean enabled, String title) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public record ShopUiConfig(
|
public record ShopUiConfig(
|
||||||
String title,
|
String title,
|
||||||
@@ -277,4 +279,4 @@ public record SoulStealConfig(
|
|||||||
String leaderboardNode
|
String leaderboardNode
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user