Compare commits

..

No commits in common. "dff35bcc00007b66ad32e475f13a1a3117647686" and "3bb817aeca9e051371f3421fc00598cf6955e0e6" have entirely different histories.

5 changed files with 10 additions and 18 deletions

View file

@ -108,7 +108,7 @@ jobs:
build/libs/${{ env.OFFLINE_JAR_NAME }} build/libs/${{ env.OFFLINE_JAR_NAME }}
- name: Hangar release - 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: env:
HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }} HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }}
RELEASE_CHANGELOG: ${{ github.event.release.body }} RELEASE_CHANGELOG: ${{ github.event.release.body }}

View file

@ -55,7 +55,7 @@ dependencies {
compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT") compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
// fast stats // fast stats
implementation("dev.faststats.metrics:bukkit:0.29.0") implementation("dev.faststats.metrics:bukkit:0.27.2")
// minimessage // minimessage
implementation("net.kyori:adventure-text-minimessage:4.25.0") implementation("net.kyori:adventure-text-minimessage:4.25.0")

View file

@ -214,10 +214,10 @@ class AnvilResultListener : Listener {
val recipe = result.recipe!! val recipe = result.recipe!!
// We remove what should be removed // We remove what should be removed
if (!rightItem.isAir) { if (rightItem != null) {
if (recipe.rightItem.isAir) return false// in case it changed if (recipe.rightItem == null) return false// in case it changed
rightItem!!.amount -= amount * recipe.rightItem!!.amount rightItem.amount -= amount * recipe.rightItem!!.amount
view.setItem(ANVIL_INPUT_RIGHT, rightItem) view.setItem(ANVIL_INPUT_RIGHT, rightItem)
} }
@ -243,8 +243,6 @@ class AnvilResultListener : Listener {
player.updateInventory() player.updateInventory()
} }
handleAnvilMechanic(player, view)
return true return true
} }
@ -357,7 +355,7 @@ class AnvilResultListener : Listener {
} }
if (event.click != ClickType.MIDDLE) if (event.click != ClickType.MIDDLE)
handleAnvilMechanic(player, view) handleAnvilMechanic(player, view, player.gameMode != GameMode.CREATIVE)
return true return true
} }
@ -386,11 +384,6 @@ 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 // Process both sound & degradation
private fun handleAnvilMechanic(player: HumanEntity, view: AnvilView, canDegrade: Boolean) { private fun handleAnvilMechanic(player: HumanEntity, view: AnvilView, canDegrade: Boolean) {
// ok so we do not provide a getLocation on view ? // ok so we do not provide a getLocation on view ?

View file

@ -176,8 +176,8 @@ class AnvilCustomRecipe(
CustomAnvil.verboseLog("Left item passed !") CustomAnvil.verboseLog("Left item passed !")
// we don't know if right item can be // we don't know if right item can be
if (rightItem.isAir) { // null test if (rightItem == null) { // null test
if (!item2.isAir) return false if (item2 != null) return false
} else { } else {
val rightSimilar = rightItem!!.isSimilar(item2) val rightSimilar = rightItem!!.isSimilar(item2)
CustomAnvil.verboseLog("Right similar: $rightSimilar") CustomAnvil.verboseLog("Right similar: $rightSimilar")

View file

@ -4,7 +4,6 @@ import io.delilaheve.CustomAnvil
import org.bukkit.inventory.ItemStack import org.bukkit.inventory.ItemStack
import xyz.alexcrea.cuanvil.config.ConfigHolder import xyz.alexcrea.cuanvil.config.ConfigHolder
import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe
import xyz.alexcrea.cuanvil.util.MaterialUtil.isAir
import kotlin.math.min import kotlin.math.min
object CustomRecipeUtil { object CustomRecipeUtil {
@ -33,7 +32,7 @@ object CustomRecipeUtil {
return if(recipe.exactCount) { return if(recipe.exactCount) {
if(leftItem.amount != recipe.leftItem!!.amount){ if(leftItem.amount != recipe.leftItem!!.amount){
0 0
}else if(!rightItem.isAir && rightItem!!.amount != recipe.rightItem!!.amount){ }else if(rightItem != null && rightItem.amount != recipe.rightItem!!.amount){
0 0
}else{ }else{
1 1
@ -44,7 +43,7 @@ object CustomRecipeUtil {
val resultItem = recipe.resultItem!! // we know exist as the recipe was returned to us val resultItem = recipe.resultItem!! // we know exist as the recipe was returned to us
val maxResultAmount = resultItem.maxStackSize/resultItem.amount val maxResultAmount = resultItem.maxStackSize/resultItem.amount
val maxLeftAmount = leftItem.amount/recipe.leftItem!!.amount val maxLeftAmount = leftItem.amount/recipe.leftItem!!.amount
val maxRightAmount = if(rightItem.isAir){ maxLeftAmount } else{ rightItem!!.amount/recipe.rightItem!!.amount } val maxRightAmount = if(rightItem == null){ maxLeftAmount } else{ rightItem.amount/recipe.rightItem!!.amount }
CustomAnvil.verboseLog("resultItem: $resultItem, maxResultAmount: $maxResultAmount, maxLeftAmount: $maxLeftAmount, maxRightAmount: $maxRightAmount") CustomAnvil.verboseLog("resultItem: $resultItem, maxResultAmount: $maxResultAmount, maxLeftAmount: $maxLeftAmount, maxRightAmount: $maxRightAmount")