From eb50bfcc014d3b932f460c243e67250ada89fa64 Mon Sep 17 00:00:00 2001 From: alexcrea Date: Mon, 3 Aug 2026 14:10:23 +0200 Subject: [PATCH 1/4] fix some custom recipe not working --- .../xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt | 6 +++--- .../kotlin/xyz/alexcrea/cuanvil/recipe/AnvilCustomRecipe.kt | 4 ++-- .../kotlin/xyz/alexcrea/cuanvil/util/CustomRecipeUtil.kt | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt index 7f9ef676..b9170804 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt @@ -214,10 +214,10 @@ class AnvilResultListener : Listener { val recipe = result.recipe!! // We remove what should be removed - if (rightItem != null) { - if (recipe.rightItem == null) return false// in case it changed + if (!rightItem.isAir) { + if (recipe.rightItem.isAir) return false// in case it changed - rightItem.amount -= amount * recipe.rightItem!!.amount + rightItem!!.amount -= amount * recipe.rightItem!!.amount view.setItem(ANVIL_INPUT_RIGHT, rightItem) } diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/recipe/AnvilCustomRecipe.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/recipe/AnvilCustomRecipe.kt index fd079c3a..1cd2b616 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/recipe/AnvilCustomRecipe.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/recipe/AnvilCustomRecipe.kt @@ -176,8 +176,8 @@ class AnvilCustomRecipe( CustomAnvil.verboseLog("Left item passed !") // we don't know if right item can be - if (rightItem == null) { // null test - if (item2 != null) return false + if (rightItem.isAir) { // null test + if (!item2.isAir) return false } else { val rightSimilar = rightItem!!.isSimilar(item2) CustomAnvil.verboseLog("Right similar: $rightSimilar") diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/util/CustomRecipeUtil.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/util/CustomRecipeUtil.kt index 058b25ad..b8a1907a 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/util/CustomRecipeUtil.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/util/CustomRecipeUtil.kt @@ -4,6 +4,7 @@ import io.delilaheve.CustomAnvil import org.bukkit.inventory.ItemStack import xyz.alexcrea.cuanvil.config.ConfigHolder import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe +import xyz.alexcrea.cuanvil.util.MaterialUtil.isAir import kotlin.math.min object CustomRecipeUtil { @@ -32,7 +33,7 @@ object CustomRecipeUtil { return if(recipe.exactCount) { if(leftItem.amount != recipe.leftItem!!.amount){ 0 - }else if(rightItem != null && rightItem.amount != recipe.rightItem!!.amount){ + }else if(!rightItem.isAir && rightItem!!.amount != recipe.rightItem!!.amount){ 0 }else{ 1 @@ -43,7 +44,7 @@ object CustomRecipeUtil { val resultItem = recipe.resultItem!! // we know exist as the recipe was returned to us val maxResultAmount = resultItem.maxStackSize/resultItem.amount val maxLeftAmount = leftItem.amount/recipe.leftItem!!.amount - val maxRightAmount = if(rightItem == null){ maxLeftAmount } else{ rightItem.amount/recipe.rightItem!!.amount } + val maxRightAmount = if(rightItem.isAir){ maxLeftAmount } else{ rightItem!!.amount/recipe.rightItem!!.amount } CustomAnvil.verboseLog("resultItem: $resultItem, maxResultAmount: $maxResultAmount, maxLeftAmount: $maxLeftAmount, maxRightAmount: $maxRightAmount") From d846ce51d8ad6f99edd2d228a2373c7fc6698a47 Mon Sep 17 00:00:00 2001 From: alexcrea Date: Mon, 3 Aug 2026 14:18:09 +0200 Subject: [PATCH 2/4] update faststats --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index e052d77f..e9b8d9af 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -55,7 +55,7 @@ dependencies { compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT") // fast stats - implementation("dev.faststats.metrics:bukkit:0.27.2") + implementation("dev.faststats.metrics:bukkit:0.29.0") // minimessage implementation("net.kyori:adventure-text-minimessage:4.25.0") From 6f077a576be163492c6af5b6bb77e25c6961be16 Mon Sep 17 00:00:00 2001 From: alexcrea Date: Mon, 3 Aug 2026 14:29:30 +0200 Subject: [PATCH 3/4] fix anvil degradation not working for --- .../xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt index b9170804..386a920b 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt @@ -243,6 +243,8 @@ class AnvilResultListener : Listener { player.updateInventory() } + + handleAnvilMechanic(player, view) return true } @@ -355,7 +357,7 @@ class AnvilResultListener : Listener { } if (event.click != ClickType.MIDDLE) - handleAnvilMechanic(player, view, player.gameMode != GameMode.CREATIVE) + handleAnvilMechanic(player, view) return true } @@ -384,6 +386,11 @@ class AnvilResultListener : Listener { } } + // Process both sound & degradation + private fun handleAnvilMechanic(player: HumanEntity, view: AnvilView) { + return handleAnvilMechanic(player, view, player.gameMode != GameMode.CREATIVE) + } + // Process both sound & degradation private fun handleAnvilMechanic(player: HumanEntity, view: AnvilView, canDegrade: Boolean) { // ok so we do not provide a getLocation on view ? From dff35bcc00007b66ad32e475f13a1a3117647686 Mon Sep 17 00:00:00 2001 From: alexcrea Date: Mon, 3 Aug 2026 14:42:02 +0200 Subject: [PATCH 4/4] fix hangar release condition --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 8848b25c..f3e796fc 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -108,7 +108,7 @@ jobs: build/libs/${{ env.OFFLINE_JAR_NAME }} - name: Hangar release - if: ${{ (github.event_name != 'release' || github.event_name != 'push') && github.repository_owner == 'alexcrea' && success() }} + if: ${{ (github.event_name == 'release' || github.event_name == 'push') && github.repository_owner == 'alexcrea' && success() }} env: HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }} RELEASE_CHANGELOG: ${{ github.event.release.body }}