Skip to content

Commit

Permalink
move to blob builds
Browse files Browse the repository at this point in the history
  • Loading branch information
SchnTgaiSpock committed Jan 26, 2024
1 parent bfdec28 commit 1ca35ce
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 21 deletions.
38 changes: 23 additions & 15 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
name: Java CI
# Modified from https://blob.build/docs/upload/github-action/
name: Publish build

on:
push:
branches:
- master
pull_request:
branches:
- master
- master

jobs:
build:

publish:
name: Upload build
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '[ci skip]') == false

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3.4.1
with:
java-version: '17'
distribution: 'adopt'
- name: Build with Maven
run: mvn clean package
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3.4.1
with:
java-version: "17"
distribution: "adopt"

- name: Build with Maven
run: mvn clean package

- name: Upload to Blob Builds
uses: WalshyDev/blob-builds/gh-action@main
with:
project: SlimeHUD
apiToken: ${{ secrets.BLOB_BUILDS_API_TOKEN }}
releaseNotes: ${{ github.event.head_commit.message }}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<dependency>
<groupId>com.github.Slimefun</groupId>
<artifactId>Slimefun4</artifactId>
<version>RC-33</version>
<version>RC-36</version>
<scope>provided</scope>
<exclusions>
<exclusion>
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/io/github/schntgaispock/slimehud/SlimeHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.github.mooy1.infinitylib.core.AddonConfig;
import io.github.schntgaispock.slimehud.command.CommandManager;
import io.github.schntgaispock.slimehud.waila.WAILAManager;
import io.github.thebusybiscuit.slimefun4.libraries.dough.updater.BlobBuildUpdater;
import lombok.Getter;

public class SlimeHUD extends AbstractAddon {
Expand All @@ -27,6 +28,7 @@ public SlimeHUD() {
super("SchnTgaiSpock", "SlimeHUD", "master", "options.auto-update");
}


@Override
public void enable() {
instance = this;
Expand All @@ -35,7 +37,16 @@ public void enable() {
getLogger().info("# SlimeHUD by SchnTgaiSpock #");
getLogger().info("#=================================#");

Metrics metrics = new Metrics(this, 15883);
if (getConfig().getBoolean("options.auto-update")) {
if (getDescription().getVersion().startsWith("Dev - ")) {
new BlobBuildUpdater(this, getFile(), "SlimeHUD", "Dev").start();
} else {
getLogger().info("This is an unofficial build of SlimeHUD, so auto updates are disabled!");
getLogger().info("You can download the official build here: https://blob.build/project/Gastronomicon");
}
}

final Metrics metrics = new Metrics(this, 15883);
metrics.addCustomChart(
new SimplePie("disabled", () -> {
return "" + getConfig().getBoolean("waila.disabled");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ public String getItemName(Player p, SlimefunItem sfItem) {
if (!translationEnabled) {
return sfItem.getItemName();
}
return SlimefunTranslation.getTranslationService().getTranslatedItemName(
SlimefunTranslation.getUserService().getUser(p),
sfItem
);

try {
return SlimefunTranslation.getTranslationService().getTranslatedItemName(
SlimefunTranslation.getUserService().getUser(p),
sfItem);
} catch (NoClassDefFoundError e) {
SlimeHUD.getInstance().getLogger().info("Could not get item translation! Please update SlimefunTranslation");
translationEnabled = false;
return sfItem.getItemName();
}
}
}

0 comments on commit 1ca35ce

Please sign in to comment.