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
23 changes: 10 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: 📦 Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ☕ Set up Java 21
uses: actions/setup-java@v3
Expand All @@ -26,24 +28,19 @@ jobs:
echo "BASE_VERSION=${BASE_VERSION%%-DEVBUILD*}" >> $GITHUB_ENV
echo "base_version=${BASE_VERSION%%-DEVBUILD*}" >> $GITHUB_OUTPUT

- name: 🔢 Get last dev build number
- name: 🔢 Get dev build number from commit count
id: get-devbuild
run: |
VERSION_FILE=".github/devbuild-count.txt"
VERSION="${{ steps.version.outputs.base_version }}"
mkdir -p .github
touch "$VERSION_FILE"

CURRENT=$(grep "^$VERSION=" "$VERSION_FILE" | cut -d= -f2)
if [ -z "$CURRENT" ]; then
CURRENT=1
LAST_TAG=$(git describe --tags --match "${{ env.BASE_VERSION }}*" --abbrev=0 2>/dev/null || echo "")
if [ -n "$LAST_TAG" ]; then
BUILD_NUM=$(git rev-list --count "$LAST_TAG"..HEAD)
else
CURRENT=$((CURRENT + 1))
BUILD_NUM=$(git rev-list --count HEAD)
fi

echo "$VERSION=$CURRENT" > "$VERSION_FILE"
echo "DEVBUILD=$CURRENT" >> $GITHUB_ENV
echo "build_num=$CURRENT" >> $GITHUB_OUTPUT
echo "DEVBUILD=$BUILD_NUM" >> $GITHUB_ENV
echo "build_num=$BUILD_NUM" >> $GITHUB_OUTPUT


- name: 🛠 Build with Maven
run: |
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release Build

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: 📦 Checkout Code
uses: actions/checkout@v4

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

- name: 🏷 Get Version from pom.xml
id: version
run: |
# Extracts the version defined in <version> or <revision> property
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
echo "version=$PROJECT_VERSION" >> $GITHUB_OUTPUT

- name: 🛠 Build Production JAR
run: |
echo "Building Release version: ${{ env.VERSION }}"
mvn clean package -Drevision=${{ env.VERSION }}

- name: 📦 Prepare Release Artifacts
run: |
mkdir -p dist
# Find the main JAR (excluding original/shaded duplicates if they exist)
JAR=$(find target -name "AutoPickup-${{ env.VERSION }}.jar" | head -n1)

if [ -z "$JAR" ]; then
echo "❌ Expected JAR target/AutoPickup-${{ env.VERSION }}.jar not found"
ls -l target
exit 1
fi

cp "$JAR" "dist/AutoPickup-${{ env.VERSION }}.jar"

- name: 📥 Upload Release Artifact
uses: actions/upload-artifact@v4
with:
name: AutoPickup-${{ env.VERSION }}-RELEASE
path: dist/*.jar
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<description>Automatically picks up the blocks you mine!</description>
<properties>
<revision>1.4.7-DEVBUILD.4</revision>
<revision>1.4.7-DEVBUILD.6</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<url>https://discord.gg/ncHH4FP</url>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/us/thezircon/play/autopickup/AutoPickup.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void onEnable() {
// Commands
getCommand("autopickup").setExecutor(new Auto());
getCommand("autodrops").setExecutor(new AutoDrops());
getCommand("autofishingdrops").setExecutor(new AutoFishingDrops());
getCommand("autofish").setExecutor(new AutoFishingDrops());
getCommand("autosmelt").setExecutor(new AutoSmelt());

// Crops by version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.bukkit.entity.Player;
import us.thezircon.play.autopickup.AutoPickup;
import us.thezircon.play.autopickup.commands.AutoPickup.subcommands.drops;
import us.thezircon.play.autopickup.commands.AutoPickup.subcommands.fishingdrops;
import us.thezircon.play.autopickup.commands.AutoPickup.subcommands.fishing;
import us.thezircon.play.autopickup.commands.AutoPickup.subcommands.reload;
import us.thezircon.play.autopickup.commands.AutoPickup.subcommands.smelt;
import us.thezircon.play.autopickup.commands.CMDManager;
Expand All @@ -25,7 +25,7 @@ public class Auto implements TabExecutor{
public Auto(){
subcommands.add(new reload());
subcommands.add(new drops());
subcommands.add(new fishingdrops());
subcommands.add(new fishing());
subcommands.add(new smelt());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

import java.util.List;

public class fishingdrops extends CMDManager {
public class fishing extends CMDManager {

private static final AutoPickup PLUGIN = AutoPickup.getPlugin(AutoPickup.class);

@Override
public String getName() {
return "fishingdrops";
return "fishing";
}

@Override
Expand All @@ -24,7 +24,7 @@ public String getDescription() {

@Override
public String getSyntax() {
return "/auto fishingdrops";
return "/auto fishing";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package us.thezircon.play.autopickup.listeners;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
Expand All @@ -9,6 +8,7 @@
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.ItemStack;
import us.thezircon.play.autopickup.AutoPickup;
import us.thezircon.play.autopickup.utils.SchedulerUtils;

import java.util.HashMap;
import java.util.List;
Expand All @@ -25,7 +25,7 @@ public void onFish(PlayerFishEvent e) {

if (!PLUGIN.autopickup_list_fishing.contains(player)) return;

Bukkit.getScheduler().runTaskAsynchronously(PLUGIN, new Runnable() {
SchedulerUtils.runTaskAsynchronously(new Runnable() {
@Override
public void run() {
boolean requirePermsAUTO = PLUGIN.getConfig().getBoolean("requirePerms.autopickup");
Expand All @@ -45,7 +45,7 @@ public void run() {
return;
}

Bukkit.getScheduler().runTask(PLUGIN, () -> {
SchedulerUtils.runTask(e.getPlayer().getLocation(), () -> {
Item caught = (Item) e.getCaught();

if (PLUGIN.getBlacklistConf().contains("BlacklistedFishing", true)) {
Expand Down Expand Up @@ -79,4 +79,4 @@ public void run() {
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void run() {
}

public void setEnabledFishing(boolean e) {
new BukkitRunnable() {
SchedulerUtils.runTaskLater(player.getLocation(), new BukkitRunnable() {
@Override
public void run() {
if (!fileExists()) {createFile();}
Expand All @@ -107,7 +107,7 @@ public void run() {
log.warning("[AutoPickup] Unable to update "+uuid+"'s data file.");
}
}
}.runTaskLater(plugin, 1);
}, 1);
}

public void setEnabledAutoSmelt(boolean e) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ commands:
autodrops:
description: Toggles the ability to automaticly pickup drops from killed entities.
aliases: [drops, autod]
autofishingdrops:
autofish:
description: Toggles the ability to automaticly pickup drops from fishing.
aliases: [fishingdrops, autofd]
aliases: [fishingdrops, autofd, autofishingdrops]
autosmelt:
description: Toggles the ability to automaticly smelt mined blocks.
aliases: [asmelt]
Expand Down
Loading