Skip to content

Commit a8362b2

Browse files
authored
Merge pull request #81 from MrButtersDEV/dev
Merged dev to main
2 parents 449ffa6 + 125a8d3 commit a8362b2

9 files changed

Lines changed: 79 additions & 28 deletions

File tree

.github/workflows/build.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
steps:
1313
- name: 📦 Checkout Code
1414
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
1517

1618
- name: ☕ Set up Java 21
1719
uses: actions/setup-java@v3
@@ -26,24 +28,19 @@ jobs:
2628
echo "BASE_VERSION=${BASE_VERSION%%-DEVBUILD*}" >> $GITHUB_ENV
2729
echo "base_version=${BASE_VERSION%%-DEVBUILD*}" >> $GITHUB_OUTPUT
2830
29-
- name: 🔢 Get last dev build number
31+
- name: 🔢 Get dev build number from commit count
3032
id: get-devbuild
3133
run: |
32-
VERSION_FILE=".github/devbuild-count.txt"
33-
VERSION="${{ steps.version.outputs.base_version }}"
34-
mkdir -p .github
35-
touch "$VERSION_FILE"
36-
37-
CURRENT=$(grep "^$VERSION=" "$VERSION_FILE" | cut -d= -f2)
38-
if [ -z "$CURRENT" ]; then
39-
CURRENT=1
34+
LAST_TAG=$(git describe --tags --match "${{ env.BASE_VERSION }}*" --abbrev=0 2>/dev/null || echo "")
35+
if [ -n "$LAST_TAG" ]; then
36+
BUILD_NUM=$(git rev-list --count "$LAST_TAG"..HEAD)
4037
else
41-
CURRENT=$((CURRENT + 1))
38+
BUILD_NUM=$(git rev-list --count HEAD)
4239
fi
4340
44-
echo "$VERSION=$CURRENT" > "$VERSION_FILE"
45-
echo "DEVBUILD=$CURRENT" >> $GITHUB_ENV
46-
echo "build_num=$CURRENT" >> $GITHUB_OUTPUT
41+
echo "DEVBUILD=$BUILD_NUM" >> $GITHUB_ENV
42+
echo "build_num=$BUILD_NUM" >> $GITHUB_OUTPUT
43+
4744
4845
- name: 🛠 Build with Maven
4946
run: |

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: 📦 Checkout Code
14+
uses: actions/checkout@v4
15+
16+
- name: ☕ Set up Java 21
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: 'temurin'
20+
java-version: '21'
21+
cache: 'maven'
22+
23+
- name: 🏷 Get Version from pom.xml
24+
id: version
25+
run: |
26+
# Extracts the version defined in <version> or <revision> property
27+
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
28+
echo "VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
29+
echo "version=$PROJECT_VERSION" >> $GITHUB_OUTPUT
30+
31+
- name: 🛠 Build Production JAR
32+
run: |
33+
echo "Building Release version: ${{ env.VERSION }}"
34+
mvn clean package -Drevision=${{ env.VERSION }}
35+
36+
- name: 📦 Prepare Release Artifacts
37+
run: |
38+
mkdir -p dist
39+
# Find the main JAR (excluding original/shaded duplicates if they exist)
40+
JAR=$(find target -name "AutoPickup-${{ env.VERSION }}.jar" | head -n1)
41+
42+
if [ -z "$JAR" ]; then
43+
echo "❌ Expected JAR target/AutoPickup-${{ env.VERSION }}.jar not found"
44+
ls -l target
45+
exit 1
46+
fi
47+
48+
cp "$JAR" "dist/AutoPickup-${{ env.VERSION }}.jar"
49+
50+
- name: 📥 Upload Release Artifact
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: AutoPickup-${{ env.VERSION }}-RELEASE
54+
path: dist/*.jar

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<description>Automatically picks up the blocks you mine!</description>
1515
<properties>
16-
<revision>1.4.7-DEVBUILD.4</revision>
16+
<revision>1.4.7-DEVBUILD.6</revision>
1717
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1818
</properties>
1919
<url>https://discord.gg/ncHH4FP</url>

src/main/java/us/thezircon/play/autopickup/AutoPickup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void onEnable() {
158158
// Commands
159159
getCommand("autopickup").setExecutor(new Auto());
160160
getCommand("autodrops").setExecutor(new AutoDrops());
161-
getCommand("autofishingdrops").setExecutor(new AutoFishingDrops());
161+
getCommand("autofish").setExecutor(new AutoFishingDrops());
162162
getCommand("autosmelt").setExecutor(new AutoSmelt());
163163

164164
// Crops by version

src/main/java/us/thezircon/play/autopickup/commands/AutoPickup/Auto.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.bukkit.entity.Player;
88
import us.thezircon.play.autopickup.AutoPickup;
99
import us.thezircon.play.autopickup.commands.AutoPickup.subcommands.drops;
10-
import us.thezircon.play.autopickup.commands.AutoPickup.subcommands.fishingdrops;
10+
import us.thezircon.play.autopickup.commands.AutoPickup.subcommands.fishing;
1111
import us.thezircon.play.autopickup.commands.AutoPickup.subcommands.reload;
1212
import us.thezircon.play.autopickup.commands.AutoPickup.subcommands.smelt;
1313
import us.thezircon.play.autopickup.commands.CMDManager;
@@ -25,7 +25,7 @@ public class Auto implements TabExecutor{
2525
public Auto(){
2626
subcommands.add(new reload());
2727
subcommands.add(new drops());
28-
subcommands.add(new fishingdrops());
28+
subcommands.add(new fishing());
2929
subcommands.add(new smelt());
3030
}
3131

src/main/java/us/thezircon/play/autopickup/commands/AutoPickup/subcommands/fishingdrops.java renamed to src/main/java/us/thezircon/play/autopickup/commands/AutoPickup/subcommands/fishing.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
import java.util.List;
1010

11-
public class fishingdrops extends CMDManager {
11+
public class fishing extends CMDManager {
1212

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

1515
@Override
1616
public String getName() {
17-
return "fishingdrops";
17+
return "fishing";
1818
}
1919

2020
@Override
@@ -24,7 +24,7 @@ public String getDescription() {
2424

2525
@Override
2626
public String getSyntax() {
27-
return "/auto fishingdrops";
27+
return "/auto fishing";
2828
}
2929

3030
@Override

src/main/java/us/thezircon/play/autopickup/listeners/PlayerFishEventListener.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package us.thezircon.play.autopickup.listeners;
22

3-
import org.bukkit.Bukkit;
43
import org.bukkit.Location;
54
import org.bukkit.entity.Item;
65
import org.bukkit.entity.Player;
@@ -9,6 +8,7 @@
98
import org.bukkit.event.player.PlayerFishEvent;
109
import org.bukkit.inventory.ItemStack;
1110
import us.thezircon.play.autopickup.AutoPickup;
11+
import us.thezircon.play.autopickup.utils.SchedulerUtils;
1212

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

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

28-
Bukkit.getScheduler().runTaskAsynchronously(PLUGIN, new Runnable() {
28+
SchedulerUtils.runTaskAsynchronously(new Runnable() {
2929
@Override
3030
public void run() {
3131
boolean requirePermsAUTO = PLUGIN.getConfig().getBoolean("requirePerms.autopickup");
@@ -45,7 +45,7 @@ public void run() {
4545
return;
4646
}
4747

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

5151
if (PLUGIN.getBlacklistConf().contains("BlacklistedFishing", true)) {
@@ -79,4 +79,4 @@ public void run() {
7979
}
8080
});
8181
}
82-
}
82+
}

src/main/java/us/thezircon/play/autopickup/utils/PickupPlayer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void run() {
9191
}
9292

9393
public void setEnabledFishing(boolean e) {
94-
new BukkitRunnable() {
94+
SchedulerUtils.runTaskLater(player.getLocation(), new BukkitRunnable() {
9595
@Override
9696
public void run() {
9797
if (!fileExists()) {createFile();}
@@ -107,7 +107,7 @@ public void run() {
107107
log.warning("[AutoPickup] Unable to update "+uuid+"'s data file.");
108108
}
109109
}
110-
}.runTaskLater(plugin, 1);
110+
}, 1);
111111
}
112112

113113
public void setEnabledAutoSmelt(boolean e) {

src/main/resources/plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ commands:
1515
autodrops:
1616
description: Toggles the ability to automaticly pickup drops from killed entities.
1717
aliases: [drops, autod]
18-
autofishingdrops:
18+
autofish:
1919
description: Toggles the ability to automaticly pickup drops from fishing.
20-
aliases: [fishingdrops, autofd]
20+
aliases: [fishingdrops, autofd, autofishingdrops]
2121
autosmelt:
2222
description: Toggles the ability to automaticly smelt mined blocks.
2323
aliases: [asmelt]

0 commit comments

Comments
 (0)