Skip to content

Commit

Permalink
Fixed bugs on spigot and old paper versions
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jan 14, 2024
1 parent 75afe1f commit b97506a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions eco-api/src/main/kotlin/com/willfp/eco/core/items/Items.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ fun ItemStack.toSNBT() =
Items.toSNBT(this)

/** @see Items.isEmpty */
@Deprecated("Use ItemStack.isEcoEmpty", ReplaceWith("Items.isEmpty(this)"))
val ItemStack?.isEmpty: Boolean
get() = Items.isEmpty(this)

/** @see Items.isEmpty */
val ItemStack?.isEcoEmpty: Boolean
get() = Items.isEmpty(this)

/** @see Items.matchesAny */
fun Collection<TestableItem>.matches(item: ItemStack): Boolean =
Items.matchesAny(item, this)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.willfp.eco.internal.gui.menu

import com.willfp.eco.core.gui.menu.events.CaptiveItemChangeEvent
import com.willfp.eco.core.items.isEcoEmpty
import com.willfp.eco.core.recipe.parts.EmptyTestableItem
import com.willfp.eco.util.MenuUtils
import com.willfp.eco.util.openMenu
Expand Down Expand Up @@ -54,7 +55,7 @@ class RenderedInventory(
val actualItem = inventory.getItem(bukkit) ?: continue

if (slot.isCaptiveFromEmpty) {
if (!actualItem.isEmpty) {
if (!actualItem.isEcoEmpty) {
newCaptive[position] = actualItem
}
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.willfp.eco.internal.spigot.arrows

import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.items.isEmpty
import com.willfp.eco.core.items.isEcoEmpty
import org.bukkit.entity.Arrow
import org.bukkit.entity.LivingEntity
import org.bukkit.event.EventHandler
Expand Down Expand Up @@ -29,7 +29,7 @@ class ArrowDataListener(

val item = entity.equipment?.itemInMainHand

if (item.isEmpty || item == null) {
if (item.isEcoEmpty || item == null) {
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.willfp.eco.internal.spigot.recipes

import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.items.TestableItem
import com.willfp.eco.core.items.isEmpty
import com.willfp.eco.core.items.isEcoEmpty
import com.willfp.eco.core.recipe.Recipes
import com.willfp.eco.core.recipe.parts.GroupedTestableItems
import com.willfp.eco.core.recipe.parts.TestableStack
Expand Down Expand Up @@ -33,7 +33,7 @@ class StackedRecipeListener(
}

// Just in case
if (inventory.getItem(event.slot).isEmpty) {
if (inventory.getItem(event.slot).isEcoEmpty) {
return
}

Expand Down

0 comments on commit b97506a

Please sign in to comment.