diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..89bb03a1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: Build and Upload + +on: + push: + branches: + - master + +jobs: + build: + name: Build and Upload + runs-on: ubuntu-latest + if: contains(github.event.head_commit.message, '[ci skip]') == false + + steps: + - uses: actions/checkout@v4.1.7 + + - name: Set up JDK 16 + uses: actions/setup-java@v4.2.1 + with: + java-version: 16 + distribution: adopt + + - name: Build with Maven + run: mvn package + + - name: Upload to Builds + uses: WalshyDev/blob-builds/gh-action@main + with: + project: SlimeTinker + apiToken: ${{ secrets.BLOB_BUILDS_API_TOKEN }} + file: ./target/SlimeTinker.jar + releaseNotes: ${{ github.event.head_commit.message }} diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index da0ddb65..402dbc50 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,4 +1,4 @@ -name: Java CI +name: Build on: push: @@ -24,12 +24,4 @@ jobs: distribution: adopt - name: Build with Maven - run: mvn package --file pom.xml - - - name: Upload to Builds - uses: WalshyDev/blob-builds/gh-action@main - with: - project: SlimeTinker - apiToken: ${{ secrets.BLOB_BUILDS_API_TOKEN }} - file: ./target/SlimeTinker.jar - releaseNotes: ${{ github.event.head_commit.message }} + run: mvn package diff --git a/pom.xml b/pom.xml index 6145b606..7f4fcf05 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 dev.sefiraat SlimeTinker - 0.1.1.2 + MODIFIED SlimeTinker Slimefun4 Addon SlimeTinker @@ -244,7 +244,7 @@ com.github.Slimefun Slimefun4 - 2c4f886 + 03e5b9a provided diff --git a/src/main/java/io/github/sefiraat/slimetinker/SlimeTinker.java b/src/main/java/io/github/sefiraat/slimetinker/SlimeTinker.java index 34a0ac88..f95335bd 100644 --- a/src/main/java/io/github/sefiraat/slimetinker/SlimeTinker.java +++ b/src/main/java/io/github/sefiraat/slimetinker/SlimeTinker.java @@ -1,6 +1,10 @@ package io.github.sefiraat.slimetinker; -import io.github.mooy1.infinitylib.core.AbstractAddon; +import java.text.MessageFormat; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import io.github.sefiraat.slimetinker.itemgroups.ItemGroups; import io.github.sefiraat.slimetinker.items.Casts; import io.github.sefiraat.slimetinker.items.Dies; @@ -16,14 +20,22 @@ import io.github.sefiraat.slimetinker.managers.MemoryManager; import io.github.sefiraat.slimetinker.managers.TraitManager; import io.github.sefiraat.slimetinker.runnables.RunnableManager; +import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon; +import io.github.thebusybiscuit.slimefun4.libraries.dough.updater.BlobBuildUpdater; + import org.bstats.bukkit.Metrics; +import org.bukkit.plugin.java.JavaPlugin; -public class SlimeTinker extends AbstractAddon { +public class SlimeTinker extends JavaPlugin implements SlimefunAddon { public static final int RUNNABLE_TICK_RATE = 40; private static SlimeTinker instance; + private final String username; + private final String repo; + private final String branch; + private RunnableManager runnableManager; private ListenerManager listenerManager; private TinkerMaterialManager tinkerMaterialManager; @@ -33,11 +45,13 @@ public class SlimeTinker extends AbstractAddon { private MemoryManager memoryManager; public SlimeTinker() { - super("Sefiraat", "SlimeTinker", "master", "auto-update"); + this.username = "Sefiraat"; + this.repo = "SlimeTinker"; + this.branch = "master"; } @Override - public void enable() { + public void onEnable() { new Metrics(this, 11748); @@ -64,10 +78,13 @@ public void enable() { this.listenerManager = new ListenerManager(this, this.getServer().getPluginManager()); + if (getConfig().getBoolean("auto-update") && getDescription().getVersion().startsWith("DEV")) { + new BlobBuildUpdater(this, getFile(), "SlimeTinker", "Dev").start(); + } } @Override - protected void disable() { + public void onDisable() { saveConfig(); instance = null; } @@ -101,6 +118,18 @@ public TraitManager getTraitManager() { return traitManager; } + @Nonnull + @Override + public JavaPlugin getJavaPlugin() { + return this; + } + + @Nullable + @Override + public String getBugTrackerURL() { + return MessageFormat.format("https://github.com/{0}/{1}/issues/", this.username, this.repo); + } + public static SlimeTinker getInstance() { return instance; } diff --git a/src/main/java/io/github/sefiraat/slimetinker/items/workstations/workbench/Workbench.java b/src/main/java/io/github/sefiraat/slimetinker/items/workstations/workbench/Workbench.java index e298767f..77b7aa60 100644 --- a/src/main/java/io/github/sefiraat/slimetinker/items/workstations/workbench/Workbench.java +++ b/src/main/java/io/github/sefiraat/slimetinker/items/workstations/workbench/Workbench.java @@ -1,10 +1,10 @@ package io.github.sefiraat.slimetinker.items.workstations.workbench; import io.github.mooy1.infinitylib.machines.CraftingBlock; -import io.github.sefiraat.slimetinker.SlimeTinker; import io.github.sefiraat.slimetinker.items.Workstations; import io.github.sefiraat.slimetinker.utils.GUIItems; import io.github.sefiraat.slimetinker.utils.ItemUtils; +import io.github.sefiraat.slimetinker.utils.Keys; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; @@ -22,7 +22,7 @@ public class Workbench extends CraftingBlock { - public static final RecipeType TYPE = new RecipeType(SlimeTinker.createKey("tinkers-workbench"), Workstations.TINKERS_WORKBENCH); + public static final RecipeType TYPE = new RecipeType(Keys.create("tinkers-workbench"), Workstations.TINKERS_WORKBENCH); protected static final int OUTPUT_SLOT = 25; protected static final int CRAFT_BUTTON = 23; private static final int[] BACKGROUND_SLOTS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 15, 16, 17, 18, 22, 24, 26, 27, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44};